Compare commits

..

No commits in common. "8095ead92c1822620e0eff7e84974ff79ef421de" and "23ca847b938d589992e0fb36676e8177db7a73be" have entirely different histories.

4 changed files with 4 additions and 31 deletions

View File

@ -39,9 +39,4 @@ public class PrinterConfig {
*/
private String timeType;
/**
* 只有两层要么是A4要么是A5
*/
private String levelOne;
}

View File

@ -1,7 +1,6 @@
package com.dpkj.modules.print.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.dpkj.common.config.PrinterConfig;
import com.dpkj.common.dto.LexMarkDTO;
import com.dpkj.common.dto.LexMarkResultDTO;
import com.dpkj.common.exception.RRException;
@ -16,6 +15,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.util.Objects;
/**
* 利盟MS439打印机服务
@ -31,9 +31,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
@Resource
private ThirdService thirdService;
@Resource
private PrinterConfig printerConfig;
@Override
public LexMarkResultDTO<?> printImage(MS439Request request) {
// 校验是本地地址还是http开头的
@ -75,20 +72,9 @@ public class MS439PrintServiceImpl implements MS439PrintService {
// param.put("prtData", String.format("PrintType=%d;pagesource=%s;copies=%d;file[0]=%s;stamp=%d;duplex=%d;color=%d;direction=%d",
// request.getPagesource(), request.getCopies(), request.getFileDir(), request.getStamp(),
// request.getDuplex(), request.getColor(), request.getDirection()));
// 计算A4/A5归属
int printType = 1; // 默认使用第一层
if (printerConfig.getLevelOne().equals("A5")) {
if (request.getPagesource().equals("A4")) {
printType = 2;
}
} else if (printerConfig.getLevelOne().equals("A4")) {
if (request.getPagesource().equals("A5")) {
printType = 2;
}
}
param.put("prtData", String.format("PaperNum=%d;PrintType=%d;Stamp=%d;File[0]=%s;WaitNum=%d;copies=%d;stamp=%d;duplex=%d;color=%d;direction=%d",
request.getCopies(), // 盖章事件分数和打印份数一致
printType, // 打印类型1-A4或者2-A5
Objects.equals(request.getPagesource(), "A4") ? 1 : 2, // 打印类型1-A4或者2-A5
request.getStamp(), // 是否盖章
request.getFileDir(), // 要打印的文件的路径
request.getCopies(), // 盖章事件分数和打印份数一致
@ -101,10 +87,6 @@ public class MS439PrintServiceImpl implements MS439PrintService {
lexMarkDTO.setParam(param.toString());
LexMarkResultDTO<LexMarkResultDTO.Param> paramLexMarkResultDTO = thirdService.callDevice(lexMarkDTO, LexMarkResultDTO.Param.class);
if ( paramLexMarkResultDTO.getData().getResult() != 0){
throw new RRException(500, paramLexMarkResultDTO.getData().getResult() + "");
}
File file = new File(request.getFileDir());
// 检查文件是否存在
if (file.exists()) {
@ -145,11 +127,11 @@ public class MS439PrintServiceImpl implements MS439PrintService {
String paperStatus = "";
// 如果是A4,当前是取第一层纸盒作为A4
if (papersource.equals("A4")) {
paperStatus = printerConfig.getLevelOne().equals("A4") ? papers[0] : papers[1];
paperStatus = papers[0];
}
// 如果是A5当前是取第二层纸盒只作为A5
if (papersource.equals("A5")) {
paperStatus = printerConfig.getLevelOne().equals("A5") ? papers[0] : papers[1];
paperStatus = papers[1];
}
if ( !(paperStatus.equals(MS439PaperStatusEnum.PAPERFULL.getPrintCode()) || paperStatus.equals(MS439PaperStatusEnum.PAPERLOW.getPrintCode()))){
throw new RRException(500, paperStatus);

View File

@ -21,8 +21,6 @@ dpkj:
port-name:
# 波特率 串口连接下使用
baud-rate:
# 指定打印机第一层是a4还是a5
level-one: A5
# 自定义app参数
app:

View File

@ -21,8 +21,6 @@ dpkj:
port-name:
# 波特率 串口连接下使用
baud-rate:
# 指定打印机第一层是a4还是a5
level-one: A5
# 自定义app参数
app: