md
This commit is contained in:
parent
b16778e546
commit
6cdc22a1be
@ -13,16 +13,15 @@ package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.exception.EmisBizError;
|
||||
import com.xdadan.erp.emis.domain.vo.*;
|
||||
@ -278,29 +277,47 @@ public class EmisWaybillController extends BaseController
|
||||
"billCode":"T123213",
|
||||
"pdfInfo":"1231232112",
|
||||
"billDetail":"1231232",
|
||||
"isEncrpt":"false"
|
||||
"isEncrpt":"false",
|
||||
"printCount":"1",
|
||||
"printDate":"",
|
||||
"result":"success",
|
||||
"message":"",
|
||||
}
|
||||
]
|
||||
*/
|
||||
|
||||
if(!StringUtils.isEmpty(billCode)){
|
||||
|
||||
Map<String,Object> order=emisBaseService.getWaybillPrintOrder(billCode,billCodeRange,lang,printType);
|
||||
try {
|
||||
// response.setCharacterEncoding("UTF-8");
|
||||
// response.setContentType("application/pdf");
|
||||
// response.setHeader("Content-Disposition", "filename=" + billCode + ".pdf");
|
||||
// OutputStream os = response.getOutputStream();
|
||||
JSONArray jArr = new JSONArray();
|
||||
String[] billCodeArr = billCode.split(",");
|
||||
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
IXddTplPrint tplPrint = new TanexTplPrintImpl();
|
||||
tplPrint.genPDF(order, os);
|
||||
// 生成pdf base64
|
||||
byte[] pdfBytes = os.toByteArray();
|
||||
String pdfBase64Str = Base64.getEncoder().encodeToString(pdfBytes);
|
||||
System.out.println(pdfBase64Str);
|
||||
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()));
|
||||
|
||||
return AjaxResult.success("获取成功",pdfBase64Str);
|
||||
if(order!=null) {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||
IXddTplPrint tplPrint = new TanexTplPrintImpl();
|
||||
tplPrint.genPDF(order, os);
|
||||
// 生成pdf base64
|
||||
byte[] pdfBytes = os.toByteArray();
|
||||
String pdfBase64Str = Base64.getEncoder().encodeToString(pdfBytes);
|
||||
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("获取成功",jArr);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
return AjaxResult.error("获取失败");
|
||||
|
||||
@ -93,6 +93,9 @@ public class EmisBaseService {
|
||||
@Autowired
|
||||
private EmisRegionMapper emisRegionMapper;
|
||||
|
||||
@Autowired
|
||||
private EmisDestinationMapper emisDestinationMapper;
|
||||
|
||||
/**
|
||||
* 获取当前登录用户
|
||||
* @return
|
||||
@ -127,6 +130,28 @@ public class EmisBaseService {
|
||||
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){
|
||||
@ -143,25 +168,29 @@ public class EmisBaseService {
|
||||
}
|
||||
|
||||
EmisWaybill waybill = emisWaybillMapper.selectEmisWaybillByBillCode(billCode);
|
||||
if(waybill==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<String,Object> order = new HashMap<>();
|
||||
// Map<String,Object> order=new HashMap<>();
|
||||
order.put("order_sn", "DT20210901001");
|
||||
order.put("yd_sn", "SF1374689807723");
|
||||
order.put("order_sn", waybill.getOrderSn());
|
||||
order.put("yd_sn", waybill.getBillCode());
|
||||
order.put("kdgs", "TANEX");
|
||||
order.put("pdf_info", "[山东淄博-胡志明][越南DN]");
|
||||
// order.put("packageWJC", ".");
|
||||
// order.put("address", Convert.address("上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室"));
|
||||
order.put("address", "上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室");
|
||||
order.put("company", "SDSDS");
|
||||
order.put("mobile", Convert.mobile("13818228246"));
|
||||
order.put("consignee", Convert.chineseNameFirst("张三"));
|
||||
|
||||
// order.put("pdf_info", "[山东淄博-胡志明][越南DN]");
|
||||
order.put("pdf_info", waybill.getThirdCode());
|
||||
|
||||
// order.put("address", "上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室上海市黄浦区河南南路1009弄3号902室");
|
||||
order.put("address", waybill.getReceiveAddress());
|
||||
order.put("company", waybill.getReceiveCompany());
|
||||
order.put("mobile", waybill.getReceiveMobile());
|
||||
order.put("consignee", waybill.getReceiveName());
|
||||
|
||||
// order.put("consigneeAndMobile", Convert.chineseNameFirst("张三"+" "+"13818228246"));
|
||||
order.put("send_address", "Vancouver");
|
||||
order.put("send_company", "2324");
|
||||
order.put("send_mobile", "1604-683-1088");
|
||||
order.put("send_person", "Vancouver");
|
||||
order.put("send_address", waybill.getSendAddress());
|
||||
order.put("send_company", waybill.getSendCompany());
|
||||
order.put("send_mobile", waybill.getSendMobile());
|
||||
order.put("send_person", waybill.getSendName());
|
||||
order.put("ext_data", "{\"k1\":\"阿尔巴尼亚\",\"k2\":\"阿尔巴尼亚快递\",\"k3\":\"阿尔巴尼亚国际特快\",\"k4\":\"1-10工作日\",\"k5\":\"阿尔AL\",\"k6\":\"山东淄博-阿尔巴尼亚地拉那\"}");
|
||||
// order.put("sendPersonAndMobile", "Vancouver"+" "+"1604-683-1088");
|
||||
order.put("goods_info", "日常用品");
|
||||
|
||||
@ -53,11 +53,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
@Autowired
|
||||
private EmisWaybillMapper emisWaybillMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private IEmisWaybillFeeitemService emisWaybillFeeitemMapper;
|
||||
|
||||
@ -296,11 +291,27 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
// 派件网点
|
||||
emisWaybillSave.setDispatchSiteCode(emisWaybillSave.getDispatchUnderlingSiteCode());
|
||||
|
||||
|
||||
// 订单运单初始状态
|
||||
emisWaybillSave.setOrderStatus("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());
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user