日志文件存在D:/logs文件夹下,每分钟生成一次测试ing
							parent
							
								
									5df3f270bc
								
							
						
					
					
						commit
						779566b2c0
					
				| 
						 | 
					@ -15,37 +15,31 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# $Id: log4j.properties,v 1.3 2010/06/01 09:25:32 peng.lei Exp $
 | 
					# $Id: log4j.properties,v 1.3 2010/06/01 09:25:32 peng.lei Exp $
 | 
				
			||||||
 | 
					
 | 
				
			||||||
log4j.rootCategory=INFO, stdout
 | 
					log4j.rootCategory=INFO,stdout,R
 | 
				
			||||||
 | 
					
 | 
				
			||||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 | 
					log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 | 
				
			||||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 | 
					log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 | 
				
			||||||
log4j.appender.stdout.layout.ConversionPattern=[wms] %p [%t] %C{1}.%M(%L) | %m%n
 | 
					log4j.appender.stdout.layout.ConversionPattern=[zwwms]  %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
 | 
				
			||||||
 | 
					log4j.appender.R.File=D:/logs/zwwms.log
 | 
				
			||||||
 | 
					log4j.appender.R.DatePattern='_' yyyy-MM-dd-HH-mm
 | 
				
			||||||
 | 
					log4j.appender.R.Append = true
 | 
				
			||||||
 | 
					log4j.appender.R.Threshold = INFO
 | 
				
			||||||
 | 
					log4j.appender.R.layout = org.apache.log4j.PatternLayout
 | 
				
			||||||
 | 
					log4j.appender.R.layout.ConversionPattern = [zwwms] %-d{yyyy-MM-dd HH:mm:ss}  [ %t:%r ] - [ %p ]  %m%n
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
log4j.appender.R=org.apache.log4j.RollingFileAppender
 | 
					 | 
				
			||||||
log4j.appender.R.File=wms.log
 | 
					 | 
				
			||||||
log4j.appender.R.MaxFileSize=100KB
 | 
					 | 
				
			||||||
log4j.appender.R.MaxBackupIndex=0
 | 
					 | 
				
			||||||
log4j.appender.R.layout=org.apache.log4j.PatternLayout
 | 
					 | 
				
			||||||
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Configuration for receiving e-mails when ERROR messages occur.
 | 
					 | 
				
			||||||
log4j.appender.mail=org.apache.log4j.net.SMTPAppender
 | 
					 | 
				
			||||||
log4j.appender.mail.To=system-error@dev.net
 | 
					 | 
				
			||||||
log4j.appender.mail.From=wms@dev.com
 | 
					 | 
				
			||||||
log4j.appender.mail.SMTPHost=mail.dev.com
 | 
					 | 
				
			||||||
log4j.appender.mail.Threshold=ERROR
 | 
					 | 
				
			||||||
log4j.appender.mail.BufferSize=1
 | 
					 | 
				
			||||||
log4j.appender.mail.Subject=[wms] ELOG Enterprise WMS Application Error
 | 
					 | 
				
			||||||
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
 | 
					 | 
				
			||||||
log4j.appender.mail.layout.ConversionPattern=%d  %-5p %c %x - %m%n
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# If programmed properly the most messages would be at DEBUG
 | 
					# If programmed properly the most messages would be at DEBUG
 | 
				
			||||||
# and the least at FATAL.
 | 
					# and the least at FATAL.
 | 
				
			||||||
log4j.logger.com.dev=ERROR
 | 
					log4j.logger.com.dev=INFO
 | 
				
			||||||
log4j.logger.com.dev.energy=ERROR
 | 
					log4j.logger.com.dev.energy=INFO
 | 
				
			||||||
log4j.logger.com.dev.swms=ERROR
 | 
					log4j.logger.com.dev.swms=INFO
 | 
				
			||||||
log4j.logger.com.dev.energy.server.action=ERROR
 | 
					log4j.logger.com.dev.energy.server.action=INFO
 | 
				
			||||||
log4j.logger.com.dev.swms.server.action=ERROR
 | 
					log4j.logger.com.dev.swms.server.action=INFO
 | 
				
			||||||
#log4j.logger.com.dev.swms=ERROR
 | 
					#log4j.logger.com.dev.swms=ERROR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,7 @@
 | 
				
			||||||
import com.dev.energy.client.utils.StringUtils;
 | 
					import com.dev.energy.client.utils.StringUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
 | 
					import org.apache.log4j.PropertyConfigurator;
 | 
				
			||||||
import org.mortbay.http.SocketListener;
 | 
					import org.mortbay.http.SocketListener;
 | 
				
			||||||
import org.mortbay.jetty.Server;
 | 
					import org.mortbay.jetty.Server;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,10 +9,18 @@ public class AjaxJettyLauncher {
 | 
				
			||||||
	protected int port = 8080;
 | 
						protected int port = 8080;
 | 
				
			||||||
	protected String contextName = "zwwms";
 | 
						protected String contextName = "zwwms";
 | 
				
			||||||
	protected String deployPath = null;
 | 
						protected String deployPath = null;
 | 
				
			||||||
 | 
						private static Logger logger = Logger.getLogger(AjaxJettyLauncher.class); 
 | 
				
			||||||
	public static void main(String[] args) throws Exception {
 | 
						public static void main(String[] args) throws Exception {
 | 
				
			||||||
 | 
							String currentDir = System.getProperty("user.dir");
 | 
				
			||||||
 | 
							System.out.println("当前根目录是: " + currentDir);
 | 
				
			||||||
 | 
							PropertyConfigurator.configure("log4j.properties");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		AjaxJettyLauncher jl = new AjaxJettyLauncher();
 | 
							AjaxJettyLauncher jl = new AjaxJettyLauncher();
 | 
				
			||||||
		jl.run();
 | 
							jl.run();
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected void init() {
 | 
						protected void init() {
 | 
				
			||||||
| 
						 | 
					@ -22,6 +33,7 @@ public class AjaxJettyLauncher {
 | 
				
			||||||
		server.addListener(listener);
 | 
							server.addListener(listener);
 | 
				
			||||||
		server.addWebApplication("/" + getContextName() , getDeployPath());
 | 
							server.addWebApplication("/" + getContextName() , getDeployPath());
 | 
				
			||||||
		server.start();
 | 
							server.start();
 | 
				
			||||||
 | 
							logger.error("1232221231");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected int getPort() {
 | 
						protected int getPort() {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,21 +41,21 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
				commonDao.store(item);
 | 
									commonDao.store(item);
 | 
				
			||||||
			}else {
 | 
								}else {
 | 
				
			||||||
				throw new BusinessException("请选择文件!");
 | 
									throw new BusinessException("璇烽<EFBFBD>夋嫨鏂囦欢锛<EFBFBD>");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		LocalizedMessage.addLocalizedMessage("上传成功");
 | 
							LocalizedMessage.addLocalizedMessage("涓婁紶鎴愬姛");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public <T extends Entity> void importImageFile(Long id, File file,
 | 
						public <T extends Entity> void importImageFile(Long id, File file,
 | 
				
			||||||
			String imageType, String objectType ,String strExtend1){
 | 
								String imageType, String objectType ,String strExtend1){
 | 
				
			||||||
		SignFile imageFile = (SignFile) EntityFactory.getEntity(SignFile.class);
 | 
							SignFile imageFile = (SignFile) EntityFactory.getEntity(SignFile.class);
 | 
				
			||||||
		/*String fileURL=file.getPath();
 | 
							/*String fileURL=file.getPath();
 | 
				
			||||||
		//截取admin前面的字符串内容
 | 
							//鎴彇admin鍓嶉潰鐨勫瓧绗︿覆鍐呭
 | 
				
			||||||
		String str=fileURL.substring(1, fileURL.indexOf("admin"));
 | 
							String str=fileURL.substring(1, fileURL.indexOf("admin"));
 | 
				
			||||||
		//截取admin后的字符串内容
 | 
							//鎴彇admin鍚庣殑瀛楃涓插唴瀹<EFBFBD>
 | 
				
			||||||
		String bb=fileURL.substring(str.length()+1, fileURL.length());
 | 
							String bb=fileURL.substring(str.length()+1, fileURL.length());
 | 
				
			||||||
		String str2=bb.substring(0, bb.indexOf("-"));
 | 
							String str2=bb.substring(0, bb.indexOf("-"));
 | 
				
			||||||
		String bb2=bb.substring(str2.length()+1, bb.length());
 | 
							String bb2=bb.substring(str2.length()+1, bb.length());
 | 
				
			||||||
| 
						 | 
					@ -69,28 +69,28 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
			date = new Date();
 | 
								date = new Date();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
 | 
							SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
 | 
				
			||||||
		File file2 = new File("C:/tomcat-8080/webapps/zwwms/images/zw/imageTarget/");// 存放生成的图片的目标文件夹
 | 
							File file2 = new File("C:/tomcat-8080/webapps/zwwms/images/zw/imageTarget/");// 瀛樻斁鐢熸垚鐨勫浘鐗囩殑鐩爣鏂囦欢澶<EFBFBD>
 | 
				
			||||||
		if (!file2.exists()) {
 | 
							if (!file2.exists()) {
 | 
				
			||||||
			file2.mkdirs();
 | 
								file2.mkdirs();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			FileInputStream in = new FileInputStream(file);// 定义文件输入流
 | 
								FileInputStream in = new FileInputStream(file);// 瀹氫箟鏂囦欢杈撳叆娴<EFBFBD>
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			MultipartFile multipartFile = new MockMultipartFile(file.getName(),file.getName(),ContentType.APPLICATION_OCTET_STREAM.toString(),in);
 | 
								MultipartFile multipartFile = new MockMultipartFile(file.getName(),file.getName(),ContentType.APPLICATION_OCTET_STREAM.toString(),in);
 | 
				
			||||||
			byte[] bytes = PicUtils.compressPicForScale(multipartFile.getBytes(), 120);
 | 
								byte[] bytes = PicUtils.compressPicForScale(multipartFile.getBytes(), 120);
 | 
				
			||||||
			File fOut = new File("C:/tomcat-8080/webapps/zwwms/images/zw/imageTarget/"+ fileName);
 | 
								File fOut = new File("C:/tomcat-8080/webapps/zwwms/images/zw/imageTarget/"+ fileName);
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			BufferedInputStream bin = new BufferedInputStream(in);
 | 
								BufferedInputStream bin = new BufferedInputStream(in);
 | 
				
			||||||
			FileOutputStream out = new FileOutputStream(fOut);// 定义文件输出流
 | 
								FileOutputStream out = new FileOutputStream(fOut);// 瀹氫箟鏂囦欢杈撳嚭娴<EFBFBD>
 | 
				
			||||||
			out.write(bytes);
 | 
								out.write(bytes);
 | 
				
			||||||
			bin.close();
 | 
								bin.close();
 | 
				
			||||||
			out.close();
 | 
								out.close();
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			throw new BusinessException("文件上传出错!");
 | 
								throw new BusinessException("鏂囦欢涓婁紶鍑洪敊!");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (file != null) {
 | 
							if (file != null) {
 | 
				
			||||||
			imageFile.setFileName(fileName);
 | 
								imageFile.setFileName(fileName);
 | 
				
			||||||
			imageFile.processFileUrl(fileName);// 生成带img标签的目标图片的url地址
 | 
								imageFile.processFileUrl(fileName);// 鐢熸垚甯mg鏍囩鐨勭洰鏍囧浘鐗囩殑url鍦板潃
 | 
				
			||||||
			imageFile.setImageType(imageType);
 | 
								imageFile.setImageType(imageType);
 | 
				
			||||||
			imageFile.setObjectType(objectType);
 | 
								imageFile.setObjectType(objectType);
 | 
				
			||||||
			imageFile.setOperate(UserHolder.getUser().getName());
 | 
								imageFile.setOperate(UserHolder.getUser().getName());
 | 
				
			||||||
| 
						 | 
					@ -108,7 +108,7 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * 获取文件的文件扩展名如:.jpg
 | 
						 * 鑾峰彇鏂囦欢鐨勬枃浠舵墿灞曞悕濡傦細.jpg
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @param file
 | 
						 * @param file
 | 
				
			||||||
	 * @return
 | 
						 * @return
 | 
				
			||||||
| 
						 | 
					@ -121,7 +121,7 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * 获取图片名称的后缀:一个6位的随机数
 | 
						 * 鑾峰彇鍥剧墖鍚嶇О鐨勫悗缂<EFBFBD>:涓<EFBFBD>涓紪浣嶇殑闅忔満鏁<EFBFBD>
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @author dev
 | 
						 * @author dev
 | 
				
			||||||
	 * @param order
 | 
						 * @param order
 | 
				
			||||||
| 
						 | 
					@ -133,11 +133,11 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * 将临时文件转换成图片
 | 
						 * 灏嗕复鏃舵枃浠惰浆鎹㈡垚鍥剧墖
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @author dev
 | 
						 * @author dev
 | 
				
			||||||
	 * @param file
 | 
						 * @param file
 | 
				
			||||||
	 * @param 进仓编号或者预配编号
 | 
						 * @param 杩涗粨缂栧彿鎴栬<EFBFBD>呴閰嶇紪鍙<EFBFBD>
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private void createFile(File file, String fileName, String code) {
 | 
						private void createFile(File file, String fileName, String code) {
 | 
				
			||||||
		Calendar date = Calendar.getInstance();
 | 
							Calendar date = Calendar.getInstance();
 | 
				
			||||||
| 
						 | 
					@ -145,15 +145,15 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		String dateString = format.format(date.getTime());
 | 
							String dateString = format.format(date.getTime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 判断待存放图片的目录文件夹是否存在,如果不存在新建一个
 | 
							// 鍒ゆ柇寰呭瓨鏀惧浘鐗囩殑鐩綍鏂囦欢澶规槸鍚﹀瓨鍦<EFBFBD>,濡傛灉涓嶅瓨鍦ㄦ柊寤轰竴涓<E7ABB4>
 | 
				
			||||||
		File file1 = new File(
 | 
							File file1 = new File(
 | 
				
			||||||
				GlobalParamUtils.getGloableStringValue("tempFileDir"));// 源文件存放的临时文件夹
 | 
									GlobalParamUtils.getGloableStringValue("tempFileDir"));// 婧愭枃浠跺瓨鏀剧殑涓存椂鏂囦欢澶<EFBFBD>
 | 
				
			||||||
		if (!file1.exists()) {
 | 
							if (!file1.exists()) {
 | 
				
			||||||
			throw new BusinessException("tempFile.not.exists");
 | 
								throw new BusinessException("tempFile.not.exists");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		File file2 = new File(
 | 
							File file2 = new File(
 | 
				
			||||||
		// GlobalParamUtils.getGloableStringValue("imageTarget")+dateString+"\\"+code+"\\");
 | 
							// GlobalParamUtils.getGloableStringValue("imageTarget")+dateString+"\\"+code+"\\");
 | 
				
			||||||
				GlobalParamUtils.getGloableStringValue("imageTarget"));// 存放生成的图片的目标文件夹
 | 
									GlobalParamUtils.getGloableStringValue("imageTarget"));// 瀛樻斁鐢熸垚鐨勫浘鐗囩殑鐩爣鏂囦欢澶<EFBFBD>
 | 
				
			||||||
		if (!file2.exists()) {
 | 
							if (!file2.exists()) {
 | 
				
			||||||
			file2.mkdirs();
 | 
								file2.mkdirs();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -165,42 +165,42 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
			File outputFile = new File(
 | 
								File outputFile = new File(
 | 
				
			||||||
					GlobalParamUtils.getGloableStringValue("imageTarget")
 | 
										GlobalParamUtils.getGloableStringValue("imageTarget")
 | 
				
			||||||
							+ fileName);
 | 
												+ fileName);
 | 
				
			||||||
			FileInputStream in = new FileInputStream(file);// 定义文件输入流
 | 
								FileInputStream in = new FileInputStream(file);// 瀹氫箟鏂囦欢杈撳叆娴<EFBFBD>
 | 
				
			||||||
			BufferedInputStream bin = new BufferedInputStream(in);// 将文件输入流构造到缓存中
 | 
								BufferedInputStream bin = new BufferedInputStream(in);// 灏嗘枃浠惰緭鍏ユ祦鏋勯<EFBFBD>犲埌缂撳瓨涓<EFBFBD>
 | 
				
			||||||
			FileOutputStream out = new FileOutputStream(outputFile);// 定义文件输出流
 | 
								FileOutputStream out = new FileOutputStream(outputFile);// 瀹氫箟鏂囦欢杈撳嚭娴<EFBFBD>
 | 
				
			||||||
			BufferedOutputStream bout = new BufferedOutputStream(out);// 将文件输出流构造到缓存中
 | 
								BufferedOutputStream bout = new BufferedOutputStream(out);// 灏嗘枃浠惰緭鍑烘祦鏋勯<EFBFBD>犲埌缂撳瓨涓<EFBFBD>
 | 
				
			||||||
			int i;
 | 
								int i;
 | 
				
			||||||
			while ((i = bin.read()) != -1) {
 | 
								while ((i = bin.read()) != -1) {
 | 
				
			||||||
				bout.write(i);
 | 
									bout.write(i);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			bin.close();
 | 
								bin.close();
 | 
				
			||||||
			bout.close();// 关闭输入输出流,释放资源
 | 
								bout.close();// 鍏抽棴杈撳叆杈撳嚭娴侊紝閲婃斁璧勬簮
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			throw new BusinessException("IO.error");
 | 
								throw new BusinessException("IO.error");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * 将临时文件共享到指定目录
 | 
						 * 灏嗕复鏃舵枃浠跺叡浜埌鎸囧畾鐩綍
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @author dev
 | 
						 * @author dev
 | 
				
			||||||
	 * @param file
 | 
						 * @param file
 | 
				
			||||||
	 * @param 箱号或进仓编号
 | 
						 * @param 绠卞彿鎴栬繘浠撶紪鍙<EFBFBD>
 | 
				
			||||||
	 *            ,进仓时间或箱子进场时间
 | 
						 *            锛岃繘浠撴椂闂存垨绠卞瓙杩涘満鏃堕棿
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private void createShareFile(File file, String date, String code,
 | 
						private void createShareFile(File file, String date, String code,
 | 
				
			||||||
			String fileName) {
 | 
								String fileName) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// 判断待存放图片的目录文件夹是否存在,如果不存在新建一个
 | 
							// 鍒ゆ柇寰呭瓨鏀惧浘鐗囩殑鐩綍鏂囦欢澶规槸鍚﹀瓨鍦<EFBFBD>,濡傛灉涓嶅瓨鍦ㄦ柊寤轰竴涓<E7ABB4>
 | 
				
			||||||
		/*
 | 
							/*
 | 
				
			||||||
		 * File file1 = new File(
 | 
							 * File file1 = new File(
 | 
				
			||||||
		 * GlobalParamUtils.getGloableStringValue("tempFileDir"));// 源文件存放的临时文件夹
 | 
							 * GlobalParamUtils.getGloableStringValue("tempFileDir"));// 婧愭枃浠跺瓨鏀剧殑涓存椂鏂囦欢澶<EFBFBD>
 | 
				
			||||||
		 * if (!file1.exists()) { throw new
 | 
							 * if (!file1.exists()) { throw new
 | 
				
			||||||
		 * BusinessException("tempFile.not.exists"); }
 | 
							 * BusinessException("tempFile.not.exists"); }
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		File file2 = new File("d:\\picture\\" + date + "\\" + code + "\\");
 | 
							File file2 = new File("d:\\picture\\" + date + "\\" + code + "\\");
 | 
				
			||||||
		// GlobalParamUtils.getGloableStringValue("imageTarget"));//
 | 
							// GlobalParamUtils.getGloableStringValue("imageTarget"));//
 | 
				
			||||||
		// 存放生成的图片的目标文件夹
 | 
							// 瀛樻斁鐢熸垚鐨勫浘鐗囩殑鐩爣鏂囦欢澶<EFBFBD>
 | 
				
			||||||
		if (!file2.exists()) {
 | 
							if (!file2.exists()) {
 | 
				
			||||||
			file2.mkdirs();
 | 
								file2.mkdirs();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -213,23 +213,23 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
			 * GlobalParamUtils.getGloableStringValue("imageTarget") +
 | 
								 * GlobalParamUtils.getGloableStringValue("imageTarget") +
 | 
				
			||||||
			 * fileName);
 | 
								 * fileName);
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			FileInputStream in = new FileInputStream(file);// 定义文件输入流
 | 
								FileInputStream in = new FileInputStream(file);// 瀹氫箟鏂囦欢杈撳叆娴<EFBFBD>
 | 
				
			||||||
			BufferedInputStream bin = new BufferedInputStream(in);// 将文件输入流构造到缓存中
 | 
								BufferedInputStream bin = new BufferedInputStream(in);// 灏嗘枃浠惰緭鍏ユ祦鏋勯<EFBFBD>犲埌缂撳瓨涓<EFBFBD>
 | 
				
			||||||
			FileOutputStream out = new FileOutputStream(outputFile);// 定义文件输出流
 | 
								FileOutputStream out = new FileOutputStream(outputFile);// 瀹氫箟鏂囦欢杈撳嚭娴<EFBFBD>
 | 
				
			||||||
			BufferedOutputStream bout = new BufferedOutputStream(out);// 将文件输出流构造到缓存中
 | 
								BufferedOutputStream bout = new BufferedOutputStream(out);// 灏嗘枃浠惰緭鍑烘祦鏋勯<EFBFBD>犲埌缂撳瓨涓<EFBFBD>
 | 
				
			||||||
			int i;
 | 
								int i;
 | 
				
			||||||
			while ((i = bin.read()) != -1) {
 | 
								while ((i = bin.read()) != -1) {
 | 
				
			||||||
				bout.write(i);
 | 
									bout.write(i);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			bin.close();
 | 
								bin.close();
 | 
				
			||||||
			bout.close();// 关闭输入输出流,释放资源
 | 
								bout.close();// 鍏抽棴杈撳叆杈撳嚭娴侊紝閲婃斁璧勬簮
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			throw new BusinessException("IO.error");
 | 
								throw new BusinessException("IO.error");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * 获取图片存放目录的路径
 | 
						 * 鑾峰彇鍥剧墖瀛樻斁鐩綍鐨勮矾寰<EFBFBD>
 | 
				
			||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 * @author dev
 | 
						 * @author dev
 | 
				
			||||||
	 * @param buffer
 | 
						 * @param buffer
 | 
				
			||||||
| 
						 | 
					@ -244,7 +244,7 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
		String fileSite = GlobalParamUtils.getGloableStringValue("imageTarget");
 | 
							String fileSite = GlobalParamUtils.getGloableStringValue("imageTarget");
 | 
				
			||||||
		// String fileSite =
 | 
							// String fileSite =
 | 
				
			||||||
		// GlobalParamUtils.getGloableStringValue("imageTarget")+dateString+"\\"+code+"\\";
 | 
							// GlobalParamUtils.getGloableStringValue("imageTarget")+dateString+"\\"+code+"\\";
 | 
				
			||||||
		// 目标文件夹存放的路径
 | 
							// 鐩爣鏂囦欢澶瑰瓨鏀剧殑璺緞
 | 
				
			||||||
		buffer.append(fileSite + fileName);
 | 
							buffer.append(fileSite + fileName);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -255,9 +255,9 @@ public class DefaultImageFileManager extends DefaultBaseManager implements Image
 | 
				
			||||||
			if (signFile != null) {
 | 
								if (signFile != null) {
 | 
				
			||||||
				commonDao.delete(signFile);
 | 
									commonDao.delete(signFile);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				throw new BusinessException("待删除文件不存在!");
 | 
									throw new BusinessException("寰呭垹闄ゆ枃浠朵笉瀛樺湪锛<EFBFBD>");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// 删除对应的图片资料
 | 
								// 鍒犻櫎瀵瑰簲鐨勫浘鐗囪祫鏂<EFBFBD>
 | 
				
			||||||
			String fileUrl = GlobalParamUtils
 | 
								String fileUrl = GlobalParamUtils
 | 
				
			||||||
					.getGloableStringValue("imageTarget")
 | 
										.getGloableStringValue("imageTarget")
 | 
				
			||||||
					+ signFile.getFileName();
 | 
										+ signFile.getFileName();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,7 @@
 | 
				
			||||||
 package com.dev.swms.server.web.servlet;
 | 
					 package com.dev.swms.server.web.servlet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.BufferedReader;
 | 
					import java.io.BufferedReader;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.InputStreamReader;
 | 
					import java.io.InputStreamReader;
 | 
				
			||||||
| 
						 | 
					@ -21,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.apache.commons.lang.StringUtils;
 | 
					import org.apache.commons.lang.StringUtils;
 | 
				
			||||||
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
import org.hibernate.Session;
 | 
					import org.hibernate.Session;
 | 
				
			||||||
import org.springframework.beans.BeansException;
 | 
					import org.springframework.beans.BeansException;
 | 
				
			||||||
import org.springframework.context.ApplicationContext;
 | 
					import org.springframework.context.ApplicationContext;
 | 
				
			||||||
| 
						 | 
					@ -81,7 +84,7 @@ import net.sf.json.JSONObject;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class ASNReceiveServlet extends HttpServlet {
 | 
					public class ASNReceiveServlet extends HttpServlet {
 | 
				
			||||||
	private static final long serialVersionUID = 1L;
 | 
						private static final long serialVersionUID = 1L;
 | 
				
			||||||
       
 | 
						private static Logger logger = Logger.getLogger(ASNReceiveServlet.class); 
 | 
				
			||||||
	protected static ApplicationContext ac;
 | 
						protected static ApplicationContext ac;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @see HttpServlet#HttpServlet()
 | 
					     * @see HttpServlet#HttpServlet()
 | 
				
			||||||
| 
						 | 
					@ -107,7 +110,7 @@ public class ASNReceiveServlet extends HttpServlet {
 | 
				
			||||||
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
						 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
						protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
				
			||||||
		System.out.println("==========ASNReceiveServlet========"+new Date());
 | 
							logger.info("==========ASNReceiveServlet========"+new Date());
 | 
				
			||||||
		CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
							CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
				
			||||||
		request.setCharacterEncoding("utf-8");
 | 
							request.setCharacterEncoding("utf-8");
 | 
				
			||||||
		BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"utf-8"));//post方式传递读取字符流
 | 
							BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"utf-8"));//post方式传递读取字符流
 | 
				
			||||||
| 
						 | 
					@ -120,7 +123,7 @@ public class ASNReceiveServlet extends HttpServlet {
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			e.printStackTrace();
 | 
								e.printStackTrace();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		System.out.println("result:"+result.toString());
 | 
							logger.info("result:"+result.toString());
 | 
				
			||||||
		JSONObject json= JSONObject.fromObject(result.toString());
 | 
							JSONObject json= JSONObject.fromObject(result.toString());
 | 
				
			||||||
		QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
							QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
				
			||||||
		String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
							String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
				
			||||||
| 
						 | 
					@ -460,7 +463,7 @@ public class ASNReceiveServlet extends HttpServlet {
 | 
				
			||||||
				sid="0";
 | 
									sid="0";
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			long s_id = Long.parseLong(sid);
 | 
								long s_id = Long.parseLong(sid);
 | 
				
			||||||
			System.out.println(location_id);
 | 
								logger.info(location_id);
 | 
				
			||||||
			if(location_id==null||location_id.equals("")||location_id.equals("\"null\"")) {
 | 
								if(location_id==null||location_id.equals("")||location_id.equals("\"null\"")) {
 | 
				
			||||||
				location_id="0";
 | 
									location_id="0";
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -816,7 +819,7 @@ public class ASNReceiveServlet extends HttpServlet {
 | 
				
			||||||
			resultJson=exitLoginPC(mac, accountType, commonDao);
 | 
								resultJson=exitLoginPC(mac, accountType, commonDao);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		System.out.println("======"+resultJson.toString());
 | 
							logger.info("======"+resultJson.toString());
 | 
				
			||||||
		PrintWriter out = null;
 | 
							PrintWriter out = null;
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			response.setCharacterEncoding("UTF-8");
 | 
								response.setCharacterEncoding("UTF-8");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ import javax.servlet.http.HttpServlet;
 | 
				
			||||||
import javax.servlet.http.HttpServletRequest;
 | 
					import javax.servlet.http.HttpServletRequest;
 | 
				
			||||||
import javax.servlet.http.HttpServletResponse;
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
import org.springframework.context.ApplicationContext;
 | 
					import org.springframework.context.ApplicationContext;
 | 
				
			||||||
import org.springframework.web.context.support.WebApplicationContextUtils;
 | 
					import org.springframework.web.context.support.WebApplicationContextUtils;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,7 +51,7 @@ import net.sf.json.JSONObject;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class MoveServlet extends HttpServlet {
 | 
					public class MoveServlet extends HttpServlet {
 | 
				
			||||||
	private static final long serialVersionUID = 1L;
 | 
						private static final long serialVersionUID = 1L;
 | 
				
			||||||
       
 | 
						private static Logger logger = Logger.getLogger(MoveServlet.class); 
 | 
				
			||||||
	protected static ApplicationContext ac;
 | 
						protected static ApplicationContext ac;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @see HttpServlet#HttpServlet()
 | 
					     * @see HttpServlet#HttpServlet()
 | 
				
			||||||
| 
						 | 
					@ -77,7 +78,7 @@ public class MoveServlet extends HttpServlet {
 | 
				
			||||||
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
						 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
						protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
				
			||||||
		System.out.println("==========app移位========"+new Date());
 | 
							logger.info("==========app移位========"+new Date());
 | 
				
			||||||
		CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
							CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
				
			||||||
		request.setCharacterEncoding("UTF-8");
 | 
							request.setCharacterEncoding("UTF-8");
 | 
				
			||||||
		BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));//post方式传递读取字符流
 | 
							BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));//post方式传递读取字符流
 | 
				
			||||||
| 
						 | 
					@ -90,7 +91,7 @@ public class MoveServlet extends HttpServlet {
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			e.printStackTrace();
 | 
								e.printStackTrace();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		System.out.println("result:"+result.toString());
 | 
							logger.info("result:"+result.toString());
 | 
				
			||||||
		JSONObject json= JSONObject.fromObject(result.toString());
 | 
							JSONObject json= JSONObject.fromObject(result.toString());
 | 
				
			||||||
		QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
							QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
				
			||||||
		String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
							String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
				
			||||||
| 
						 | 
					@ -153,7 +154,7 @@ public class MoveServlet extends HttpServlet {
 | 
				
			||||||
			response.setCharacterEncoding("UTF-8");
 | 
								response.setCharacterEncoding("UTF-8");
 | 
				
			||||||
			out = response.getWriter();
 | 
								out = response.getWriter();
 | 
				
			||||||
			out.print(resultJson.toString());
 | 
								out.print(resultJson.toString());
 | 
				
			||||||
			System.out.println(resultJson.toString());
 | 
								logger.info(resultJson.toString());
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			e.printStackTrace();
 | 
								e.printStackTrace();
 | 
				
			||||||
		} finally {
 | 
							} finally {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,6 @@
 | 
				
			||||||
package com.dev.swms.server.web.servlet;
 | 
					package com.dev.swms.server.web.servlet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.BufferedReader;
 | 
					import java.io.BufferedReader;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.InputStreamReader;
 | 
					import java.io.InputStreamReader;
 | 
				
			||||||
| 
						 | 
					@ -17,6 +19,7 @@ import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
import net.sf.json.JSONArray;
 | 
					import net.sf.json.JSONArray;
 | 
				
			||||||
import net.sf.json.JSONObject;
 | 
					import net.sf.json.JSONObject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.apache.log4j.Logger;
 | 
				
			||||||
import org.hibernate.Session;
 | 
					import org.hibernate.Session;
 | 
				
			||||||
import org.springframework.context.ApplicationContext;
 | 
					import org.springframework.context.ApplicationContext;
 | 
				
			||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 | 
					import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 | 
				
			||||||
| 
						 | 
					@ -61,7 +64,7 @@ import com.dev.swms.server.web.filter.WarehouseHolder;
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
public class PickingServlet extends HttpServlet {
 | 
					public class PickingServlet extends HttpServlet {
 | 
				
			||||||
	private static final long serialVersionUID = 1L;
 | 
						private static final long serialVersionUID = 1L;
 | 
				
			||||||
       
 | 
						private static Logger logger = Logger.getLogger(PickingServlet.class); 
 | 
				
			||||||
	protected static ApplicationContext ac;
 | 
						protected static ApplicationContext ac;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @see HttpServlet#HttpServlet()
 | 
					     * @see HttpServlet#HttpServlet()
 | 
				
			||||||
| 
						 | 
					@ -88,7 +91,7 @@ public class PickingServlet extends HttpServlet {
 | 
				
			||||||
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
						 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
						protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 | 
				
			||||||
		System.out.println("==========app出库========"+new Date());
 | 
							logger.info("==========app出库========"+new Date());
 | 
				
			||||||
		CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
							CommonDao commonDao = (CommonDao) ac.getBean("commonDao");
 | 
				
			||||||
		request.setCharacterEncoding("UTF-8");
 | 
							request.setCharacterEncoding("UTF-8");
 | 
				
			||||||
		BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));//post方式传递读取字符流
 | 
							BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream(),"UTF-8"));//post方式传递读取字符流
 | 
				
			||||||
| 
						 | 
					@ -101,7 +104,7 @@ public class PickingServlet extends HttpServlet {
 | 
				
			||||||
		} catch (IOException e) {
 | 
							} catch (IOException e) {
 | 
				
			||||||
			e.printStackTrace();
 | 
								e.printStackTrace();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		System.out.println("result:"+result.toString());
 | 
							logger.info("result:"+result.toString());
 | 
				
			||||||
		JSONObject json= JSONObject.fromObject(result.toString());
 | 
							JSONObject json= JSONObject.fromObject(result.toString());
 | 
				
			||||||
		QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
							QueryAppManager app = (QueryAppManager) ac.getBean("queryAppManager");
 | 
				
			||||||
		String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
							String methodType =json.has("methodType")?json.getString("methodType"):""; 
 | 
				
			||||||
| 
						 | 
					@ -232,7 +235,7 @@ public class PickingServlet extends HttpServlet {
 | 
				
			||||||
			resultJson=this.printLocationCode(location_code,workerId, wId);
 | 
								resultJson=this.printLocationCode(location_code,workerId, wId);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		System.out.println("======"+resultJson.toString());
 | 
							logger.info("======"+resultJson.toString());
 | 
				
			||||||
		PrintWriter out = null;
 | 
							PrintWriter out = null;
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			response.setCharacterEncoding("UTF-8");
 | 
								response.setCharacterEncoding("UTF-8");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue