- 浏览: 150066 次
- 性别:
- 来自: 南昌
文章分类
- 全部博客 (123)
- Hibernate (10)
- Struts2 (6)
- Spring (5)
- Maven (11)
- Eclipse (5)
- Mysql (14)
- Html (3)
- IIS (4)
- Svn (2)
- Jquery (3)
- Apahce (1)
- Jsp (4)
- 其它 (10)
- ssh2 (2)
- java (14)
- js (8)
- Flex (4)
- barcode4j (1)
- powerdesiger (1)
- ibaits (2)
- googlemap (1)
- 淘宝客 (1)
- linux (7)
- idea (1)
- Query全屏滚动插件FullPage.js中文帮助文档API (1)
- 编写 (0)
最新评论
-
a276664990:
这玩意怎么使用?
googleMap.js -
xm_koma:
有没有将JFreeChart生成的图表导出到Excel中的例子 ...
在Web上用iText和JFreeChart将图形报表导出到PDF -
chong2230:
多谢 借用了
js复制当前链接 -
mikkjl:
非常感谢 按照你的做法 成功解决了问题 呵呵
struts2配置多个配置文件 -
yadsun:
推荐你用ActivePort,一个小工具300k不到,最重要的 ...
端口查看
package com.jltour.common.util;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.awt.image.DataBufferByte;
import java.awt.image.RenderedImage;
import java.awt.image.WritableRaster;
import java.awt.image.renderable.ParameterBlock;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.media.jai.Histogram;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.RenderedOp;
import org.apache.struts2.ServletActionContext;
import org.krysalis.barcode4j.impl.code39.Code39Bean;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
import org.krysalis.barcode4j.tools.UnitConv;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.jltour.authority.auto.beans.User;
import com.jltour.common.constant.OptionType;
import com.jltour.common.exception.Java91Exception;
import com.jltour.common.framework.Framework;
import com.jltour.common.framework.Java91Config;
import com.jltour.common.manager.FtpManager;
import com.jltour.common.manager.OptionManager;
import com.jltour.common.manager.fax.HttpRequester;
import com.jltour.common.manager.fax.HttpRespons;
import com.jltour.common.manager.interfaces.FaxManager;
import com.jltour.reserve.aManual.dao.ReserveDao;
import com.jltour.reserve.auto.beans.Dailyauditstatus;
import com.jltour.reserve.auto.beans.Order;
import com.jltour.reserve.auto.beans.Orderitem;
import com.jltour.reserve.auto.beans.Orderitemdate;
import com.jltour.reserve.auto.beans.Orderotherfees;
import com.jltour.reserve.auto.beans.Orderroomtypebean;
import com.jltour.reserve.auto.beans.Orderroomtypeprice;
import com.jltour.reserve.auto.dao.OrderDao;
import com.jltour.reserve.auto.dao.OrderroomtypepriceDao;
import com.sun.image.codec.jpeg.ImageFormatException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.media.jai.codec.BMPEncodeParam;
import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.jai.codec.ImageCodec;
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.ImageEncoder;
import com.sun.media.jai.codec.JPEGEncodeParam;
import com.sun.media.jai.codec.SeekableStream;
import com.sun.media.jai.codec.TIFFDecodeParam;
import com.sun.media.jai.codec.TIFFEncodeParam;
import com.sun.media.jai.codecimpl.BMPCodec;
import com.sun.media.jai.codecimpl.BMPImageEncoder;
/**
* 传真图片工具类
*
* @author huangjin
*
*/
public class ImageFaxUtil {
// private static String bascDec ="D:\\reportXmlFile\\ok\\" ;
private static String baseHeadFile = "baseHead.bmp";//baseHeadMember.bmp
private static String baseHeadMemberFile = "baseHeadMember.bmp";
private static String baseHeadDayFile = "baseHeadDay.bmp";
private static String baseBottomFile = "baseBottom.bmp";
private static final int imageWidth = 800;// 传真文件宽度
private static final Font fontPage = new Font("宋体", Font.BOLD, 14);// 当前页面的字体设置
//private static final Font fontPage = new Font("黑体", Font.PLAIN, 12);// 当前页面的字体设置
private static String jltourPhoto = "86-755-33397777";
private static final String jltourFax = "86-755-33389800";
private static final int linHieght = 25;
//创建订单传真图片-供应商
public static String createOrderFaxPictureBySupplier(String bascDec, String barcode, String resultSrc, User user, Order order, List orderroomtypebeanList, List orderotherfeesList,
String orderType,String isprotocol) {
if (null == user || null == order || null == orderroomtypebeanList || orderroomtypebeanList.size()<=0 || null == orderType || orderType.length()<=0)
return null;
//System.out.println("33333333333333333333333333333333333333333333333333333333333333333333333333");
try {
if(null == isprotocol || isprotocol.length()<=0){
isprotocol="8";
}
String pers = order.getCheckinpersons();
//String pers = "保钓委执委曾健成说,他们首选是从香港出发前往钓鱼岛宣示主权,但由于担心受到阻挠,因此,他们同时也拟定从台湾出发的方案。但最后从哪里出发,无明确说明。";
int perno = pers.length()/45+1;
BufferedImage imageHead = new BufferedImage(imageWidth, 250+(perno-1)*15+10, BufferedImage.TYPE_INT_RGB);
String barCodeDic= ImageFaxUtil.createBarcodeImage(bascDec, barcode);//条形码图片
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 250+(perno-1)*15+10);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
graphics.drawString(CommonUtil.getDefault(order.getHotelname())+" 订房部", 75, 185);// 酒店的名字
//graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(45, 190, 295, 190);//画线
graphics.drawString(order.getHotelname(), 110, 205);
graphics.drawLine(45, 210, 280, 210);//画线
String pricingtype="";
if(order.getPricingtype().intValue() == 11 ){
pricingtype="客人前台现付";
}else{
if(order.getOrherhang().intValue()==1){
pricingtype="房费挂帐,杂费可挂帐";
}else{
pricingtype="房费挂帐,杂费客人自理";
}
}
graphics.drawString(pricingtype, 110, 230);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("酒店名称:", 45, 205);// 酒店的名字
graphics.drawString("结算方式:", 45, 230);
graphics.drawString("客人姓名:", 45, 250);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
graphics.drawLine(45, 235, 295, 235);//画线
int noys=250;
int test=0;
int i=0;
if(perno>1){
while(i<perno){
test = (((i)*45+45)>=pers.length())?pers.length():((i)*45+45-1);
graphics.drawString(pers.substring((i)*45,test), 105, noys);
noys = noys+15;
i++;
}
}else{
graphics.drawString(pers, 105, 250);
}
graphics.drawString("订单编号:", 600, 152);
graphics.drawString(order.getOrdercd(), 665, 152);
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(orderType, 235, 155);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user.getUsercd()+"/"+user.getRealname(), orderType, order);
BufferedImage bi_pricesrc = ImageFaxUtil.createImagePrice(orderroomtypebeanList, orderotherfeesList, orderType, order,isprotocol,"sup");
//File logofile = new File(Framework.servletRealPath+"faxFile\\"+ baseBottomFile);
//Image logo_src = javax.imageio.ImageIO.read(logofile); // 读取最下面的文件
BufferedImage bottom =ImageFaxUtil.createImageBottom();
int bg_width = imageHead.getWidth(null);
int bg_height = imageHead.getHeight(null);
int logo_width = bottom.getWidth(null);
int logo_height = bottom.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
BufferedImage imgage = new BufferedImage(imageWidth, bg_height + logo_height + bi_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(imageHead, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
// 组合下面
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bottom, 0, bg_height + bi_height, logo_width, logo_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
// imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
return resultSrc;
}
//生成条形码文件 返回对应的生成的条形码文件的图片全称
public static String createBarcodeImage(String bascDec, String content) throws IOException {
String result = "";
Code39Bean bean = new Code39Bean();
final int dpi = 150;
bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); // makes the narrow
// bar
bean.setHeight(10);
bean.setWideFactor(3);
bean.doQuietZone(false);
File outputFile = new File(bascDec + content + "barcode.jpg");
OutputStream out = new FileOutputStream(outputFile);
try {
BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/jpeg", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0);
bean.generateBarcode(canvas, content);
canvas.finish();
result = content + "barcode.jpg";
} finally {
out.close();
}
return result;
}
//供应商 订单底图
public static BufferedImage createImageBottom() {
BufferedImage image = new BufferedImage(imageWidth, 180, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(55, 10, 760, 10);//画线
graphics.drawString("酒店确认栏", 55, 30);// photo
graphics.drawString("□ 本单确认", 85, 50);// photo
graphics.drawString("□ 本单不确认及原因", 205, 50);//
graphics.drawLine(345, 60, 760, 60);//画线
graphics.drawString("确认号:", 85, 80);// photo
graphics.drawLine(125, 90, 760, 90);//画线
graphics.drawString("签名栏:", 85, 120);// photo
graphics.drawLine(125, 130, 760, 130);//画线
graphics.drawString("酒店备注:", 85, 160);// photo
graphics.drawLine(125, 169, 760, 169);//画线
return image;
}
public static BufferedImage createImageBottomByCustomer() {
BufferedImage image = new BufferedImage(imageWidth, 160, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(15, 0, 800, 0);//画线
return image;
}
//供应商 订单传真 价格
public static BufferedImage createImagePrice(List orderroomtypebeanList, List orderotherfeesList, String orderType, Order order,String isprotocol,String cus_suptype) {
int noCount=0;
double countPirce=0;
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean;
int priceRoomLength=0;
String showpricenotes="";
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
if("1".equals(isprotocol)){
orderroomtypebean.setPricenotebaseprice("协议价");
showpricenotes="协议价";
orderroomtypebean.setCreateby("协议价");
}else{
if(orderroomtypebean.getPricingtype()==11){
if("sup".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalsaleprice() || orderroomtypebean.getIsequalsaleprice()!=1){
showpricenotes=orderroomtypebean.getPricenotesaleprice();
}else{
showpricenotes=""+orderroomtypebean.getAvasaleprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvasaleprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}else if("cus".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalsaleprice() || orderroomtypebean.getIsequalsaleprice()!=1){
showpricenotes=orderroomtypebean.getPricenotesaleprice()+" 返"+((int)(orderroomtypebean.getAvasaleprice().doubleValue()-orderroomtypebean.getAvapreeprice().doubleValue()));
}else{
showpricenotes=""+orderroomtypebean.getAvasaleprice()+" 返"+((int)(orderroomtypebean.getAvasaleprice().doubleValue()-orderroomtypebean.getAvapreeprice().doubleValue()));
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvasaleprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}else{
if("sup".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalbaseprice() || orderroomtypebean.getIsequalbaseprice()!=1){
showpricenotes=orderroomtypebean.getPricenotebaseprice();
}else{
showpricenotes=""+orderroomtypebean.getAvabaseprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvabaseprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvabaseprice().intValue()*orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}else if("cus".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalpreeprice() || orderroomtypebean.getIsequalpreeprice()!=1){
showpricenotes=orderroomtypebean.getPricenotepreeprice();
}else{
showpricenotes=""+orderroomtypebean.getAvapreeprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvapreeprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvapreeprice().intValue()*orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}
}
if(orderroomtypebean.getRoomtypenameratetype().length()>showpricenotes.length()){
priceRoomLength= orderroomtypebean.getRoomtypenameratetype().length();
}else{
priceRoomLength=showpricenotes.length();
}
noCount = noCount+ (priceRoomLength/11+1)*linHieght;
}
}
String hotelRemark = "";
if("sup".equals(cus_suptype)){
hotelRemark= order.getHotelremark();
}else{
hotelRemark=order.getMemberremark();
}
int remarkNos = hotelRemark.length()/42+1;
int imageHeight = 15 + orderroomtypebeanList.size() * linHieght + orderotherfeesList.size() * linHieght + linHieght + 10+55+(remarkNos-1)*20+noCount;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawLine(42, 0, 760, 0);//画线
graphicsPrice.drawString("类型", 45, 15);
graphicsPrice.drawString("内容", 150, 15);
graphicsPrice.drawString("入住日期", 242, 15);
graphicsPrice.drawString("退房日期", 310, 15);
graphicsPrice.drawString("晚数", 380, 15);
graphicsPrice.drawString("间数", 420, 15);
graphicsPrice.drawString("含早情况", 460, 15);
if (order.getPricingtype() == 11) {// 现付
graphicsPrice.drawString("现付价", 590, 15);
} else {
graphicsPrice.drawString("挂帐价", 590, 15);
}
graphicsPrice.drawString("小计", 715, 15);
graphicsPrice.drawLine(42, 20, 760, 20);//画线
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 头部字
graphicsPrice.setFont(fontContent);
int noY = 15;// 当前开始写的y坐标
int priceRoomLength=0;//最长的字体长度
int rowLength=1;//行数
String latestarrivaltime="";//到店时间
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean;
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
noY = noY + linHieght;
//orderroomtypebean.setRoomtypenameratetype("标单(含单早)K JFDKJF");//房型
//orderroomtypebean.setRoomtypenameratetype("李停,张莫大李世大刘新好不成因为莫成好李成莫金大中胡涛水");//房型
//orderroomtypebean.setPricenotebaseprice("9月4日490,9月5日500,9月6日510");//价格字段
/*int roomtypeX=90;
if(orderroomtypebean.getRoomtypenameratetype().length()>11){
//orderroomtypebean.setRoomtypenameratetype(orderroomtypebean.getRoomtypenameratetype().substring(0,11));
}
if(orderroomtypebean.getRoomtypenameratetype().length()<4){
roomtypeX=120;
}else if(orderroomtypebean.getRoomtypenameratetype().length()<8){
roomtypeX=100;
}else {
roomtypeX=90;
}
*/
orderType=orderType.replace("预订", "");
graphicsPrice.drawString(orderType.substring(0,orderType.length()-1), 46, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckindate(), "M月d日"),245, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckoutdate(), "M月d日"), 320, noY);
graphicsPrice.drawString(orderroomtypebean.getDays()+"晚", 386, noY);
graphicsPrice.drawString(orderroomtypebean.getRoomqty()+"间 ", 425, noY);
graphicsPrice.drawString(orderroomtypebean.getCreateby(), 710, noY);
/*
Map map=new HashMap();
OrderroomtypepriceDao orderroomtypepriceDao=(OrderroomtypepriceDao) Framework.getDaoFactory().getBean("orderroomtypepriceDao");
int breakfast=10;
if(orderroomtypebean.getServicerate().intValue()==1){//该BEAN的所有PRICE 都为是一样的。
breakfast=orderroomtypebean.getIncludebreakfastqty2();
}else{
map.put("orderroomtypebeanid", orderroomtypebean.getOrderroomtypebeanid());
map.put("sortString", "includebreakfastqty2,night");
List pricelist=orderroomtypepriceDao.queryOrderroomtypeprices(map);
Orderroomtypeprice price=null;
for(int n=0;n<pricelist.size();n++){
price=(Orderroomtypeprice)pricelist.get(n);
}
}
*/
graphicsPrice.drawString(OptionManager.getNameByCode(OptionType.inbreakfast, "" + orderroomtypebean.getIncludebreakfastqty2()), 476, noY);
//graphicsPrice.drawString(orderroomtypebean, 476, noY);
//latestarrivaltime = orderroomtypebean.getLatestarrivaltime();
//graphicsPrice.drawString(orderroomtypebean.getLatestarrivaltime(), 450, noY);
/*
* if(order.getPricingtype()==11){//现付
* if(orderroomtypebean.getIsequalsaleprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotesaleprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }else{
* if(orderroomtypebean.getIsequalbaseprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotebaseprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }
*/
/*
if("1".equals(isprotocol)){
graphicsPrice.drawString("协议价", 535, noY);//现付价
graphicsPrice.drawString("协议价", 680, noY);//现付价
}else{
if (order.getPricingtype().intValue() == 11) {// 现付
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvasaleprice().intValue(), 530, noY);//现付价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 700, noY);//现付合计
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
} else {
graphicsPrice.drawString(order.getCurrency()+" "+(int) orderroomtypebean.getAvabaseprice().intValue(), 530, noY);//底价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvabaseprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()),700, noY);
countPirce = countPirce + (int) orderroomtypebean.getAvabaseprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}*/
if(orderroomtypebean.getRoomtypenameratetype().length()>orderroomtypebean.getPricenotebaseprice().length()){
priceRoomLength= orderroomtypebean.getRoomtypenameratetype().length();
}else{
priceRoomLength=orderroomtypebean.getPricenotebaseprice().length();
}
int rows =0;
String [] showroomtypes=StringsUtil.splitByindex(orderroomtypebean.getRoomtypenameratetype(),10);
String [] showprices=StringsUtil.splitByindex(orderroomtypebean.getPricenotebaseprice(),23);
if(showroomtypes.length>showprices.length){
rows=showroomtypes.length;
}else{
rows=showprices.length;
}
for(int jj=0;jj<rows;jj++){
if(jj<=showroomtypes.length-1){
if(showroomtypes.length==1 && showroomtypes[jj].length()<3){
graphicsPrice.drawString(showroomtypes[jj], 130, noY);
}else if(showroomtypes.length==1 && showroomtypes[jj].length()<6){
graphicsPrice.drawString(showroomtypes[jj], 110, noY);
}else{
graphicsPrice.drawString(showroomtypes[jj], 90, noY);
}
}
if(jj<=showprices.length-1){
if(showprices.length==1 && showprices[jj].length()<7){
graphicsPrice.drawString(showprices[jj], 580, noY);
}else if(showprices.length==1 && showprices[jj].length()<14){
graphicsPrice.drawString(showprices[jj], 550, noY);
}else{
graphicsPrice.drawString(showprices[jj], 530, noY);
}
}
if(jj==rows-1){
}else{
noY=noY+linHieght;
}
}
graphicsPrice.drawLine(42, noY+5, 760, noY+5);//画线
}
}
//画竖线
graphicsPrice.drawLine(240, 0, 240, noY+5);//入住
graphicsPrice.drawLine(305, 0, 305, noY+5);//退房日期
graphicsPrice.drawLine(375, 0, 375, noY+5);//晚数
graphicsPrice.drawLine(415, 0, 415, noY+5);//间数
graphicsPrice.drawLine(455, 0, 455, noY+5);//晚数
double sumprice = 0;
graphicsPrice.setFont(fontContent);
if (null != orderotherfeesList) {
Orderotherfees orderotherfees;
for (int i = 0; i < orderotherfeesList.size(); i++) {
orderotherfees = (Orderotherfees) orderotherfeesList.get(i);
sumprice = sumprice + orderotherfees.getTotalamount();
String otherfeeString="";
String begindates="";
String enddates="";
String dates="";
begindates=CommonUtil.getDateString(orderotherfees.getBegindate(), "M月d日");
if(null==orderotherfees.getEnddate()){
dates=begindates;
}else{
enddates=CommonUtil.getDateString(orderotherfees.getEnddate(), "M月d日");
dates=begindates+"~"+enddates;
}
otherfeeString=otherfeeString+dates;
if (orderotherfees.getFeetype().intValue() == 2) {//早餐
otherfeeString=otherfeeString+" 加"+OptionManager.getNameByCode(OptionType.breaktype, "" + orderotherfees.getBreakfasttype())+" ";
} else {//加床
otherfeeString=otherfeeString+" 加床 ";
}
//otherfeeString=otherfeeString+order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ";
if(null!=orderType && orderType.length()>2){
orderType=orderType.substring(0,orderType.length()-1);
}
noY = noY + linHieght;
graphicsPrice.drawString(orderType, 45, noY);
graphicsPrice.drawString(otherfeeString, 111, noY);
graphicsPrice.drawString(order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ", 535, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderotherfees.getCompanyid()), 700, noY);
graphicsPrice.drawLine(42, noY+5, 760, noY+5);//画线
}
}
if("1".equals(isprotocol)){
graphicsPrice.drawString("协议价", 710, noY + linHieght);
}else{
graphicsPrice.drawString(countPirce + sumprice + "", 700, noY + linHieght);
}
graphicsPrice.drawString("总计("+order.getCurrency()+"):", 580, noY + linHieght);
//下面信息
graphicsPrice.setFont(fontHead);
graphicsPrice.drawString("到店时间:", 40, noY+linHieght+linHieght);
graphicsPrice.drawString(latestarrivaltime, 110, noY+linHieght+linHieght);
if("sup".equals(cus_suptype)){
graphicsPrice.drawString("确认号:", 170, noY+linHieght+linHieght);
graphicsPrice.drawString(null==order.getConfirmno()?"":order.getConfirmno(), 225, noY+linHieght+linHieght);
}
graphicsPrice.drawString("备注信息:", 40, noY+linHieght+linHieght+20);
//graphicsPrice.drawString(order.getHotelremark(), 110, noY+linHieght+linHieght+20);//备注信息
if(remarkNos>1){
int rnoy = noY+linHieght+linHieght+20;
int i=0;
while(i<=remarkNos-1){
graphicsPrice.drawString(hotelRemark.substring(i*43,(i*43+43)>=hotelRemark.length()?hotelRemark.length():(i*43+43)), 110, rnoy);//备注信息
graphicsPrice.drawLine(110, rnoy+5, 760, rnoy+5);//横线
rnoy+=20;
i++;
}
}else{
graphicsPrice.drawString(hotelRemark, 110, noY+linHieght+linHieght+20);//备注信息
graphicsPrice.drawLine(110, noY+linHieght+linHieght+20+5, 760, noY+linHieght+linHieght+20+5);//横线
}
//画竖线
graphicsPrice.drawLine(85, 0, 85, noY+5);//房型
graphicsPrice.drawLine(42, 0, 42, noY+linHieght+5);//画开始线
graphicsPrice.drawLine(525, 0, 525, noY+5);//含早情况
graphicsPrice.drawLine(695, 0, 695, noY+linHieght+5);//结算价
graphicsPrice.drawLine(760, 0, 760, noY+linHieght+5);//画结束线
graphicsPrice.drawLine(42, noY+linHieght+5, 760, noY+linHieght+5);//最后横线
return image;
}
public static String createTiffImageByFileName(String filepath) throws Java91Exception{
String filepath_tif="";
if(null != filepath && filepath.length()>0){
String filepath_tiff = filepath.substring(0,filepath.lastIndexOf("."))+".tif";
try{
String filename_jpg= filepath.substring(filepath.lastIndexOf(File.separator)+1,filepath.length());
String filename_tif = filepath_tiff.substring(filepath_tiff.lastIndexOf(File.separator)+1,filepath_tiff.length());
//System.out.println("22222222222222222"+filepath);
//System.out.println("444444"+filepath_tiff);
//System.out.println("444444"+filename_jpg);
//System.out.println("444444"+filename_tif);
boolean isUp = FtpManager.put("FaxDec"+File.separator+filename_jpg, filepath);
if(isUp){//如果上传成功
//执行调用 jpg转tif文件
HttpRequester request = new HttpRequester();
request.setDefaultContentEncoding("utf-8");
//HttpRespons hr = request.sendGet("http://localhost:8080/Fax/FaxServlet?fileName="+fileNames);//上传成功后调用转tiff命令
//System.out.println(Java91Config.jpg2tifservlet+"?fileName="+filename_jpg);
HttpRespons hr = request.sendGet(Java91Config.jpg2tifservlet+"?fileName="+filename_jpg);//上传成功后调用转tiff命令
// System.out.println(hr.getContent());
if(null !=hr.getContent() && hr.getContent().length()>0){
//System.out.println("33333333333333"+File.separator+filename_tif);
filepath_tif = FtpManager.downFile("FaxDec"+File.separator+filename_tif);
}
}
}catch (Exception e){
e.printStackTrace();
throw new Java91Exception("创建TIF文件错误!请与管理员联系,确认图片服务器正常");
}
}
return filepath_tif;
}
//创建订单传真图片-供应商
public static String createOrderFaxPictureByCustomer(String bascDec, String barcode, String resultSrc, User user, Order order, List orderroomtypebeanList, List orderotherfeesList,
String orderType) {
if (null == user || null == order || null == orderroomtypebeanList || orderroomtypebeanList.size()<=0 || null == orderType || orderType.length()<=0)
return null;
String isprotocol="8";
try {
String pers = order.getCheckinpersons();
//String pers = "保钓委执委曾健成说,他们首选是从香港出发前往钓鱼岛宣示主权,但由于担心受到阻挠,因此,他们同时也拟定从台湾出发的方案。但最后从哪里出发,无明确说明。";
int perno = pers.length()/45+1;
BufferedImage imageHead = new BufferedImage(imageWidth, 250+(perno-1)*15+10, BufferedImage.TYPE_INT_RGB);
String barCodeDic= ImageFaxUtil.createBarcodeImage(bascDec, barcode);//条形码图片
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 250+(perno-1)*15+10);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
//graphics.drawString(CommonUtil.getDefault(order.getHotelname())+" 订房部", 75, 185);// 酒店的名字
graphics.drawString(CommonUtil.getDefault(order.getCustomername())+" "+order.getMembername(), 75, 185);// 酒店的名字
//graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(45, 190, 295, 190);//画线
graphics.drawString(order.getHotelname(), 110, 205);
graphics.drawLine(45, 210, 280, 210);//画线
String pricingtype="";
if(order.getPricingtype().intValue() == 11 ){
pricingtype="客人前台现付";
}else{
if(order.getOrherhang().intValue()==1){
pricingtype="房费挂帐,杂费可挂帐";
}else{
pricingtype="房费挂帐,杂费客人自理";
}
}
graphics.drawString(pricingtype, 110, 230);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("酒店名称:", 45, 205);// 酒店的名字
graphics.drawString("结算方式:", 45, 230);
graphics.drawString("客人姓名:", 45, 250);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
graphics.drawLine(45, 235, 295, 235);//画线
int noys=250;
int test=0;
int i=0;
if(perno>1){
while(i<perno){
test = (((i)*45+45)>=pers.length())?pers.length():((i)*45+45-1);
graphics.drawString(pers.substring((i)*45,test), 105, noys);
noys = noys+15;
i++;
}
}else{
graphics.drawString(pers, 105, 250);
}
graphics.drawString("订单编号:", 600, 152);
graphics.drawString(order.getOrdercd(), 665, 152);
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(orderType, 235, 155);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user.getUsercd()+"/"+user.getRealname(), orderType, order);
BufferedImage bi_pricesrc = ImageFaxUtil.createImagePrice(orderroomtypebeanList, orderotherfeesList, orderType, order,"8","cus");
//File logofile = new File(Framework.servletRealPath+"faxFile\\"+ baseBottomFile);
//Image logo_src = javax.imageio.ImageIO.read(logofile); // 读取最下面的文件
//BufferedImage bottom =ImageFaxUtil.createImageBottom();
int bg_width = imageHead.getWidth(null);
int bg_height = imageHead.getHeight(null);
//int logo_width = bottom.getWidth(null);
//int logo_height = bottom.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
BufferedImage imgage = new BufferedImage(imageWidth, bg_height + bi_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(imageHead, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
// 组合下面
//g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
//g2d.drawImage(bottom, 0, bg_height + bi_height, logo_width, logo_height, null);
//g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
// imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
return resultSrc;
}
//供应商 订单传真 价格
public static BufferedImage createImagePriceByCustomer(List orderroomtypebeanList, List orderotherfeesList, String orderType, Order order) {
int imageHeight = 15 + orderroomtypebeanList.size() * linHieght + orderotherfeesList.size() * linHieght + linHieght + 10;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("类型", 15, 15);
graphicsPrice.drawString("房型", 65, 15);
graphicsPrice.drawString("入住/退房日期", 180, 15);
graphicsPrice.drawString("含早情况", 330, 15);
graphicsPrice.drawString("最晚到店", 450, 15);
if (order.getPricingtype() == 11) {// 现付
graphicsPrice.drawString("现付价", 555, 15);
} else {
graphicsPrice.drawString("结算价", 555, 15);
}
graphicsPrice.drawString("小计", 745, 15);
Font fontContent = new Font("楷体", Font.PLAIN, 14);// 头部字
graphicsPrice.setFont(fontContent);
int noY = 15;// 当前开始写的y坐标
double countPirce = 0;
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean,orderroomtypebeantemp;
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
if(0!=orderroomtypebean.getOrderroomtypebeanidedit()){
continue;
}
String beantitle="";
Integer optiontype=orderroomtypebean.getOpttype().intValue();
if(0==optiontype){
if(orderroomtypebean.getHotelconfirmstatus().intValue()==1){
beantitle="已确认";
}else{
if(0!=orderroomtypebean.getOrderroomtypebeanidorg().intValue()){
for (int f = 0; f < orderroomtypebeanList.size();f++) {
orderroomtypebeantemp = (Orderroomtypebean) orderroomtypebeanList.get(f);
if(orderroomtypebeantemp.getOrderroomtypebeanid().intValue()==orderroomtypebean.getOrderroomtypebeanidorg().intValue()){
int optiontype2=orderroomtypebeantemp.getOpttype().intValue();
if(optiontype2==10){
beantitle="改价格";
}else if(optiontype2==11){
beantitle="减少间夜";
}else if(optiontype2==12){
beantitle="改房型";
}else if(optiontype2==13){
beantitle="撤消";
}
break;
}
}
}else{
beantitle="新订";
}
}
}else if(optiontype==10){
beantitle="价格修改";
}else if(optiontype==11){
beantitle="减少间夜数";
}else if(optiontype==12){
beantitle="修改房型";
}else if(optiontype==13){
beantitle="撤消房型";
}
noY = noY + linHieght;
graphicsPrice.drawString(beantitle, 15, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getRoomtypenameratetype()), 65, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckindate(), "M月d日")+"~"+CommonUtil.getDateString(orderroomtypebean.getCheckoutdate(), "M月d日")+" "+orderroomtypebean.getRoomqty()+"间 "+orderroomtypebean.getDays()+"晚", 150, noY);
Map map=new HashMap();
OrderroomtypepriceDao orderroomtypepriceDao=(OrderroomtypepriceDao) Framework.getDaoFactory().getBean("orderroomtypepriceDao");
int breakfast=10;
if(orderroomtypebean.getServicerate().intValue()==1){//该BEAN的所有PRICE 都为是一样的。
breakfast=orderroomtypebean.getIncludebreakfastqty2();
}else{
map.put("orderroomtypebeanid", orderroomtypebean.getOrderroomtypebeanid());
map.put("sortString", "includebreakfastqty2,night");
List pricelist=orderroomtypepriceDao.queryOrderroomtypeprices(map);
Orderroomtypeprice price=null;
for(int n=0;n<pricelist.size();n++){
price=(Orderroomtypeprice)pricelist.get(n);
}
}
graphicsPrice.drawString(OptionManager.getNameByCode(OptionType.inbreakfast, "" + orderroomtypebean.getIncludebreakfastqty2()), 330, noY);
graphicsPrice.drawString(orderroomtypebean.getLatestarrivaltime(), 450, noY);
/*
* if(order.getPricingtype()==11){//现付
* if(orderroomtypebean.getIsequalsaleprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotesaleprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }else{
* if(orderroomtypebean.getIsequalbaseprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotebaseprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }
*/
if (order.getPricingtype().intValue() == 11) {// 现付
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvasaleprice().intValue(), 555, noY);//现付价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 745, noY);//现付合计
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
} else {
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvapreeprice().intValue(), 555, noY);//底价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvapreeprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 745, noY);
countPirce = countPirce + (int) orderroomtypebean.getAvapreeprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}
}
double sumprice = 0;
graphicsPrice.setFont(fontContent);
if (null != orderotherfeesList) {
Orderotherfees orderotherfees;
for (int i = 0; i < orderotherfeesList.size(); i++) {
orderotherfees = (Orderotherfees) orderotherfeesList.get(i);
sumprice = sumprice + orderotherfees.getTotalamount();
String otherfeeString="";
String begindates="";
String enddates="";
String dates="";
begindates=CommonUtil.getDateString(orderotherfees.getBegindate(), "M月d日");
if(null==orderotherfees.getEnddate()){
dates=begindates;
}else{
enddates=CommonUtil.getDateString(orderotherfees.getEnddate(), "M月d日");
dates=begindates+"~"+enddates;
}
otherfeeString=otherfeeString+dates;
if (orderotherfees.getFeetype().intValue() == 2) {//早餐
otherfeeString=otherfeeString+" 加"+OptionManager.getNameByCode(OptionType.breaktype, "" + orderotherfees.getBreakfasttype())+" ";
} else {//加床
otherfeeString=otherfeeString+" 加床 ";
}
//otherfeeString=otherfeeString+order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ";
if(null!=orderType && orderType.length()>2){
orderType=orderType.substring(0,orderType.length()-1);
}
noY = noY + linHieght;
graphicsPrice.drawString(orderType, 15, noY);
graphicsPrice.drawString(otherfeeString, 150, noY);
graphicsPrice.drawString("RMB "+orderotherfees.getUnitprice()+" * "+orderotherfees.getAmount()+" 份 ", 555, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderotherfees.getTotalamount()), 745, noY);
}
}
graphicsPrice.drawString("总计(RMB):", 655, noY + linHieght);
graphicsPrice.drawString(countPirce + sumprice + "", 745, noY + linHieght);
return image;
}
public static String createDailyauditFaxPicture(String bascDec, String barcode, User user, String resultSrc, List orderitemList, Map orderitemsizeMap,
Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
if (null == user || null == bascDec || null == barcode || null == resultSrc || null == orderitemList || null == orderitemsizeMap || null == orderitemidDateStatusMap
|| null == dailyauditstatus)
return null;
try {
BufferedImage bg_src = ImageFaxUtil.createBaseHeadDayBufImageNew(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user, "日审单", dailyauditstatus);
BufferedImage bi_pricesrc = ImageFaxUtil.createImageDayPriceNew(orderitemList, orderitemsizeMap, orderitemidDateStatusMap, dailyauditstatus);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadDayBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), userName, "日审单", dailyauditstatus);
//BufferedImage bi_pricesrc = ImageFaxUtil.createImageDayPrice(orderitemList, orderitemsizeMap, orderitemidDateStatusMap, dailyauditstatus);
BufferedImage bottomImage = ImageFaxUtil.createDailyauditImageBottom();
int bg_width = bg_src.getWidth(null);
int bg_height = bg_src.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
int bottom_height = bottomImage.getHeight(null);
BufferedImage imgage = new BufferedImage(bg_width, bg_height + bi_height+bottom_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(bg_src, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bottomImage, 0, bi_height+bg_height, bi_width,bottom_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
//imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
return resultSrc;
}
// 供应商 订单底图
public static BufferedImage createDailyauditImageBottom() {
BufferedImage image = new BufferedImage(imageWidth,220, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 220);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawString("TO:各大酒店销售部", 15, 10);
graphics.drawString("FR:深圳捷旅假期", 15, 30);
graphics.drawString("×××以上是我社入住贵酒店房态查询表,请填写入住房间号码,若已退房客房请备注退房时间。未到店请写未到,登记入住客人并非", 30, 50);
graphics.drawString("预定名字,请注明登记客人名字;续住一些特殊情况,请在房态表上注明,如果客人是入住当天退房,请备注有无返佣并请尽快回传,", 30, 70);
graphics.drawString("谢谢。", 30, 90);
graphics.drawLine(30, 125, 150, 125);//画线
graphics.drawString("请签名确认", 160, 125);
graphics.drawString("请回传 33389800 或 33396877", 30, 145);
graphics.drawString("电话:0755-33394811 ", 30, 165);
graphics.drawString("*******非常感谢*******", 30, 185);
graphics.drawString("晚上请打3339777 按 1 麻烦请尽快回传,谢谢", 30, 205);
return image;
}
public static BufferedImage createBaseHeadDayBufImageNew(String bascDec, String barCodeDic,User user, String title, Dailyauditstatus dailyauditstatus) throws IOException {
BufferedImage imageHead = new BufferedImage(imageWidth, 210, BufferedImage.TYPE_INT_RGB);
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername()), 75, 185);//供应商名字
graphics.drawString("订单信息栏:", 45, 205);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("请确认 "+CommonUtil.getDateString(dailyauditstatus.getNight(),"M月d日")+" 的入住情况", 145, 205);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(title, 235, 155);
return imageHead;
}
public static BufferedImage createBaseHeadDayBufImage(String bascDec, String barCodeDic, String userName, String title, Dailyauditstatus dailyauditstatus) throws IOException {
BufferedImage imageHead = new BufferedImage(imageWidth, 145, BufferedImage.TYPE_INT_RGB);
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 0, 0, null);
graphics.drawImage(barCodeImage, 320, 0, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawString("携旅电话:", 615, 10);// photo
graphics.drawString(jltourPhoto, 680, 10);// photo
graphics.drawString("携旅传真:", 615, 30);// photo
graphics.drawString(jltourFax, 680, 30);// fax
graphics.drawString("发送人:", 628, 50);// photo
graphics.drawString(CommonUtil.getDefault(userName), 680, 50);// 发送人
graphics.drawString("发送时间:", 615, 100);// 携旅订单号
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 680, 100);// 携旅订单号
graphics.setFont(new Font("宋体", Font.BOLD, 15));
graphics.drawString("致:", 15, 110);// 酒店的名字
graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername())+" ", 40, 110);// 酒店的名字
graphics.setFont(new Font("宋体", Font.BOLD, 13));
graphics.drawString("订单信息栏 请确认"+CommonUtil.getDateString(dailyauditstatus.getNight(), "M月d日")+"的入住情况", 15, 130);// 备注信息
graphics.drawLine(15, 138, 800, 138);//画线
Font fontTitle = new Font("宋体", Font.BOLD, 24);
graphics.setFont(fontTitle);
graphics.drawString("日审单", 345, 90);
return imageHead;
// InputStream imagein = new FileInputStream(Framework.servletRealPath+"faxFile\\"+ baseHeadDayFile);
// InputStream imagein2 = new FileInputStream(bascDec +barCodeDic);
// BufferedImage image = ImageIO.read(imagein);
// BufferedImage image2 = ImageIO.read(imagein2);
// Graphics graphics = image.getGraphics();
// graphics.drawImage(image2, 320, 10, null);
// graphics.setColor(Color.BLACK);
// graphics.setFont(fontPage);// 设置当前图片全局字体
// graphics.drawString(jltourPhoto, 680, 20);// photo
// graphics.drawString(jltourFax, 680, 40);// fax
// graphics.drawString(CommonUtil.getDefault(userName), 680, 60);// 发送人
// // graphics.drawString(CommonUtil.getDefault(order.getOrdercd()), 680,
// // 80);//携旅订单号
// graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 680, 130);// 发送时间
// graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername()), 50, 130);// 酒店的名字
// // graphics.drawString(CommonUtil.getDefault(dailyauditstatus.get), 78,
// // 211);//结算方式
// Font fontTitle = new Font("宋体", Font.BOLD, 24);
// graphics.setFont(fontTitle);
// graphics.drawString(title, 360, 100);
// imagein.close();
// imagein2.close();
// return image;
}
public static BufferedImage createImageDayPrice(List orderitemList, Map orderitemsizeMap, Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
int imageHeight = 25+25+orderitemList.size()*25;
//int imageHeight = 800;
OrderDao orderDao=(OrderDao)Framework.getDaoFactory().getBean("orderDao");
Order order=null;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("订单编号", 20, 20);
graphicsPrice.drawString("房型", 130, 20);
graphicsPrice.drawString("入住/退房日期", 200, 20);
graphicsPrice.drawString("房号", 310, 20);
graphicsPrice.drawString("入住人", 350, 20);
graphicsPrice.setFont(new Font("楷体", Font.PLAIN, 13));
int beginwite = 380;
if (null != dailyauditstatus) {
Date startdate = (Date) DateUtil.getDate(dailyauditstatus.getNight(), -2);
Date currentDate = startdate;
int days = 6;
for (int g = 0; g < 3; g++) {
if(currentDate.getTime()==dailyauditstatus.getNight().getTime()){
graphicsPrice.setColor(Color.gray);
}else{
graphicsPrice.setColor(Color.BLACK);
}
beginwite = beginwite + 38;
graphicsPrice.drawString(CommonUtil.getDateString(currentDate, "M.d"), beginwite, 10);
graphicsPrice.drawString("周" + CommonUtil.getChineseDayOfWeek(currentDate), beginwite, 25);
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
for (int g = 3; g < days; g++) {
if(currentDate.getTime()==dailyauditstatus.getNight().getTime()){
graphicsPrice.setColor(Color.gray);
}else{
graphicsPrice.setColor(Color.BLACK);
}
beginwite = beginwite + 38;
graphicsPrice.drawString(CommonUtil.getDateString(currentDate, "M.d"), beginwite, 10);
graphicsPrice.drawString("周" + CommonUtil.getChineseDayOfWeek(currentDate), beginwite, 25);
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
}
graphicsPrice.setFont(fontHead);
graphicsPrice.drawString("已离店",640, 20);
graphicsPrice.drawString("备注/确认号", 700, 20);
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 内容字
graphicsPrice.setFont(fontContent);
int noY = 25;// 当前开始写的y坐标
Date startdate = (Date) DateUtil.getDate(dailyauditstatus.getNight(), -2);
Date currentDate = startdate;
int days = 6;
Orderitem orderitem=null,orderitemLast=null,orderitemNext=null;
beginwite = 380;
int beginId = 0;
int start=0;
int end=1;
boolean flat = false;
for (int i = 0; i < orderitemList.size(); i++) {
noY = noY + linHieght;
orderitem = (Orderitem) orderitemList.get(i);
Integer orderitemsize = 0;
orderitemsize = (Integer) orderitemsizeMap.get(orderitem.getOrderid());
if(i>0){
orderitemLast=(Orderitem)orderitemList.get(i-1);
}
if(i<orderitemList.size()-1){
orderitemNext=(Orderitem)orderitemList.get(i+1);
}
if(null==orderitemLast ){
start=1;
//System.out.println("pricebeanitemLast==NULL start:"+start);
}else if((int)orderitemLast.getOrderid()==(int)orderitem.getOrderid()){
start=8;
//System.out.println("pricebeanitemLast.getPricebeanid()==pricebeanitem.getPricebeanid() start:"+start);
}else if((int)orderitemLast.getOrderid()!=(int)orderitem.getOrderid()){
start=1;
//System.out.println("pricebeanitemLast.getPricebeanid():"+pricebeanitemLast.getPricebeanid()+",,"+pricebeanitem.getPricebeanid());
//System.out.println("pricebeanitemLast.getPricebeanid()!=pricebeanitem.getPricebeanid() start:"+start);
}
String roomtypenameratetype=orderitem.getRoomtypenameratetype()+" "+orderitem.getRoomqty()+"间";
if(null!=orderitemLast && orderitem.getRoomtypenameratetype().equals(orderitemLast.getRoomtypenameratetype())&& start!=1){
roomtypenameratetype="";
}
if (beginId != orderitem.getOrderid()) {
flat = true;
} else {
flat = false;
}
beginId = orderitem.getOrderid();
String pricingtype="";
if(orderitem.getPricingtype().intValue()==11){
pricingtype="现付";
}else{
pricingtype="挂帐";
}
if (null != orderitemsize) {
if (flat) {
graphicsPrice.setColor(Color.gray);
graphicsPrice.drawLine(15,noY-20 , 800, noY-20);//画线
graphicsPrice.setColor(Color.BLACK);
if (orderitemsize == 1) {
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getOrdercd()), 20, noY);
graphicsPrice.drawString(pricingtype, 40, noY+13);
} else {
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getOrdercd()), 20, noY + ((orderitemsize * 10) / 2));
graphicsPrice.drawString(pricingtype, 40, noY + ((orderitemsize * 10) / 2)+20);
}
}
}
graphicsPrice.drawString(roomtypenameratetype, 115, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderitem.getCheckinday(), "M.d")+"-"+CommonUtil.getDateString(orderitem.getCheckoutday(), "M.d")+" "+orderitem.getDays()+"晚", 200, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getRoomno()), 310, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getCheckinperson()), 350, noY);
currentDate = startdate;
Date checkoutday = DateUtil.getDate(orderitem.getCheckoutday(), -1);
for (int h = 0; h < days; h++) {
beginwite = beginwite + 38;
if (DateUtil.between(currentDate, orderitem.getCheckinday(), checkoutday)) {
Integer checkinstatus = (Integer) orderitemidDateStatusMap.get(CommonUtil.getDateString(currentDate, "yyyy-MM-dd") + orderitem.getOrderitemid());
if (null == checkinstatus || checkinstatus == 0) {
if(DateUtil.compare(currentDate,dailyauditstatus.getNight())==0){
graphicsPrice.drawString(CommonUtil.getDefault("□"), beginwite + 3, noY);
}else{
graphicsPrice.drawString(CommonUtil.getDefault("-"), beginwite + 3, noY);
}
} else if (checkinstatus == 1) {
graphicsPrice.drawString(CommonUtil.getDefault("√"), beginwite + 3, noY);
} else if (checkinstatus == {
graphicsPrice.drawString(CommonUtil.getDefault("×"), beginwite + 3, noY);
}
}
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
graphicsPrice.drawString("□",beginwite + 40, noY);
beginwite = 380;
if (flat) {
order=orderDao.retrieveOrder(orderitem.getOrderid());
graphicsPrice.drawString(CommonUtil.getDefault(order.getConfirmno()), 700, noY);
}
}
graphicsPrice.drawLine(15, 35+( orderitemList.size() * 25), 800, 35+( orderitemList.size() * 25));//画线
return image;
}
public static BufferedImage createImageDayPriceNew(List orderitemList, Map orderitemsizeMap, Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
int imageHeight = 25+25+orderitemList.size()*25;
OrderDao orderDao=(OrderDao)Framework.getDaoFactory().getBean("orderDao");
Order order=null;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("酒店名称", 45, 15);
graphicsPrice.drawString("客人姓名", 150, 15);
graphicsPrice.drawString("入住/退房", 242, 15);
graphicsPrice.drawString("退房日期", 310, 15);
graphicsPrice.drawString("核对日期", 380, 15);
graphicsPrice.drawString("间数", 460, 15);
graphicsPrice.drawString("是否续住", 520, 15);
graphicsPrice.drawString("房号", 480, 15);
graphicsPrice.drawString("确认号", 710, 15);
graphicsPrice.drawLine(50, 15+5, 200, 15+5);//最后横线 换行150
graphicsPrice.setFont(new Font("楷体", Font.PLAIN, 13));
graphicsPrice.setFont(fontHead);
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 内容字
graphicsPrice.setFont(fontContent);
int noY = 25;// 当前开始写的y坐标
graphicsPrice.drawLine(310, 15+5, 370, 15+5);//最后横线 换行150
//50 4个字
//画坚线
//分行120
graphicsPrice.drawLine(42, 0, 42, noY);//第一条竖线
//画横线
graphicsPrice.drawLine(42, 0, 760, 0);//第一条横线
graphicsPrice.drawLine(42, noY, 760, noY);//最后一条横线
return image;
}
public static List getTiffStreamByFileName(String fileName){
List result = new ArrayList();
if(null != fileName && fileName.length()>0){
String tiffName = fileName.substring(0,fileName.indexOf("."))+".tif";
try{
/*
OutputStream os = new FileOutputStream(tiffName);
TIFFEncodeParam param =new TIFFEncodeParam();
ImageEncoder enc = ImageCodec.createImageEncoder("TIFF", os,param);
enc.encode(src);
os.close();
*/
String fileNames= fileName.substring(fileName.lastIndexOf(File.separator)+1,fileName.length());
String tiffNames = tiffName.substring(tiffName
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.awt.image.DataBufferByte;
import java.awt.image.RenderedImage;
import java.awt.image.WritableRaster;
import java.awt.image.renderable.ParameterBlock;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.media.jai.Histogram;
import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;
import javax.media.jai.RenderedOp;
import org.apache.struts2.ServletActionContext;
import org.krysalis.barcode4j.impl.code39.Code39Bean;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;
import org.krysalis.barcode4j.tools.UnitConv;
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
import com.jltour.authority.auto.beans.User;
import com.jltour.common.constant.OptionType;
import com.jltour.common.exception.Java91Exception;
import com.jltour.common.framework.Framework;
import com.jltour.common.framework.Java91Config;
import com.jltour.common.manager.FtpManager;
import com.jltour.common.manager.OptionManager;
import com.jltour.common.manager.fax.HttpRequester;
import com.jltour.common.manager.fax.HttpRespons;
import com.jltour.common.manager.interfaces.FaxManager;
import com.jltour.reserve.aManual.dao.ReserveDao;
import com.jltour.reserve.auto.beans.Dailyauditstatus;
import com.jltour.reserve.auto.beans.Order;
import com.jltour.reserve.auto.beans.Orderitem;
import com.jltour.reserve.auto.beans.Orderitemdate;
import com.jltour.reserve.auto.beans.Orderotherfees;
import com.jltour.reserve.auto.beans.Orderroomtypebean;
import com.jltour.reserve.auto.beans.Orderroomtypeprice;
import com.jltour.reserve.auto.dao.OrderDao;
import com.jltour.reserve.auto.dao.OrderroomtypepriceDao;
import com.sun.image.codec.jpeg.ImageFormatException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import com.sun.media.jai.codec.BMPEncodeParam;
import com.sun.media.jai.codec.FileSeekableStream;
import com.sun.media.jai.codec.ImageCodec;
import com.sun.media.jai.codec.ImageDecoder;
import com.sun.media.jai.codec.ImageEncoder;
import com.sun.media.jai.codec.JPEGEncodeParam;
import com.sun.media.jai.codec.SeekableStream;
import com.sun.media.jai.codec.TIFFDecodeParam;
import com.sun.media.jai.codec.TIFFEncodeParam;
import com.sun.media.jai.codecimpl.BMPCodec;
import com.sun.media.jai.codecimpl.BMPImageEncoder;
/**
* 传真图片工具类
*
* @author huangjin
*
*/
public class ImageFaxUtil {
// private static String bascDec ="D:\\reportXmlFile\\ok\\" ;
private static String baseHeadFile = "baseHead.bmp";//baseHeadMember.bmp
private static String baseHeadMemberFile = "baseHeadMember.bmp";
private static String baseHeadDayFile = "baseHeadDay.bmp";
private static String baseBottomFile = "baseBottom.bmp";
private static final int imageWidth = 800;// 传真文件宽度
private static final Font fontPage = new Font("宋体", Font.BOLD, 14);// 当前页面的字体设置
//private static final Font fontPage = new Font("黑体", Font.PLAIN, 12);// 当前页面的字体设置
private static String jltourPhoto = "86-755-33397777";
private static final String jltourFax = "86-755-33389800";
private static final int linHieght = 25;
//创建订单传真图片-供应商
public static String createOrderFaxPictureBySupplier(String bascDec, String barcode, String resultSrc, User user, Order order, List orderroomtypebeanList, List orderotherfeesList,
String orderType,String isprotocol) {
if (null == user || null == order || null == orderroomtypebeanList || orderroomtypebeanList.size()<=0 || null == orderType || orderType.length()<=0)
return null;
//System.out.println("33333333333333333333333333333333333333333333333333333333333333333333333333");
try {
if(null == isprotocol || isprotocol.length()<=0){
isprotocol="8";
}
String pers = order.getCheckinpersons();
//String pers = "保钓委执委曾健成说,他们首选是从香港出发前往钓鱼岛宣示主权,但由于担心受到阻挠,因此,他们同时也拟定从台湾出发的方案。但最后从哪里出发,无明确说明。";
int perno = pers.length()/45+1;
BufferedImage imageHead = new BufferedImage(imageWidth, 250+(perno-1)*15+10, BufferedImage.TYPE_INT_RGB);
String barCodeDic= ImageFaxUtil.createBarcodeImage(bascDec, barcode);//条形码图片
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 250+(perno-1)*15+10);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
graphics.drawString(CommonUtil.getDefault(order.getHotelname())+" 订房部", 75, 185);// 酒店的名字
//graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(45, 190, 295, 190);//画线
graphics.drawString(order.getHotelname(), 110, 205);
graphics.drawLine(45, 210, 280, 210);//画线
String pricingtype="";
if(order.getPricingtype().intValue() == 11 ){
pricingtype="客人前台现付";
}else{
if(order.getOrherhang().intValue()==1){
pricingtype="房费挂帐,杂费可挂帐";
}else{
pricingtype="房费挂帐,杂费客人自理";
}
}
graphics.drawString(pricingtype, 110, 230);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("酒店名称:", 45, 205);// 酒店的名字
graphics.drawString("结算方式:", 45, 230);
graphics.drawString("客人姓名:", 45, 250);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
graphics.drawLine(45, 235, 295, 235);//画线
int noys=250;
int test=0;
int i=0;
if(perno>1){
while(i<perno){
test = (((i)*45+45)>=pers.length())?pers.length():((i)*45+45-1);
graphics.drawString(pers.substring((i)*45,test), 105, noys);
noys = noys+15;
i++;
}
}else{
graphics.drawString(pers, 105, 250);
}
graphics.drawString("订单编号:", 600, 152);
graphics.drawString(order.getOrdercd(), 665, 152);
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(orderType, 235, 155);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user.getUsercd()+"/"+user.getRealname(), orderType, order);
BufferedImage bi_pricesrc = ImageFaxUtil.createImagePrice(orderroomtypebeanList, orderotherfeesList, orderType, order,isprotocol,"sup");
//File logofile = new File(Framework.servletRealPath+"faxFile\\"+ baseBottomFile);
//Image logo_src = javax.imageio.ImageIO.read(logofile); // 读取最下面的文件
BufferedImage bottom =ImageFaxUtil.createImageBottom();
int bg_width = imageHead.getWidth(null);
int bg_height = imageHead.getHeight(null);
int logo_width = bottom.getWidth(null);
int logo_height = bottom.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
BufferedImage imgage = new BufferedImage(imageWidth, bg_height + logo_height + bi_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(imageHead, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
// 组合下面
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bottom, 0, bg_height + bi_height, logo_width, logo_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
// imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
return resultSrc;
}
//生成条形码文件 返回对应的生成的条形码文件的图片全称
public static String createBarcodeImage(String bascDec, String content) throws IOException {
String result = "";
Code39Bean bean = new Code39Bean();
final int dpi = 150;
bean.setModuleWidth(UnitConv.in2mm(1.0f / dpi)); // makes the narrow
// bar
bean.setHeight(10);
bean.setWideFactor(3);
bean.doQuietZone(false);
File outputFile = new File(bascDec + content + "barcode.jpg");
OutputStream out = new FileOutputStream(outputFile);
try {
BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/jpeg", dpi, BufferedImage.TYPE_BYTE_BINARY, false, 0);
bean.generateBarcode(canvas, content);
canvas.finish();
result = content + "barcode.jpg";
} finally {
out.close();
}
return result;
}
//供应商 订单底图
public static BufferedImage createImageBottom() {
BufferedImage image = new BufferedImage(imageWidth, 180, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(55, 10, 760, 10);//画线
graphics.drawString("酒店确认栏", 55, 30);// photo
graphics.drawString("□ 本单确认", 85, 50);// photo
graphics.drawString("□ 本单不确认及原因", 205, 50);//
graphics.drawLine(345, 60, 760, 60);//画线
graphics.drawString("确认号:", 85, 80);// photo
graphics.drawLine(125, 90, 760, 90);//画线
graphics.drawString("签名栏:", 85, 120);// photo
graphics.drawLine(125, 130, 760, 130);//画线
graphics.drawString("酒店备注:", 85, 160);// photo
graphics.drawLine(125, 169, 760, 169);//画线
return image;
}
public static BufferedImage createImageBottomByCustomer() {
BufferedImage image = new BufferedImage(imageWidth, 160, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(15, 0, 800, 0);//画线
return image;
}
//供应商 订单传真 价格
public static BufferedImage createImagePrice(List orderroomtypebeanList, List orderotherfeesList, String orderType, Order order,String isprotocol,String cus_suptype) {
int noCount=0;
double countPirce=0;
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean;
int priceRoomLength=0;
String showpricenotes="";
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
if("1".equals(isprotocol)){
orderroomtypebean.setPricenotebaseprice("协议价");
showpricenotes="协议价";
orderroomtypebean.setCreateby("协议价");
}else{
if(orderroomtypebean.getPricingtype()==11){
if("sup".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalsaleprice() || orderroomtypebean.getIsequalsaleprice()!=1){
showpricenotes=orderroomtypebean.getPricenotesaleprice();
}else{
showpricenotes=""+orderroomtypebean.getAvasaleprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvasaleprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}else if("cus".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalsaleprice() || orderroomtypebean.getIsequalsaleprice()!=1){
showpricenotes=orderroomtypebean.getPricenotesaleprice()+" 返"+((int)(orderroomtypebean.getAvasaleprice().doubleValue()-orderroomtypebean.getAvapreeprice().doubleValue()));
}else{
showpricenotes=""+orderroomtypebean.getAvasaleprice()+" 返"+((int)(orderroomtypebean.getAvasaleprice().doubleValue()-orderroomtypebean.getAvapreeprice().doubleValue()));
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvasaleprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}else{
if("sup".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalbaseprice() || orderroomtypebean.getIsequalbaseprice()!=1){
showpricenotes=orderroomtypebean.getPricenotebaseprice();
}else{
showpricenotes=""+orderroomtypebean.getAvabaseprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvabaseprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvabaseprice().intValue()*orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}else if("cus".equals(cus_suptype)){
if(null==orderroomtypebean.getIsequalpreeprice() || orderroomtypebean.getIsequalpreeprice()!=1){
showpricenotes=orderroomtypebean.getPricenotepreeprice();
}else{
showpricenotes=""+orderroomtypebean.getAvapreeprice();
}
orderroomtypebean.setPricenotebaseprice(showpricenotes);
orderroomtypebean.setCreateby(""+orderroomtypebean.getAvapreeprice().intValue()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty());
countPirce = countPirce + (int) orderroomtypebean.getAvapreeprice().intValue()*orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}
}
if(orderroomtypebean.getRoomtypenameratetype().length()>showpricenotes.length()){
priceRoomLength= orderroomtypebean.getRoomtypenameratetype().length();
}else{
priceRoomLength=showpricenotes.length();
}
noCount = noCount+ (priceRoomLength/11+1)*linHieght;
}
}
String hotelRemark = "";
if("sup".equals(cus_suptype)){
hotelRemark= order.getHotelremark();
}else{
hotelRemark=order.getMemberremark();
}
int remarkNos = hotelRemark.length()/42+1;
int imageHeight = 15 + orderroomtypebeanList.size() * linHieght + orderotherfeesList.size() * linHieght + linHieght + 10+55+(remarkNos-1)*20+noCount;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawLine(42, 0, 760, 0);//画线
graphicsPrice.drawString("类型", 45, 15);
graphicsPrice.drawString("内容", 150, 15);
graphicsPrice.drawString("入住日期", 242, 15);
graphicsPrice.drawString("退房日期", 310, 15);
graphicsPrice.drawString("晚数", 380, 15);
graphicsPrice.drawString("间数", 420, 15);
graphicsPrice.drawString("含早情况", 460, 15);
if (order.getPricingtype() == 11) {// 现付
graphicsPrice.drawString("现付价", 590, 15);
} else {
graphicsPrice.drawString("挂帐价", 590, 15);
}
graphicsPrice.drawString("小计", 715, 15);
graphicsPrice.drawLine(42, 20, 760, 20);//画线
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 头部字
graphicsPrice.setFont(fontContent);
int noY = 15;// 当前开始写的y坐标
int priceRoomLength=0;//最长的字体长度
int rowLength=1;//行数
String latestarrivaltime="";//到店时间
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean;
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
noY = noY + linHieght;
//orderroomtypebean.setRoomtypenameratetype("标单(含单早)K JFDKJF");//房型
//orderroomtypebean.setRoomtypenameratetype("李停,张莫大李世大刘新好不成因为莫成好李成莫金大中胡涛水");//房型
//orderroomtypebean.setPricenotebaseprice("9月4日490,9月5日500,9月6日510");//价格字段
/*int roomtypeX=90;
if(orderroomtypebean.getRoomtypenameratetype().length()>11){
//orderroomtypebean.setRoomtypenameratetype(orderroomtypebean.getRoomtypenameratetype().substring(0,11));
}
if(orderroomtypebean.getRoomtypenameratetype().length()<4){
roomtypeX=120;
}else if(orderroomtypebean.getRoomtypenameratetype().length()<8){
roomtypeX=100;
}else {
roomtypeX=90;
}
*/
orderType=orderType.replace("预订", "");
graphicsPrice.drawString(orderType.substring(0,orderType.length()-1), 46, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckindate(), "M月d日"),245, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckoutdate(), "M月d日"), 320, noY);
graphicsPrice.drawString(orderroomtypebean.getDays()+"晚", 386, noY);
graphicsPrice.drawString(orderroomtypebean.getRoomqty()+"间 ", 425, noY);
graphicsPrice.drawString(orderroomtypebean.getCreateby(), 710, noY);
/*
Map map=new HashMap();
OrderroomtypepriceDao orderroomtypepriceDao=(OrderroomtypepriceDao) Framework.getDaoFactory().getBean("orderroomtypepriceDao");
int breakfast=10;
if(orderroomtypebean.getServicerate().intValue()==1){//该BEAN的所有PRICE 都为是一样的。
breakfast=orderroomtypebean.getIncludebreakfastqty2();
}else{
map.put("orderroomtypebeanid", orderroomtypebean.getOrderroomtypebeanid());
map.put("sortString", "includebreakfastqty2,night");
List pricelist=orderroomtypepriceDao.queryOrderroomtypeprices(map);
Orderroomtypeprice price=null;
for(int n=0;n<pricelist.size();n++){
price=(Orderroomtypeprice)pricelist.get(n);
}
}
*/
graphicsPrice.drawString(OptionManager.getNameByCode(OptionType.inbreakfast, "" + orderroomtypebean.getIncludebreakfastqty2()), 476, noY);
//graphicsPrice.drawString(orderroomtypebean, 476, noY);
//latestarrivaltime = orderroomtypebean.getLatestarrivaltime();
//graphicsPrice.drawString(orderroomtypebean.getLatestarrivaltime(), 450, noY);
/*
* if(order.getPricingtype()==11){//现付
* if(orderroomtypebean.getIsequalsaleprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotesaleprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }else{
* if(orderroomtypebean.getIsequalbaseprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotebaseprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }
*/
/*
if("1".equals(isprotocol)){
graphicsPrice.drawString("协议价", 535, noY);//现付价
graphicsPrice.drawString("协议价", 680, noY);//现付价
}else{
if (order.getPricingtype().intValue() == 11) {// 现付
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvasaleprice().intValue(), 530, noY);//现付价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 700, noY);//现付合计
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
} else {
graphicsPrice.drawString(order.getCurrency()+" "+(int) orderroomtypebean.getAvabaseprice().intValue(), 530, noY);//底价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvabaseprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()),700, noY);
countPirce = countPirce + (int) orderroomtypebean.getAvabaseprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}*/
if(orderroomtypebean.getRoomtypenameratetype().length()>orderroomtypebean.getPricenotebaseprice().length()){
priceRoomLength= orderroomtypebean.getRoomtypenameratetype().length();
}else{
priceRoomLength=orderroomtypebean.getPricenotebaseprice().length();
}
int rows =0;
String [] showroomtypes=StringsUtil.splitByindex(orderroomtypebean.getRoomtypenameratetype(),10);
String [] showprices=StringsUtil.splitByindex(orderroomtypebean.getPricenotebaseprice(),23);
if(showroomtypes.length>showprices.length){
rows=showroomtypes.length;
}else{
rows=showprices.length;
}
for(int jj=0;jj<rows;jj++){
if(jj<=showroomtypes.length-1){
if(showroomtypes.length==1 && showroomtypes[jj].length()<3){
graphicsPrice.drawString(showroomtypes[jj], 130, noY);
}else if(showroomtypes.length==1 && showroomtypes[jj].length()<6){
graphicsPrice.drawString(showroomtypes[jj], 110, noY);
}else{
graphicsPrice.drawString(showroomtypes[jj], 90, noY);
}
}
if(jj<=showprices.length-1){
if(showprices.length==1 && showprices[jj].length()<7){
graphicsPrice.drawString(showprices[jj], 580, noY);
}else if(showprices.length==1 && showprices[jj].length()<14){
graphicsPrice.drawString(showprices[jj], 550, noY);
}else{
graphicsPrice.drawString(showprices[jj], 530, noY);
}
}
if(jj==rows-1){
}else{
noY=noY+linHieght;
}
}
graphicsPrice.drawLine(42, noY+5, 760, noY+5);//画线
}
}
//画竖线
graphicsPrice.drawLine(240, 0, 240, noY+5);//入住
graphicsPrice.drawLine(305, 0, 305, noY+5);//退房日期
graphicsPrice.drawLine(375, 0, 375, noY+5);//晚数
graphicsPrice.drawLine(415, 0, 415, noY+5);//间数
graphicsPrice.drawLine(455, 0, 455, noY+5);//晚数
double sumprice = 0;
graphicsPrice.setFont(fontContent);
if (null != orderotherfeesList) {
Orderotherfees orderotherfees;
for (int i = 0; i < orderotherfeesList.size(); i++) {
orderotherfees = (Orderotherfees) orderotherfeesList.get(i);
sumprice = sumprice + orderotherfees.getTotalamount();
String otherfeeString="";
String begindates="";
String enddates="";
String dates="";
begindates=CommonUtil.getDateString(orderotherfees.getBegindate(), "M月d日");
if(null==orderotherfees.getEnddate()){
dates=begindates;
}else{
enddates=CommonUtil.getDateString(orderotherfees.getEnddate(), "M月d日");
dates=begindates+"~"+enddates;
}
otherfeeString=otherfeeString+dates;
if (orderotherfees.getFeetype().intValue() == 2) {//早餐
otherfeeString=otherfeeString+" 加"+OptionManager.getNameByCode(OptionType.breaktype, "" + orderotherfees.getBreakfasttype())+" ";
} else {//加床
otherfeeString=otherfeeString+" 加床 ";
}
//otherfeeString=otherfeeString+order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ";
if(null!=orderType && orderType.length()>2){
orderType=orderType.substring(0,orderType.length()-1);
}
noY = noY + linHieght;
graphicsPrice.drawString(orderType, 45, noY);
graphicsPrice.drawString(otherfeeString, 111, noY);
graphicsPrice.drawString(order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ", 535, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderotherfees.getCompanyid()), 700, noY);
graphicsPrice.drawLine(42, noY+5, 760, noY+5);//画线
}
}
if("1".equals(isprotocol)){
graphicsPrice.drawString("协议价", 710, noY + linHieght);
}else{
graphicsPrice.drawString(countPirce + sumprice + "", 700, noY + linHieght);
}
graphicsPrice.drawString("总计("+order.getCurrency()+"):", 580, noY + linHieght);
//下面信息
graphicsPrice.setFont(fontHead);
graphicsPrice.drawString("到店时间:", 40, noY+linHieght+linHieght);
graphicsPrice.drawString(latestarrivaltime, 110, noY+linHieght+linHieght);
if("sup".equals(cus_suptype)){
graphicsPrice.drawString("确认号:", 170, noY+linHieght+linHieght);
graphicsPrice.drawString(null==order.getConfirmno()?"":order.getConfirmno(), 225, noY+linHieght+linHieght);
}
graphicsPrice.drawString("备注信息:", 40, noY+linHieght+linHieght+20);
//graphicsPrice.drawString(order.getHotelremark(), 110, noY+linHieght+linHieght+20);//备注信息
if(remarkNos>1){
int rnoy = noY+linHieght+linHieght+20;
int i=0;
while(i<=remarkNos-1){
graphicsPrice.drawString(hotelRemark.substring(i*43,(i*43+43)>=hotelRemark.length()?hotelRemark.length():(i*43+43)), 110, rnoy);//备注信息
graphicsPrice.drawLine(110, rnoy+5, 760, rnoy+5);//横线
rnoy+=20;
i++;
}
}else{
graphicsPrice.drawString(hotelRemark, 110, noY+linHieght+linHieght+20);//备注信息
graphicsPrice.drawLine(110, noY+linHieght+linHieght+20+5, 760, noY+linHieght+linHieght+20+5);//横线
}
//画竖线
graphicsPrice.drawLine(85, 0, 85, noY+5);//房型
graphicsPrice.drawLine(42, 0, 42, noY+linHieght+5);//画开始线
graphicsPrice.drawLine(525, 0, 525, noY+5);//含早情况
graphicsPrice.drawLine(695, 0, 695, noY+linHieght+5);//结算价
graphicsPrice.drawLine(760, 0, 760, noY+linHieght+5);//画结束线
graphicsPrice.drawLine(42, noY+linHieght+5, 760, noY+linHieght+5);//最后横线
return image;
}
public static String createTiffImageByFileName(String filepath) throws Java91Exception{
String filepath_tif="";
if(null != filepath && filepath.length()>0){
String filepath_tiff = filepath.substring(0,filepath.lastIndexOf("."))+".tif";
try{
String filename_jpg= filepath.substring(filepath.lastIndexOf(File.separator)+1,filepath.length());
String filename_tif = filepath_tiff.substring(filepath_tiff.lastIndexOf(File.separator)+1,filepath_tiff.length());
//System.out.println("22222222222222222"+filepath);
//System.out.println("444444"+filepath_tiff);
//System.out.println("444444"+filename_jpg);
//System.out.println("444444"+filename_tif);
boolean isUp = FtpManager.put("FaxDec"+File.separator+filename_jpg, filepath);
if(isUp){//如果上传成功
//执行调用 jpg转tif文件
HttpRequester request = new HttpRequester();
request.setDefaultContentEncoding("utf-8");
//HttpRespons hr = request.sendGet("http://localhost:8080/Fax/FaxServlet?fileName="+fileNames);//上传成功后调用转tiff命令
//System.out.println(Java91Config.jpg2tifservlet+"?fileName="+filename_jpg);
HttpRespons hr = request.sendGet(Java91Config.jpg2tifservlet+"?fileName="+filename_jpg);//上传成功后调用转tiff命令
// System.out.println(hr.getContent());
if(null !=hr.getContent() && hr.getContent().length()>0){
//System.out.println("33333333333333"+File.separator+filename_tif);
filepath_tif = FtpManager.downFile("FaxDec"+File.separator+filename_tif);
}
}
}catch (Exception e){
e.printStackTrace();
throw new Java91Exception("创建TIF文件错误!请与管理员联系,确认图片服务器正常");
}
}
return filepath_tif;
}
//创建订单传真图片-供应商
public static String createOrderFaxPictureByCustomer(String bascDec, String barcode, String resultSrc, User user, Order order, List orderroomtypebeanList, List orderotherfeesList,
String orderType) {
if (null == user || null == order || null == orderroomtypebeanList || orderroomtypebeanList.size()<=0 || null == orderType || orderType.length()<=0)
return null;
String isprotocol="8";
try {
String pers = order.getCheckinpersons();
//String pers = "保钓委执委曾健成说,他们首选是从香港出发前往钓鱼岛宣示主权,但由于担心受到阻挠,因此,他们同时也拟定从台湾出发的方案。但最后从哪里出发,无明确说明。";
int perno = pers.length()/45+1;
BufferedImage imageHead = new BufferedImage(imageWidth, 250+(perno-1)*15+10, BufferedImage.TYPE_INT_RGB);
String barCodeDic= ImageFaxUtil.createBarcodeImage(bascDec, barcode);//条形码图片
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 250+(perno-1)*15+10);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
//graphics.drawString(CommonUtil.getDefault(order.getHotelname())+" 订房部", 75, 185);// 酒店的名字
graphics.drawString(CommonUtil.getDefault(order.getCustomername())+" "+order.getMembername(), 75, 185);// 酒店的名字
//graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(45, 190, 295, 190);//画线
graphics.drawString(order.getHotelname(), 110, 205);
graphics.drawLine(45, 210, 280, 210);//画线
String pricingtype="";
if(order.getPricingtype().intValue() == 11 ){
pricingtype="客人前台现付";
}else{
if(order.getOrherhang().intValue()==1){
pricingtype="房费挂帐,杂费可挂帐";
}else{
pricingtype="房费挂帐,杂费客人自理";
}
}
graphics.drawString(pricingtype, 110, 230);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("酒店名称:", 45, 205);// 酒店的名字
graphics.drawString("结算方式:", 45, 230);
graphics.drawString("客人姓名:", 45, 250);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
graphics.drawLine(45, 235, 295, 235);//画线
int noys=250;
int test=0;
int i=0;
if(perno>1){
while(i<perno){
test = (((i)*45+45)>=pers.length())?pers.length():((i)*45+45-1);
graphics.drawString(pers.substring((i)*45,test), 105, noys);
noys = noys+15;
i++;
}
}else{
graphics.drawString(pers, 105, 250);
}
graphics.drawString("订单编号:", 600, 152);
graphics.drawString(order.getOrdercd(), 665, 152);
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(orderType, 235, 155);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user.getUsercd()+"/"+user.getRealname(), orderType, order);
BufferedImage bi_pricesrc = ImageFaxUtil.createImagePrice(orderroomtypebeanList, orderotherfeesList, orderType, order,"8","cus");
//File logofile = new File(Framework.servletRealPath+"faxFile\\"+ baseBottomFile);
//Image logo_src = javax.imageio.ImageIO.read(logofile); // 读取最下面的文件
//BufferedImage bottom =ImageFaxUtil.createImageBottom();
int bg_width = imageHead.getWidth(null);
int bg_height = imageHead.getHeight(null);
//int logo_width = bottom.getWidth(null);
//int logo_height = bottom.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
BufferedImage imgage = new BufferedImage(imageWidth, bg_height + bi_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(imageHead, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
// 组合下面
//g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
//g2d.drawImage(bottom, 0, bg_height + bi_height, logo_width, logo_height, null);
//g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
// 结束
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
// imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
}
return resultSrc;
}
//供应商 订单传真 价格
public static BufferedImage createImagePriceByCustomer(List orderroomtypebeanList, List orderotherfeesList, String orderType, Order order) {
int imageHeight = 15 + orderroomtypebeanList.size() * linHieght + orderotherfeesList.size() * linHieght + linHieght + 10;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("类型", 15, 15);
graphicsPrice.drawString("房型", 65, 15);
graphicsPrice.drawString("入住/退房日期", 180, 15);
graphicsPrice.drawString("含早情况", 330, 15);
graphicsPrice.drawString("最晚到店", 450, 15);
if (order.getPricingtype() == 11) {// 现付
graphicsPrice.drawString("现付价", 555, 15);
} else {
graphicsPrice.drawString("结算价", 555, 15);
}
graphicsPrice.drawString("小计", 745, 15);
Font fontContent = new Font("楷体", Font.PLAIN, 14);// 头部字
graphicsPrice.setFont(fontContent);
int noY = 15;// 当前开始写的y坐标
double countPirce = 0;
if (null != orderroomtypebeanList) {
Orderroomtypebean orderroomtypebean,orderroomtypebeantemp;
for (int i = 0; i < orderroomtypebeanList.size(); i++) {
orderroomtypebean = (Orderroomtypebean) orderroomtypebeanList.get(i);
if(0!=orderroomtypebean.getOrderroomtypebeanidedit()){
continue;
}
String beantitle="";
Integer optiontype=orderroomtypebean.getOpttype().intValue();
if(0==optiontype){
if(orderroomtypebean.getHotelconfirmstatus().intValue()==1){
beantitle="已确认";
}else{
if(0!=orderroomtypebean.getOrderroomtypebeanidorg().intValue()){
for (int f = 0; f < orderroomtypebeanList.size();f++) {
orderroomtypebeantemp = (Orderroomtypebean) orderroomtypebeanList.get(f);
if(orderroomtypebeantemp.getOrderroomtypebeanid().intValue()==orderroomtypebean.getOrderroomtypebeanidorg().intValue()){
int optiontype2=orderroomtypebeantemp.getOpttype().intValue();
if(optiontype2==10){
beantitle="改价格";
}else if(optiontype2==11){
beantitle="减少间夜";
}else if(optiontype2==12){
beantitle="改房型";
}else if(optiontype2==13){
beantitle="撤消";
}
break;
}
}
}else{
beantitle="新订";
}
}
}else if(optiontype==10){
beantitle="价格修改";
}else if(optiontype==11){
beantitle="减少间夜数";
}else if(optiontype==12){
beantitle="修改房型";
}else if(optiontype==13){
beantitle="撤消房型";
}
noY = noY + linHieght;
graphicsPrice.drawString(beantitle, 15, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getRoomtypenameratetype()), 65, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderroomtypebean.getCheckindate(), "M月d日")+"~"+CommonUtil.getDateString(orderroomtypebean.getCheckoutdate(), "M月d日")+" "+orderroomtypebean.getRoomqty()+"间 "+orderroomtypebean.getDays()+"晚", 150, noY);
Map map=new HashMap();
OrderroomtypepriceDao orderroomtypepriceDao=(OrderroomtypepriceDao) Framework.getDaoFactory().getBean("orderroomtypepriceDao");
int breakfast=10;
if(orderroomtypebean.getServicerate().intValue()==1){//该BEAN的所有PRICE 都为是一样的。
breakfast=orderroomtypebean.getIncludebreakfastqty2();
}else{
map.put("orderroomtypebeanid", orderroomtypebean.getOrderroomtypebeanid());
map.put("sortString", "includebreakfastqty2,night");
List pricelist=orderroomtypepriceDao.queryOrderroomtypeprices(map);
Orderroomtypeprice price=null;
for(int n=0;n<pricelist.size();n++){
price=(Orderroomtypeprice)pricelist.get(n);
}
}
graphicsPrice.drawString(OptionManager.getNameByCode(OptionType.inbreakfast, "" + orderroomtypebean.getIncludebreakfastqty2()), 330, noY);
graphicsPrice.drawString(orderroomtypebean.getLatestarrivaltime(), 450, noY);
/*
* if(order.getPricingtype()==11){//现付
* if(orderroomtypebean.getIsequalsaleprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotesaleprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvasaleprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }else{
* if(orderroomtypebean.getIsequalbaseprice()==1){
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()),
* 675, noY); }else{
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getPricenotebaseprice()),
* 675, noY); }
* graphicsPrice.drawString(CommonUtil.getDefault(orderroomtypebean.getAvabaseprice()*orderroomtypebean.getDays()*orderroomtypebean.getRoomqty()),
* 745, noY); }
*/
if (order.getPricingtype().intValue() == 11) {// 现付
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvasaleprice().intValue(), 555, noY);//现付价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 745, noY);//现付合计
countPirce = countPirce + (int) orderroomtypebean.getAvasaleprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
} else {
graphicsPrice.drawString("RMB "+(int) orderroomtypebean.getAvapreeprice().intValue(), 555, noY);//底价
graphicsPrice.drawString(CommonUtil.getDefault((int) orderroomtypebean.getAvapreeprice().intValue() * orderroomtypebean.getDays()* orderroomtypebean.getRoomqty()), 745, noY);
countPirce = countPirce + (int) orderroomtypebean.getAvapreeprice().intValue() * orderroomtypebean.getDays() * orderroomtypebean.getRoomqty();
}
}
}
double sumprice = 0;
graphicsPrice.setFont(fontContent);
if (null != orderotherfeesList) {
Orderotherfees orderotherfees;
for (int i = 0; i < orderotherfeesList.size(); i++) {
orderotherfees = (Orderotherfees) orderotherfeesList.get(i);
sumprice = sumprice + orderotherfees.getTotalamount();
String otherfeeString="";
String begindates="";
String enddates="";
String dates="";
begindates=CommonUtil.getDateString(orderotherfees.getBegindate(), "M月d日");
if(null==orderotherfees.getEnddate()){
dates=begindates;
}else{
enddates=CommonUtil.getDateString(orderotherfees.getEnddate(), "M月d日");
dates=begindates+"~"+enddates;
}
otherfeeString=otherfeeString+dates;
if (orderotherfees.getFeetype().intValue() == 2) {//早餐
otherfeeString=otherfeeString+" 加"+OptionManager.getNameByCode(OptionType.breaktype, "" + orderotherfees.getBreakfasttype())+" ";
} else {//加床
otherfeeString=otherfeeString+" 加床 ";
}
//otherfeeString=otherfeeString+order.getCurrency()+" "+orderotherfees.getBaseprice()+" * "+orderotherfees.getAmount()+" 份 ";
if(null!=orderType && orderType.length()>2){
orderType=orderType.substring(0,orderType.length()-1);
}
noY = noY + linHieght;
graphicsPrice.drawString(orderType, 15, noY);
graphicsPrice.drawString(otherfeeString, 150, noY);
graphicsPrice.drawString("RMB "+orderotherfees.getUnitprice()+" * "+orderotherfees.getAmount()+" 份 ", 555, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderotherfees.getTotalamount()), 745, noY);
}
}
graphicsPrice.drawString("总计(RMB):", 655, noY + linHieght);
graphicsPrice.drawString(countPirce + sumprice + "", 745, noY + linHieght);
return image;
}
public static String createDailyauditFaxPicture(String bascDec, String barcode, User user, String resultSrc, List orderitemList, Map orderitemsizeMap,
Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
if (null == user || null == bascDec || null == barcode || null == resultSrc || null == orderitemList || null == orderitemsizeMap || null == orderitemidDateStatusMap
|| null == dailyauditstatus)
return null;
try {
BufferedImage bg_src = ImageFaxUtil.createBaseHeadDayBufImageNew(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), user, "日审单", dailyauditstatus);
BufferedImage bi_pricesrc = ImageFaxUtil.createImageDayPriceNew(orderitemList, orderitemsizeMap, orderitemidDateStatusMap, dailyauditstatus);
//BufferedImage bg_src = ImageFaxUtil.createBaseHeadDayBufImage(bascDec, ImageFaxUtil.createBarcodeImage(bascDec, barcode), userName, "日审单", dailyauditstatus);
//BufferedImage bi_pricesrc = ImageFaxUtil.createImageDayPrice(orderitemList, orderitemsizeMap, orderitemidDateStatusMap, dailyauditstatus);
BufferedImage bottomImage = ImageFaxUtil.createDailyauditImageBottom();
int bg_width = bg_src.getWidth(null);
int bg_height = bg_src.getHeight(null);
int bi_width = bi_pricesrc.getWidth(null);
int bi_height = bi_pricesrc.getHeight(null);
int bottom_height = bottomImage.getHeight(null);
BufferedImage imgage = new BufferedImage(bg_width, bg_height + bi_height+bottom_height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2d = imgage.createGraphics();
g2d.drawImage(bg_src, 0, 0, bg_width, bg_height, null);
// 组合价格
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bi_pricesrc, 0, bg_height, bi_width, bi_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置开始
g2d.drawImage(bottomImage, 0, bi_height+bg_height, bi_width,bottom_height, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置
//图片黑白
//ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
//ColorConvertOp op = new ColorConvertOp(cs, null);
//imgage = op.filter(imgage, null);
FileOutputStream out = new FileOutputStream(Framework.servletRealPath+Java91Config.getFaxImageTempPath()+File.separator + resultSrc);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(imgage);
out.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
return resultSrc;
}
// 供应商 订单底图
public static BufferedImage createDailyauditImageBottom() {
BufferedImage image = new BufferedImage(imageWidth,220, BufferedImage.TYPE_INT_RGB);
Graphics graphics = image.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 220);
graphics.setColor(Color.BLACK);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawString("TO:各大酒店销售部", 15, 10);
graphics.drawString("FR:深圳捷旅假期", 15, 30);
graphics.drawString("×××以上是我社入住贵酒店房态查询表,请填写入住房间号码,若已退房客房请备注退房时间。未到店请写未到,登记入住客人并非", 30, 50);
graphics.drawString("预定名字,请注明登记客人名字;续住一些特殊情况,请在房态表上注明,如果客人是入住当天退房,请备注有无返佣并请尽快回传,", 30, 70);
graphics.drawString("谢谢。", 30, 90);
graphics.drawLine(30, 125, 150, 125);//画线
graphics.drawString("请签名确认", 160, 125);
graphics.drawString("请回传 33389800 或 33396877", 30, 145);
graphics.drawString("电话:0755-33394811 ", 30, 165);
graphics.drawString("*******非常感谢*******", 30, 185);
graphics.drawString("晚上请打3339777 按 1 麻烦请尽快回传,谢谢", 30, 205);
return image;
}
public static BufferedImage createBaseHeadDayBufImageNew(String bascDec, String barCodeDic,User user, String title, Dailyauditstatus dailyauditstatus) throws IOException {
BufferedImage imageHead = new BufferedImage(imageWidth, 210, BufferedImage.TYPE_INT_RGB);
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 75, 30, null);
graphics.drawImage(barCodeImage, 560, 30, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawLine(20, 129, 800, 129);//画线
//黑体 隶书 华文楷体
graphics.setFont(new Font("宋体",Font.BOLD, 15));//普通字体
graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername()), 75, 185);//供应商名字
graphics.drawString("订单信息栏:", 45, 205);
graphics.setFont(new Font("宋体",Font.PLAIN, 13));//普通字体
graphics.drawString("深圳市捷旅国际旅行社有限公司 www.jl-tour.com", 100, 110);
graphics.drawString("发送人/工号:", 50, 126);
graphics.drawString(user.getRealname()+"/"+user.getUsercd(), 135, 126);
graphics.drawString("电话:", 200, 126);
graphics.drawString(jltourPhoto, 236, 126);
graphics.drawString("传真:", 370, 126);
graphics.drawString(jltourFax, 402, 126);
graphics.drawString("发送时间:", 530, 126);
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 590, 126);
graphics.drawString("致:", 45, 185);
graphics.drawString("请确认 "+CommonUtil.getDateString(dailyauditstatus.getNight(),"M月d日")+" 的入住情况", 145, 205);
graphics.setFont(new Font("宋体", Font.BOLD, 14));
Font fontTitle = new Font("黑体", Font.BOLD, 20);
graphics.setFont(fontTitle);
graphics.drawString(title, 235, 155);
return imageHead;
}
public static BufferedImage createBaseHeadDayBufImage(String bascDec, String barCodeDic, String userName, String title, Dailyauditstatus dailyauditstatus) throws IOException {
BufferedImage imageHead = new BufferedImage(imageWidth, 145, BufferedImage.TYPE_INT_RGB);
File logofile = new File(Framework.servletRealPath+"faxFile"+File.separator+ "logo.jpg");
Image logoImage = javax.imageio.ImageIO.read(logofile); // 读取jpg等图片文件
InputStream barCodeStream = new FileInputStream(bascDec + barCodeDic);
BufferedImage barCodeImage = ImageIO.read(barCodeStream);
Graphics graphics = imageHead.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imageWidth, 210);
graphics.setColor(Color.BLACK);
graphics.drawImage(logoImage, 0, 0, null);
graphics.drawImage(barCodeImage, 320, 0, null);
graphics.setFont(fontPage);// 设置当前图片全局字体
graphics.drawString("携旅电话:", 615, 10);// photo
graphics.drawString(jltourPhoto, 680, 10);// photo
graphics.drawString("携旅传真:", 615, 30);// photo
graphics.drawString(jltourFax, 680, 30);// fax
graphics.drawString("发送人:", 628, 50);// photo
graphics.drawString(CommonUtil.getDefault(userName), 680, 50);// 发送人
graphics.drawString("发送时间:", 615, 100);// 携旅订单号
graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 680, 100);// 携旅订单号
graphics.setFont(new Font("宋体", Font.BOLD, 15));
graphics.drawString("致:", 15, 110);// 酒店的名字
graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername())+" ", 40, 110);// 酒店的名字
graphics.setFont(new Font("宋体", Font.BOLD, 13));
graphics.drawString("订单信息栏 请确认"+CommonUtil.getDateString(dailyauditstatus.getNight(), "M月d日")+"的入住情况", 15, 130);// 备注信息
graphics.drawLine(15, 138, 800, 138);//画线
Font fontTitle = new Font("宋体", Font.BOLD, 24);
graphics.setFont(fontTitle);
graphics.drawString("日审单", 345, 90);
return imageHead;
// InputStream imagein = new FileInputStream(Framework.servletRealPath+"faxFile\\"+ baseHeadDayFile);
// InputStream imagein2 = new FileInputStream(bascDec +barCodeDic);
// BufferedImage image = ImageIO.read(imagein);
// BufferedImage image2 = ImageIO.read(imagein2);
// Graphics graphics = image.getGraphics();
// graphics.drawImage(image2, 320, 10, null);
// graphics.setColor(Color.BLACK);
// graphics.setFont(fontPage);// 设置当前图片全局字体
// graphics.drawString(jltourPhoto, 680, 20);// photo
// graphics.drawString(jltourFax, 680, 40);// fax
// graphics.drawString(CommonUtil.getDefault(userName), 680, 60);// 发送人
// // graphics.drawString(CommonUtil.getDefault(order.getOrdercd()), 680,
// // 80);//携旅订单号
// graphics.drawString(CommonUtil.getDateString(new java.util.Date(), "yyyy-MM-dd HH:mm"), 680, 130);// 发送时间
// graphics.drawString(CommonUtil.getDefault(dailyauditstatus.getSuppliername()), 50, 130);// 酒店的名字
// // graphics.drawString(CommonUtil.getDefault(dailyauditstatus.get), 78,
// // 211);//结算方式
// Font fontTitle = new Font("宋体", Font.BOLD, 24);
// graphics.setFont(fontTitle);
// graphics.drawString(title, 360, 100);
// imagein.close();
// imagein2.close();
// return image;
}
public static BufferedImage createImageDayPrice(List orderitemList, Map orderitemsizeMap, Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
int imageHeight = 25+25+orderitemList.size()*25;
//int imageHeight = 800;
OrderDao orderDao=(OrderDao)Framework.getDaoFactory().getBean("orderDao");
Order order=null;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("订单编号", 20, 20);
graphicsPrice.drawString("房型", 130, 20);
graphicsPrice.drawString("入住/退房日期", 200, 20);
graphicsPrice.drawString("房号", 310, 20);
graphicsPrice.drawString("入住人", 350, 20);
graphicsPrice.setFont(new Font("楷体", Font.PLAIN, 13));
int beginwite = 380;
if (null != dailyauditstatus) {
Date startdate = (Date) DateUtil.getDate(dailyauditstatus.getNight(), -2);
Date currentDate = startdate;
int days = 6;
for (int g = 0; g < 3; g++) {
if(currentDate.getTime()==dailyauditstatus.getNight().getTime()){
graphicsPrice.setColor(Color.gray);
}else{
graphicsPrice.setColor(Color.BLACK);
}
beginwite = beginwite + 38;
graphicsPrice.drawString(CommonUtil.getDateString(currentDate, "M.d"), beginwite, 10);
graphicsPrice.drawString("周" + CommonUtil.getChineseDayOfWeek(currentDate), beginwite, 25);
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
for (int g = 3; g < days; g++) {
if(currentDate.getTime()==dailyauditstatus.getNight().getTime()){
graphicsPrice.setColor(Color.gray);
}else{
graphicsPrice.setColor(Color.BLACK);
}
beginwite = beginwite + 38;
graphicsPrice.drawString(CommonUtil.getDateString(currentDate, "M.d"), beginwite, 10);
graphicsPrice.drawString("周" + CommonUtil.getChineseDayOfWeek(currentDate), beginwite, 25);
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
}
graphicsPrice.setFont(fontHead);
graphicsPrice.drawString("已离店",640, 20);
graphicsPrice.drawString("备注/确认号", 700, 20);
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 内容字
graphicsPrice.setFont(fontContent);
int noY = 25;// 当前开始写的y坐标
Date startdate = (Date) DateUtil.getDate(dailyauditstatus.getNight(), -2);
Date currentDate = startdate;
int days = 6;
Orderitem orderitem=null,orderitemLast=null,orderitemNext=null;
beginwite = 380;
int beginId = 0;
int start=0;
int end=1;
boolean flat = false;
for (int i = 0; i < orderitemList.size(); i++) {
noY = noY + linHieght;
orderitem = (Orderitem) orderitemList.get(i);
Integer orderitemsize = 0;
orderitemsize = (Integer) orderitemsizeMap.get(orderitem.getOrderid());
if(i>0){
orderitemLast=(Orderitem)orderitemList.get(i-1);
}
if(i<orderitemList.size()-1){
orderitemNext=(Orderitem)orderitemList.get(i+1);
}
if(null==orderitemLast ){
start=1;
//System.out.println("pricebeanitemLast==NULL start:"+start);
}else if((int)orderitemLast.getOrderid()==(int)orderitem.getOrderid()){
start=8;
//System.out.println("pricebeanitemLast.getPricebeanid()==pricebeanitem.getPricebeanid() start:"+start);
}else if((int)orderitemLast.getOrderid()!=(int)orderitem.getOrderid()){
start=1;
//System.out.println("pricebeanitemLast.getPricebeanid():"+pricebeanitemLast.getPricebeanid()+",,"+pricebeanitem.getPricebeanid());
//System.out.println("pricebeanitemLast.getPricebeanid()!=pricebeanitem.getPricebeanid() start:"+start);
}
String roomtypenameratetype=orderitem.getRoomtypenameratetype()+" "+orderitem.getRoomqty()+"间";
if(null!=orderitemLast && orderitem.getRoomtypenameratetype().equals(orderitemLast.getRoomtypenameratetype())&& start!=1){
roomtypenameratetype="";
}
if (beginId != orderitem.getOrderid()) {
flat = true;
} else {
flat = false;
}
beginId = orderitem.getOrderid();
String pricingtype="";
if(orderitem.getPricingtype().intValue()==11){
pricingtype="现付";
}else{
pricingtype="挂帐";
}
if (null != orderitemsize) {
if (flat) {
graphicsPrice.setColor(Color.gray);
graphicsPrice.drawLine(15,noY-20 , 800, noY-20);//画线
graphicsPrice.setColor(Color.BLACK);
if (orderitemsize == 1) {
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getOrdercd()), 20, noY);
graphicsPrice.drawString(pricingtype, 40, noY+13);
} else {
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getOrdercd()), 20, noY + ((orderitemsize * 10) / 2));
graphicsPrice.drawString(pricingtype, 40, noY + ((orderitemsize * 10) / 2)+20);
}
}
}
graphicsPrice.drawString(roomtypenameratetype, 115, noY);
graphicsPrice.drawString(CommonUtil.getDateString(orderitem.getCheckinday(), "M.d")+"-"+CommonUtil.getDateString(orderitem.getCheckoutday(), "M.d")+" "+orderitem.getDays()+"晚", 200, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getRoomno()), 310, noY);
graphicsPrice.drawString(CommonUtil.getDefault(orderitem.getCheckinperson()), 350, noY);
currentDate = startdate;
Date checkoutday = DateUtil.getDate(orderitem.getCheckoutday(), -1);
for (int h = 0; h < days; h++) {
beginwite = beginwite + 38;
if (DateUtil.between(currentDate, orderitem.getCheckinday(), checkoutday)) {
Integer checkinstatus = (Integer) orderitemidDateStatusMap.get(CommonUtil.getDateString(currentDate, "yyyy-MM-dd") + orderitem.getOrderitemid());
if (null == checkinstatus || checkinstatus == 0) {
if(DateUtil.compare(currentDate,dailyauditstatus.getNight())==0){
graphicsPrice.drawString(CommonUtil.getDefault("□"), beginwite + 3, noY);
}else{
graphicsPrice.drawString(CommonUtil.getDefault("-"), beginwite + 3, noY);
}
} else if (checkinstatus == 1) {
graphicsPrice.drawString(CommonUtil.getDefault("√"), beginwite + 3, noY);
} else if (checkinstatus == {
graphicsPrice.drawString(CommonUtil.getDefault("×"), beginwite + 3, noY);
}
}
currentDate = (Date) DateUtil.getDate(currentDate, 1);
}
graphicsPrice.drawString("□",beginwite + 40, noY);
beginwite = 380;
if (flat) {
order=orderDao.retrieveOrder(orderitem.getOrderid());
graphicsPrice.drawString(CommonUtil.getDefault(order.getConfirmno()), 700, noY);
}
}
graphicsPrice.drawLine(15, 35+( orderitemList.size() * 25), 800, 35+( orderitemList.size() * 25));//画线
return image;
}
public static BufferedImage createImageDayPriceNew(List orderitemList, Map orderitemsizeMap, Map orderitemidDateStatusMap, Dailyauditstatus dailyauditstatus) {
int imageHeight = 25+25+orderitemList.size()*25;
OrderDao orderDao=(OrderDao)Framework.getDaoFactory().getBean("orderDao");
Order order=null;
BufferedImage image = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics graphicsPrice = image.getGraphics();
Font fontHead = new Font("宋体", Font.BOLD, 14);// 头部字
graphicsPrice.setFont(fontHead);
graphicsPrice.setColor(Color.WHITE);
graphicsPrice.fillRect(0, 0, imageWidth, imageHeight);
graphicsPrice.setColor(Color.BLACK);
graphicsPrice.drawString("酒店名称", 45, 15);
graphicsPrice.drawString("客人姓名", 150, 15);
graphicsPrice.drawString("入住/退房", 242, 15);
graphicsPrice.drawString("退房日期", 310, 15);
graphicsPrice.drawString("核对日期", 380, 15);
graphicsPrice.drawString("间数", 460, 15);
graphicsPrice.drawString("是否续住", 520, 15);
graphicsPrice.drawString("房号", 480, 15);
graphicsPrice.drawString("确认号", 710, 15);
graphicsPrice.drawLine(50, 15+5, 200, 15+5);//最后横线 换行150
graphicsPrice.setFont(new Font("楷体", Font.PLAIN, 13));
graphicsPrice.setFont(fontHead);
Font fontContent = new Font("宋体", Font.PLAIN, 14);// 内容字
graphicsPrice.setFont(fontContent);
int noY = 25;// 当前开始写的y坐标
graphicsPrice.drawLine(310, 15+5, 370, 15+5);//最后横线 换行150
//50 4个字
//画坚线
//分行120
graphicsPrice.drawLine(42, 0, 42, noY);//第一条竖线
//画横线
graphicsPrice.drawLine(42, 0, 760, 0);//第一条横线
graphicsPrice.drawLine(42, noY, 760, noY);//最后一条横线
return image;
}
public static List getTiffStreamByFileName(String fileName){
List result = new ArrayList();
if(null != fileName && fileName.length()>0){
String tiffName = fileName.substring(0,fileName.indexOf("."))+".tif";
try{
/*
OutputStream os = new FileOutputStream(tiffName);
TIFFEncodeParam param =new TIFFEncodeParam();
ImageEncoder enc = ImageCodec.createImageEncoder("TIFF", os,param);
enc.encode(src);
os.close();
*/
String fileNames= fileName.substring(fileName.lastIndexOf(File.separator)+1,fileName.length());
String tiffNames = tiffName.substring(tiffName
发表评论
-
淘宝客
2011-05-18 18:04 1302q=&u=1231482&pid=mm_265 ... -
build.xml
2011-04-07 17:55 794<?xml version="1.0" ... -
spring,ibatis,hibernate svn
2010-09-02 11:04 1976很多优秀的开源项目已经提供SVN源码签出了,无论是解疑还是学习 ... -
报表jsp
2010-08-21 17:54 830<%@ page language="java ... -
佛家四大经典爱情故事
2010-06-18 12:37 825一)前世是谁埋了你 ... -
讲给23岁男生以上的生活方式
2009-10-23 08:30 1047http://p.alimama.com/cpsglist ... -
端口查看
2009-10-15 09:26 1237如何查看进程端口(2007-01-20 20:35:05)标签 ... -
js复制当前链接
2009-07-14 10:40 2567<script type="text/java ... -
关于fck找不到路径
2009-07-14 10:25 1016如果是iis+Tomcat出现找不能路公式则是因为路径没有影射 ...
相关推荐
内容概要:本文深入探讨了微生物表面层次(S-layer)蛋白质的结构和功能,尤其关注其在古菌和细菌中的角色。文中详细介绍了S层结构特征,如形成二維晶格的方式以及与其他细胞外膜成分的相互作用机制。对于S层的具体生物学作用——从保护细胞到适应环境变化——都有详尽论述,并且对不同种类微生物S层的特异性进行了分类比较。此外,还提到了当前的研究热点和潜在的应用领域。 适合人群:生物学家、微生物学家及其他生命科学研究人员;对细胞生物学特别是细胞壁研究感兴趣的学生及专业人士。 使用场景及目标:作为参考资料帮助科学家理解S层的物理化学属性,为实验设计提供思路,推动相关领域学术交流与发展;也为寻找新的工业材料和技术提供了理论依据。 阅读建议:鉴于论文的技术性强且内容丰富复杂,在初读时可以先把握各章节的大致意义,后续针对个人感兴趣的专题进一步深入了解。由于涉及到大量的分子生物学知识,请确保读者有良好的背景基础。同时推荐配合最新的科研报道一同学习以获取最新进展。
python爬虫,一个简单的Python爬虫示例,使用了requests库来发送HTTP请求,以及BeautifulSoup库来解析HTML页面。这个示例将从一个简单的网页中获取标题并打印出来。
内容概要:本文介绍了一种使用PyTorch构建的深度学习模型,该模型结合了一个包含一个隐藏层的全连接神经网络(FCN)和一个卷积神经网络(CNN)。模型用于解决CIFAR-10数据集中猫狗图片的二分类问题。文章详细描述了从数据预处理到模型架构设计、融合方式选择、损失函数设定以及训练和测试流程。实验证明,模型的有效性和融合的优势得到了显著体现。 适用人群:面向具有一定机器学习和Python编程基础的研究人员和技术爱好者。 使用场景及目标:本项目的目的是提供一种可行的猫狗分类解决方案,同时帮助研究者深入了解两类网络的工作机制及其协作的可能性。 其他说明:文中不仅展示了完整的代码片段,还讨论了多种改进方向如结构优化、预处理策略、超参数调节、引入正则化技术等。 本项目适合有兴趣探究全连接网路与卷积网络结合使用的从业者。无论是初学者想要加深对这两类基本神经网络的理解还是希望找到新的切入点做相关研究的专业人士都可以从中受益。 此资源主要用于指导如何用Python(借助于PyTorch框架)实现针对特定分类任务设计的人工智能系统。它强调了实验的设计细节和对关键组件的选择与调优。 此外,作者还在最后探讨了多个可用于改善现有成果的方法,鼓励大家持续关注并试验不同的改进措施来提升模型性能。
简传1.4.1 windows安装包,支持局域网内文件和文本的传输,可以跨操作系统
地面无线电台(站)设置使用申请表.xlsx
【Python】Python爬虫实战--小猪短租爬虫_pgj
comsol模型,变压器匝间短路5%,电磁场,二维模型,瞬态 包括电流变化曲线,正常与匝短后的绕组上的轴向磁密和辐向磁密波形与分布,铁心的磁密变化
文中使用了逻辑回归模型对病人如约就诊与相关变量进行分析,结果发现该数据对逻辑回归模型的拟合程度很差,需要在后续使用其他模型进行进一步的拟合。因此,**该文章未能成功探索到相关变量和如约就诊之间的关系,不能提供准确的参考,可以作为小白的逻辑回归模型流程参照使用**。且待后续更新(课程和考试繁忙,学习进度较为缓慢,尚在学习中,但一定会进行补充)
QQ空间全能王软件易语言源码【赠送 易语言模块+易语言教程】 一、QQ空间全能王软件易语言源码 二、QQ空间全能王软件易语言模块 三、赠送2套易语言教程 1、价值150易语言视频教程光盘 2、价值900E锦学院易语言POST+JS实战,仅供学习研究 QQ空间全能王软件易语言源码【赠送 易语言模块+易语言教程】
2023-04-06-项目笔记-第三百六十八阶段-课前小分享_小分享1.坚持提交gitee 小分享2.作业中提交代码 小分享3.写代码注意代码风格 4.3.1变量的使用 4.4变量的作用域与生命周期 4.4.1局部变量的作用域 4.4.2全局变量的作用域 4.4.2.1全局变量的作用域_1 4.4.2.366局变量的作用域_366- 2025-01-04
Matlab领域上传的视频是由对应的完整代码运行得来的,完整代码皆可运行,亲测可用,适合小白; 1、从视频里可见完整代码的内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2019b;若运行有误,根据提示修改;若不会,私信博主; 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可私信博主; 4.1 博客或资源的完整代码提供 4.2 期刊或参考文献复现 4.3 Matlab程序定制 4.4 科研合作
java面向对象程序设计实验报告
Java学生信息管理系统(MySQL版)源码+数据库+文档说明.zip,含有代码注释,满分大作业资源,新手也可看懂,期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。该项目可以作为课程设计期末大作业使用,该系统功能完善、界面美观、操作简单、功能齐全、管理便捷,具有很高的实际应用价值。 Java学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zipJava学生信息管理系统(MySQL版)源码+数据库+文档说明.zi
多时间尺度滚动优化的多能源微网双层调度模型 参考文档:《Collaborative Autonomous Optimization of Interconnected Multi-Energy Systems with Two-Stage Transactive Control Framework》 代码主要做的是一个多能源微网的优化调度问题,首先对于下层多能源微网模型,考虑以其最小化运行成本为目标函数,通过多时间尺度滚动优化求解其最优调度策略,对于上层模型,考虑运营商以最小化运营成本为目标函数,同时考虑变压器过载等问题,构建了一个两阶段优化模型,通过互补松弛条件以及KKT条件,对模型进行了化简求解。
内容概要:《Multimodal Deep Learning.pdf》是一本深入探讨多模态深度学习的专业书籍,涵盖自然语言处理(NLP)和计算机视觉(CV)领域最新的研究进展与应用实例。本书按照时间顺序介绍了该领域的演进过程和技术背景,并详细讲解了将不同模态数据转换或融合的技术框架,如图像到文本、文本到图像、支持视觉的语言模型和支持语言的视觉模型等。同时书中也对未来的发展趋势进行了展望并提出了当前技术存在的挑战及改进方向,最后强调了几款最新发布的架构的重要性以及向视频扩展的可能性。 适合人群:对自然语言处理、计算机视觉有浓厚兴趣的研究人员、工程师或者学生,尤其是从事相关技术开发工作的读者。 使用场景及目标:帮助用户了解多模态深度学习的核心原理;为开发者提供实用的参考工具;激发新的科研创意和技术突破。 阅读建议:鉴于这本书籍内容丰富且前沿,在阅读过程中应当关注每一章节所涉及的基本概念和具体案例之间的联系,结合实际应用场景理解各部分内容,并尝试复现文中提到的关键实验以加强记忆。此外,随着该领域快速发展,鼓励持续追踪最新的文献报道来补充书内的知识点。
matlab 滤波器设计,基于matlab的模拟滤波器和数字滤波器设计,其中数字滤波器包扩IIR和FIR的低通、高通、带通、带阻四大类型,模拟滤波器包括巴特沃斯(Butterworth)和切比雪夫(Chebyshev)算法下的低通、高通、带通、带阻四种类型。
关键词:一致性算法;直流微电网;下垂控制;分布式二次控制;电压电流恢复与均分;非线性负载;MATLAB Simulink;顶刊复现,有意者加好友;设有粉丝价,本模型不,运行时间较长耐心等待 主题:提出了一种新的基于一致性算法的直流微电网均流和均压二级控制方案,该微电网由分布式电源、动态RLC和非线性ZIE(恒阻抗、恒电流和指数型)负载组成。 分布式二级控制器位于初级电压控制层(下垂控制层)之上,并利用通过与邻居通信来计算必要的控制动作。 除了表明在稳定状态下总是能达到预期的目标之外,还推导了恒功率负载(即零指数负载)平衡点存在和唯一的充分条件。 该控制方案仅依赖于本地信息,便于即插即用。 最后提供了电压稳定性分析,并通过仿真说明了该方案的优秀性能和鲁棒性。
管理工程系学生周五和周六晚不住校申请表.doc
【C++】哔哩哔哩直播万能场控机器人,弹幕姬+答谢姬+回复姬+点歌姬+各种小骚操作,目前唯一可编程机器人
自适应大领域搜索算法(ALNS)matlab解决tsp问题,与传统大规模领域搜索算法(LNS)相比收敛性强,运行时间短,很好的学习资料