Commit 034976e1 by 唐功亮

回复代码

parent 848c7084
package io.office.modules.manage.controller;
/*import com.github.mbhk.barcode4j.Configuration;
import com.github.mbhk.barcode4j.Configuration;
import io.office.modules.app.annotation.Login;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
......@@ -23,11 +23,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;*/
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.logging.Logger;
/**
* 生成一维码方法
*
......@@ -38,50 +34,49 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/barcodegeneration")
public class BarcodeController {
//TODO tgl jar包报错 找张云飞
/*private final Log logger = LogFactory.getLog(getClass());
private final Log logger = LogFactory.getLog(getClass());
public Log getLogger() {
return logger;
}
*//** Parameter name for the message *//*
public Log getLogger() {
return logger;
}
/** Parameter name for the message */
public static final String BARCODE_MSG = "msg";
*//** Parameter name for the barcode type *//*
/** Parameter name for the barcode type */
public static final String BARCODE_TYPE = "type";
*//** Parameter name for the barcode height *//*
/** Parameter name for the barcode height */
public static final String BARCODE_HEIGHT = "height";
*//** Parameter name for the module width *//*
/** Parameter name for the module width */
public static final String BARCODE_MODULE_WIDTH = "mw";
*//** Parameter name for the wide factor *//*
/** Parameter name for the wide factor */
public static final String BARCODE_WIDE_FACTOR = "wf";
*//** Parameter name for the quiet zone *//*
/** Parameter name for the quiet zone */
public static final String BARCODE_QUIET_ZONE = "qz";
*//** Parameter name for the human-readable placement *//*
/** Parameter name for the human-readable placement */
public static final String BARCODE_HUMAN_READABLE_POS = "hrp";
*//** Parameter name for the output format *//*
/** Parameter name for the output format */
public static final String BARCODE_FORMAT = "fmt";
*//** Parameter name for the image resolution (for bitmaps) *//*
/** Parameter name for the image resolution (for bitmaps) */
public static final String BARCODE_IMAGE_RESOLUTION = "res";
*//** Parameter name for the grayscale or b/w image (for bitmaps) *//*
/** Parameter name for the grayscale or b/w image (for bitmaps) */
public static final String BARCODE_IMAGE_GRAYSCALE = "gray";
*//** Parameter name for the font size of the human readable display *//*
/** Parameter name for the font size of the human readable display */
public static final String BARCODE_HUMAN_READABLE_SIZE = "hrsize";
*//** Parameter name for the font name of the human readable display *//*
/** Parameter name for the font name of the human readable display */
public static final String BARCODE_HUMAN_READABLE_FONT = "hrfont";
*//** Parameter name for the pattern to format the human readable message *//*
/** Parameter name for the pattern to format the human readable message */
public static final String BARCODE_HUMAN_READABLE_PATTERN = "hrpattern";
private static final String ERROR_WHILE_GENERATING_BARCODE = "Error while generating barcode";
private static final Logger LOGGER = Logger.getLogger(BarcodeController.class.getName());
@Login
@GetMapping(value="/api/gensvg")
public void getBarcode(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
System.out.println("barcode................");
public void getBarcode(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
System.out.println("barcode................");
final String format = determineFormat(request);
final Orientation orientation = Orientation.ZERO;
final Configuration cfg = buildCfg(request);
......@@ -131,9 +126,9 @@ public class BarcodeController {
final String gray = request.getParameter(BARCODE_IMAGE_GRAYSCALE);
final BitmapCanvasProvider bitmap = "true".equalsIgnoreCase(gray)
? new BitmapCanvasProvider(bout, format, resolution, BufferedImage.TYPE_BYTE_GRAY, true,
orientation)
orientation)
: new BitmapCanvasProvider(bout, format, resolution, BufferedImage.TYPE_BYTE_BINARY, false,
orientation);
orientation);
gen.generateBarcode(bitmap, msg);
bitmap.finish();
}
......@@ -157,16 +152,16 @@ public class BarcodeController {
LOGGER.log(Level.SEVERE, ERROR_WHILE_GENERATING_BARCODE, e);
throw new ServletException(e);
}
}
}
*//**
/**
* Check the request for the desired output format.
*
* @param request
* the request to use
* @return MIME type of the desired output format.
*//*
*/
protected String determineFormat(HttpServletRequest request) {
String format = request.getParameter(BARCODE_FORMAT);
format = MimeTypes.expandFormat(format);
......@@ -176,14 +171,14 @@ public class BarcodeController {
return format;
}
*//**
/**
* Build an Configuration object from the request.
*
* @param request
* the request to use
* @return the newly built COnfiguration object
*
*//*
*/
protected Configuration buildCfg(HttpServletRequest request) {
// Get type
String type = request.getParameter(BARCODE_TYPE);
......@@ -232,5 +227,5 @@ public class BarcodeController {
}
return cfg;
}*/
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment