md
This commit is contained in:
parent
c9283d89e6
commit
4781d1aaa8
@ -14,9 +14,7 @@ import org.apache.pdfbox.rendering.PDFRenderer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -95,18 +93,104 @@ public class PrintUtils
|
||||
// return ar;
|
||||
// }
|
||||
|
||||
public static void main(String[] args) {
|
||||
String jObj = null;
|
||||
try {
|
||||
// T1232432432432&tplCode=TAN-GM-130&_t=123
|
||||
for(int i=0;i<1;i++) {
|
||||
JSONArray jsonArray = PrintUtils.getImageByBillCode("T1232432432432", "TAN-GM-130","1");
|
||||
System.out.println(jsonArray.toJSONString());
|
||||
|
||||
|
||||
|
||||
|
||||
public static void drawGraphic(int start_x, int start_y, BufferedImage image) {
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
|
||||
int col = (width - 1) / 8 + 1;
|
||||
|
||||
String str = "";
|
||||
byte[] arrayOfByte = new byte[width * height];
|
||||
|
||||
int h = 0;
|
||||
//int b1 = 0;
|
||||
int arrindex = 0;
|
||||
//int m = 0;
|
||||
|
||||
|
||||
while (h < height) {
|
||||
for (int w = 0; w < width; w++) {
|
||||
arrindex = h * col + w / 8;
|
||||
System.out.println("w:" + w + ", h:" + h);
|
||||
if ((image.getRGB(w, h) & 0xFFFFFF) < 3092271) {
|
||||
int n = arrindex;
|
||||
byte[] arrayOfByte1 = arrayOfByte;
|
||||
|
||||
arrayOfByte1[n] = (byte) (arrayOfByte1[n] | 128 >> w % 8);
|
||||
} else {
|
||||
int n = arrindex;
|
||||
byte[] arrayOfByte1 = arrayOfByte;
|
||||
|
||||
arrayOfByte1[n] = (byte) (arrayOfByte1[n] & (128 >> w % 8 ^ 0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
++h;
|
||||
//if ((++h - b1) * col >= 1024 || h == height) {
|
||||
// str = bbbb(aaaaaa(arrayOfByte, m, arrindex - m + 1));
|
||||
// m = arrindex + 1;
|
||||
// String str1 = "EG " + col + " " + (h - b1) + " " + start_x + " " + (start_y + b1) + " " + str + "\r\n";
|
||||
//
|
||||
// System.out.println(str1);
|
||||
// //b(str1);
|
||||
// b1 = h;
|
||||
// k++;
|
||||
//}
|
||||
}
|
||||
|
||||
str = toHexString(copy(arrayOfByte, 0, arrindex + 1));
|
||||
System.out.println(str);
|
||||
|
||||
}
|
||||
static String toHexString(byte[] paramArrayOfbyte) {
|
||||
String str = "";
|
||||
for (int i = 0; i < paramArrayOfbyte.length; i++) {
|
||||
String hex = Integer.toHexString(paramArrayOfbyte[i] & 0xFF);
|
||||
if (hex.length() == 1) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
str = str + hex;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private static byte[] copy(byte[] paramArrayOfbyte, int start, int length) {
|
||||
byte[] arrayOfByte = new byte[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
arrayOfByte[i] = paramArrayOfbyte[start + i];
|
||||
}
|
||||
return arrayOfByte;
|
||||
}
|
||||
|
||||
public static void main1(String[] args) {
|
||||
// String jObj = null;
|
||||
// try {
|
||||
//// T1232432432432&tplCode=TAN-GM-130&_t=123
|
||||
// for(int i=0;i<1;i++) {
|
||||
// JSONArray jsonArray = PrintUtils.getImageByBillCode("T1232432432432", "TAN-GM-130","1");
|
||||
// System.out.println(jsonArray.toJSONString());
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
//String target = "/Users/zhiyu/Desktop/test/aaa_bin.bmp";
|
||||
String target = "/Users/alan/Downloads/T1232432432432.jpg";
|
||||
File file = new File(target);
|
||||
BufferedImage image = null;
|
||||
try {
|
||||
image = ImageIO.read(file);
|
||||
drawGraphic(0, 0, image);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -522,40 +522,40 @@
|
||||
|
||||
|
||||
<if test="params.beginSendDate != null and params.beginSendDate != ''">
|
||||
and send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
|
||||
</if>
|
||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||
and send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||
</if>
|
||||
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
|
||||
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
||||
and a.create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
|
||||
</if>
|
||||
<if test="params.endCreateTime != null and params.endCreateTime != ''">
|
||||
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
|
||||
and a.create_time <![CDATA[ <= ]]> #{params.endCreateTime}
|
||||
</if>
|
||||
|
||||
<if test="params.expireNotSign != null and params.expireNotSign == '1'">
|
||||
and estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
|
||||
and a.estimate_date <![CDATA[ < ]]> now() and bl_sign!='1'
|
||||
</if>
|
||||
|
||||
|
||||
|
||||
|
||||
<if test="params.printFlag != null and params.printFlag != ''">
|
||||
and bl_print=#{params.printFlag}
|
||||
and a.bl_print=#{params.printFlag}
|
||||
</if>
|
||||
|
||||
|
||||
|
||||
<if test="params.isNeedPack != null and params.isNeedPack == 1">
|
||||
and bill_code not in( select bill_code from emis_tms_pack_dtl m where m.del_flag='0' )
|
||||
and a.bill_code not in( select m.bill_code from emis_tms_pack_dtl m where m.del_flag='0' )
|
||||
</if>
|
||||
|
||||
|
||||
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||
and (
|
||||
send_site_code in (
|
||||
a.send_site_code in (
|
||||
SELECT t1.site_code FROM (
|
||||
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
|
||||
#{params.privSiteCode} ) pd
|
||||
@ -564,8 +564,8 @@
|
||||
SELECT #{params.privSiteCode} FROM dual
|
||||
)
|
||||
|
||||
or salesmen=#{params.privEmpCode}
|
||||
or payee=#{params.privEmpName}
|
||||
or a.salesmen=#{params.privEmpCode}
|
||||
or a.payee=#{params.privEmpName}
|
||||
)
|
||||
</if>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user