md
This commit is contained in:
parent
53098a1200
commit
7c357fd122
@ -1115,6 +1115,207 @@ public class EmisWaybillController extends EmisBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "APP获取打印数据,命令模式", businessType = BusinessType.OTHER)
|
||||||
|
@GetMapping("/realGetPrintByApp")
|
||||||
|
public AjaxResult realGetPrintByApp(String billCode, String subBillCodeRange,String tplCode, String lang, String printType)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!StringUtils.isEmpty(billCode)){
|
||||||
|
try {
|
||||||
|
|
||||||
|
JSONArray jArr = new JSONArray();
|
||||||
|
String printManCode=getLoginUser().getUser().getEmpCode();
|
||||||
|
|
||||||
|
// 确定是否打子单
|
||||||
|
|
||||||
|
JSONArray fileArrAll = new JSONArray();
|
||||||
|
String tplCodeStr=WaybillHelper.formatQueryValue(printType);
|
||||||
|
String tplCodeArr[]=tplCodeStr.split(",");
|
||||||
|
|
||||||
|
if(tplCodeArr.length>0){
|
||||||
|
for (String tpCodeItem:tplCodeArr) {
|
||||||
|
if("TAN-GC-130".equals(tpCodeItem)) {
|
||||||
|
|
||||||
|
// 循环获取主单信息
|
||||||
|
String billSubCodeAllStr="";
|
||||||
|
String[] billCodeArr = billCode.split(",");
|
||||||
|
if(billCodeArr.length>0){
|
||||||
|
IXddTplPrint xtp = new TanexSubBillPrintImpl();
|
||||||
|
for (String billCodeItem:billCodeArr) {
|
||||||
|
// 查询主单信息
|
||||||
|
EmisWaybill emisWaybill = emisBaseService.getWaybillByBillCode(billCodeItem);
|
||||||
|
|
||||||
|
// 获取所有子单号
|
||||||
|
if(StringUtils.isEmpty(subBillCodeRange)) {
|
||||||
|
billSubCodeAllStr = emisWaybill.getBillCodeSub() ;
|
||||||
|
}else{
|
||||||
|
String [] subRange=subBillCodeRange.split(",");
|
||||||
|
int start=Integer.valueOf(subRange[0]);
|
||||||
|
int end=emisWaybill.getParcelQty();
|
||||||
|
int len=subRange.length;
|
||||||
|
if(len>1){
|
||||||
|
end=Integer.valueOf(subRange[1]);
|
||||||
|
if((end-start)>50){
|
||||||
|
end=start+50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (start<=end && start<=emisWaybill.getParcelQty()){
|
||||||
|
billSubCodeAllStr=billSubCodeAllStr+""+emisWaybill.getBillCode()+""+StringUtils.leftPad(String.valueOf(start),4,'0')+",";
|
||||||
|
start++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 循环子单,最多60
|
||||||
|
log.error("===>billSubCodeAllStr==>",billSubCodeAllStr);
|
||||||
|
if(!StringUtils.isEmpty(billSubCodeAllStr)) {
|
||||||
|
String[] subCodArr=billSubCodeAllStr.split(",");
|
||||||
|
for (int i=0;i<50 && i<subCodArr.length;i++) {
|
||||||
|
String item = subCodArr[i];
|
||||||
|
|
||||||
|
if(!StringUtils.isEmpty(item)) {
|
||||||
|
Map<String, Object> order = emisBaseService.getWaybillPrintOrder(item, subBillCodeRange, tpCodeItem, "zh", tpCodeItem, printManCode);
|
||||||
|
String pdfBase64Data = xtp.genPDFBase64(order);
|
||||||
|
JSONObject jObj = new JSONObject();
|
||||||
|
jObj.put("result", "success");
|
||||||
|
jObj.put("billCodeItem", item);
|
||||||
|
jObj.put("file", pdfBase64Data);
|
||||||
|
|
||||||
|
fileArrAll.add(jObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// String strArry = PrintUtils.getPdfByBillCode(billSubCodeAllStr, tpCodeItem, printManCode);
|
||||||
|
// JSONArray fileArr = JSONArray.parseArray(strArry);
|
||||||
|
// fileArrAll.addAll(fileArr);
|
||||||
|
}else{
|
||||||
|
// 直接获取
|
||||||
|
String strArry = PrintUtils.getPdfByBillCode(billCode, tpCodeItem, printManCode);
|
||||||
|
JSONArray fileArr = JSONArray.parseArray(strArry);
|
||||||
|
fileArrAll.addAll(fileArr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// String strArry=PrintUtils.getPdfByBillCode(billCode,tplCodeStr,printManCode);
|
||||||
|
// JSONArray fileArr = JSONArray.parseArray(strArry);
|
||||||
|
for(Object objFile:fileArrAll) {
|
||||||
|
JSONObject jObjFileItem = (JSONObject) objFile;
|
||||||
|
String result = jObjFileItem.getString("result");
|
||||||
|
String billCodeItem = jObjFileItem.getString("billCodeItem");
|
||||||
|
JSONObject printItem = new JSONObject();
|
||||||
|
printItem.put("billCode", billCodeItem);
|
||||||
|
if (!"success".equals(result)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String pdfbase64 = jObjFileItem.getString("file");
|
||||||
|
try {
|
||||||
|
String fileId = UUID.fastUUID().toString();
|
||||||
|
String fileUploadDir = PayConfig.getUploadPath() + File.separator + DateUtils.datePath();
|
||||||
|
|
||||||
|
File saveDir = new File(fileUploadDir);
|
||||||
|
if (!saveDir.exists()) {
|
||||||
|
saveDir.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
String saveFileName = fileUploadDir + File.separator + fileId + ".jpg";
|
||||||
|
|
||||||
|
FileOutputStream os = new FileOutputStream(saveFileName);//输出流
|
||||||
|
IXddTplPrint tplPrint = new TanexTplPrintImpl();
|
||||||
|
PrintUtils.genImage(pdfbase64, os);
|
||||||
|
|
||||||
|
JSONObject jObjRemark = new JSONObject();
|
||||||
|
jObjRemark.put("billCode", billCodeItem);
|
||||||
|
jObjRemark.put("subBillCodeRange", subBillCodeRange);
|
||||||
|
jObjRemark.put("lang", lang);
|
||||||
|
jObjRemark.put("printType", printType);
|
||||||
|
|
||||||
|
SysFileInfo sysFileInfo = sysFileInfoService.ossUploadLocalFile(saveFileName, billCodeItem, jObjRemark.toJSONString());
|
||||||
|
String imageUrl = sysFileInfo.getFileRemoteUrl();
|
||||||
|
printItem.put("imageUrl", imageUrl);
|
||||||
|
printItem.put("result", "success");
|
||||||
|
printItem.put("message", "success");
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
printItem.put("imageUrl", "");
|
||||||
|
printItem.put("result", "fail");
|
||||||
|
printItem.put("message", "生成图片异常");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
jArr.add(printItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
// JSONArray jArr = new JSONArray();
|
||||||
|
// String[] billCodeArr = billCode.split(",");
|
||||||
|
//
|
||||||
|
// for(String billCodeItem:billCodeArr) {
|
||||||
|
// Map<String, Object> order = emisBaseService.getWaybillPrintOrder(billCodeItem, billCodeRange,tplCode,lang, printType);
|
||||||
|
// JSONObject printItem = new JSONObject();
|
||||||
|
// printItem.put("billCode",billCodeItem);
|
||||||
|
// if(order!=null) {
|
||||||
|
//
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// String fileId = UUID.fastUUID().toString();
|
||||||
|
// String fileUploadDir = PayConfig.getUploadPath()+File.separator+DateUtils.datePath();
|
||||||
|
//
|
||||||
|
// File saveDir = new File(fileUploadDir);
|
||||||
|
// if(!saveDir.exists()){
|
||||||
|
// saveDir.mkdirs();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String saveFileName = fileUploadDir+File.separator+fileId+".png";
|
||||||
|
//
|
||||||
|
// FileOutputStream os = new FileOutputStream(saveFileName);//输出流
|
||||||
|
// IXddTplPrint tplPrint = new TanexTplPrintImpl();
|
||||||
|
// tplPrint.genPNG(order, os);
|
||||||
|
//
|
||||||
|
// JSONObject jObjRemark = new JSONObject();
|
||||||
|
// jObjRemark.put("billCode",billCodeItem);
|
||||||
|
// jObjRemark.put("billCodeRange",billCodeRange);
|
||||||
|
// jObjRemark.put("lang",lang);
|
||||||
|
// jObjRemark.put("printType",printType);
|
||||||
|
//
|
||||||
|
// SysFileInfo sysFileInfo=sysFileInfoService.ossUploadLocalFile(saveFileName,billCodeItem,jObjRemark.toJSONString());
|
||||||
|
// String imageUrl = sysFileInfo.getFileRemoteUrl();
|
||||||
|
// printItem.put("imageUrl", imageUrl);
|
||||||
|
// printItem.put("result","success");
|
||||||
|
// printItem.put("message","success");
|
||||||
|
// }
|
||||||
|
// catch (Exception e)
|
||||||
|
// {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// printItem.put("imageUrl", "");
|
||||||
|
// printItem.put("result","fail");
|
||||||
|
// printItem.put("message","生成图片异常");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }else{
|
||||||
|
// printItem.put("result","fail");
|
||||||
|
// printItem.put("message","未获取到数据");
|
||||||
|
// }
|
||||||
|
// jArr.add(printItem);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return AjaxResult.success("获取成功",jArr);
|
||||||
|
}catch (Exception ex){
|
||||||
|
ex.printStackTrace();
|
||||||
|
return AjaxResult.error("获取失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.error("获取失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/realGetWaybillPdf")
|
@GetMapping("/realGetWaybillPdf")
|
||||||
public AjaxResult realGetWaybillPdf(HttpServletRequest request, HttpServletResponse response,String billCode, String billCodeRange,String tplCode, String lang, String printType,String printManCode,String isNeedPdf)
|
public AjaxResult realGetWaybillPdf(HttpServletRequest request, HttpServletResponse response,String billCode, String billCodeRange,String tplCode, String lang, String printType,String printManCode,String isNeedPdf)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2796,7 +2796,6 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
){
|
){
|
||||||
|
|
||||||
feeItem = new EmisWaybillFeeitem();
|
feeItem = new EmisWaybillFeeitem();
|
||||||
|
|
||||||
feeItem.setFeeCode(quoteItem.getFeeType());
|
feeItem.setFeeCode(quoteItem.getFeeType());
|
||||||
String feeName=DictUtils.getDictLabel("emis_fee_type",quoteItem.getFeeType());
|
String feeName=DictUtils.getDictLabel("emis_fee_type",quoteItem.getFeeType());
|
||||||
feeItem.setFeeName(feeName);
|
feeItem.setFeeName(feeName);
|
||||||
@ -2815,19 +2814,28 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
|||||||
feeItem.setAddWeightPrice(BigDecimal.valueOf(exprItem.getAdditionalWeight()));
|
feeItem.setAddWeightPrice(BigDecimal.valueOf(exprItem.getAdditionalWeight()));
|
||||||
feeItem.setInitialWeightFee(BigDecimal.valueOf(exprItem.getInitialWeight()));
|
feeItem.setInitialWeightFee(BigDecimal.valueOf(exprItem.getInitialWeight()));
|
||||||
|
|
||||||
String exprStr = exprItem.getCalculateExpression();
|
String calcExprStr=calcExp.replaceAll("w",emisWaybill.getTotalVolume().toString())
|
||||||
String calcExprStr=exprStr.replaceAll("w",emisWaybill.getTotalVolume().toString());
|
.replaceAll("s",exprItem.getInitialWeight().toString())
|
||||||
log.info("计算公式:"+calcExprStr+",体积:"+emisWaybill.getTotalVolume());
|
.replaceAll("d",exprItem.getAdditionalWeight().toString());
|
||||||
|
|
||||||
|
log.info("计算公式:"+calcExprStr+",体积:"+emisWaybill.getTotalVolume());
|
||||||
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
double fee = Double.valueOf(AviatorEvaluator.execute(calcExprStr).toString());
|
||||||
|
|
||||||
fee=WaybillHelper.calcSettledFee(fee,quoteItem.getPriceType());
|
fee=WaybillHelper.calcSettledFee(fee,quoteItem.getPriceType());
|
||||||
|
// 如果低于最低报价,则使用最低报价来计算
|
||||||
|
if( fee < quoteItem.getLeastPrice().doubleValue() ){
|
||||||
|
fee = quoteItem.getLeastPrice().doubleValue();
|
||||||
|
feeItem.setRemark("must > "+quoteItem.getLeastPrice().doubleValue());
|
||||||
|
}else{
|
||||||
|
feeItem.setRemark(feeItem.getCalcExp());
|
||||||
|
}
|
||||||
|
|
||||||
feeItem.setFee(BigDecimal.valueOf(fee));
|
feeItem.setFee(BigDecimal.valueOf(fee));
|
||||||
feeItem.setRealFee(BigDecimal.valueOf(fee));
|
feeItem.setRealFee(BigDecimal.valueOf(fee));
|
||||||
|
|
||||||
log.info("计算后费用:"+feeItem.getFee());
|
log.info("计算后费用:"+feeItem.getFee());
|
||||||
|
|
||||||
totalFee=totalFee+fee;
|
totalFee=totalFee+fee;
|
||||||
feeItem.setRemark(feeItem.getCalcExp());
|
|
||||||
feeItem.setBlAutoGen("1");
|
feeItem.setBlAutoGen("1");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -665,7 +665,7 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
|
<if test="params.problemQueryType != null and params.problemQueryType == 2 and params.problemQueryIds != null and params.problemQueryIds !=''">
|
||||||
and !FIND_IN_SET(a.`problem_type`,#{params.problemQueryIds})
|
and ( !FIND_IN_SET(a.`problem_type`,#{params.problemQueryIds}) or a.`problem_type` is null)
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user