工作始终会遇到很多需要收集的资料,时间长了,难免会忘记。作个简要记录,以资后用....
1. EJB容器下面使用JPA处理大批量数据,最终还是直接使用JDBC来做底层处理,容器处理事务,
不需要对事务做单独处理。
public void importData(final List<TimetableJourneyDetail> retList) { if (null != retList && retList.size() > 0) { final EntityManagerFactory emf = entityManager.getEntityManagerFactory(); final BrokerFactory factory = JPAFacadeHelper.toBrokerFactory(emf); final OpenJPAConfiguration conf = factory.getConfiguration(); final DataSourceWrapper dw = new DataSourceWrapper((DataSource) conf.getConnectionFactory()); final SystemUser user = SecurityUtil.getCurrentUser(); final Long userId = user.getId(); final String loginId = user.getLoginId(); PreparedStatement pst = null; Connection conn = null; try { conn = dw.getConnection(); //conn.setAutoCommit(false); final StringBuffer sql = new StringBuffer("INSERT INTO \"LR_TIMETABLE_JOURNEY_DETAIL\""); sql.append("(\"ID\",\"PARENT_ID\",\"LINE_NAME\",\"TRAIN_NO\",\"TRS_NO\",") .append("\"TRIP_NO\",\"REVENUE_FLAG\",\"DIRECTION\",\"FROM_STOP_PLATFORM\",") .append("\"FROM_STOP_ARRIVAL_TIME\",\"FROM_STOP_DEPART_TIME\",\"TO_STOP_PLATFORM\"") .append(",\"TO_STOP_ARRIVAL_TIME\",\"TO_STOP_DEPART_TIME\",\"DEPART_IN_OUT_INDICATOR\"") .append(",\"SINGLE_COUPLE_CAR\",\"KM\",\"TRIPS\",\"LAST_UPD_USER_ID\",") .append("\"LAST_UPD_USER\",\"LAST_UPD_DATETIME\") VALUES") .append("(SEQ_JOURNEY_DETAIL.NEXTVAL,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,") .append(userId).append(",'").append(loginId).append("',(CURRENT DATE))"); pst = conn.prepareStatement(sql.toString()); for (TimetableJourneyDetail d : retList) { pst.setLong(1, d.getParentId()); pst.setString(2, d.getLineName()); pst.setString(3, d.getTrainNo()); pst.setString(4, d.getTrsNo()); pst.setString(5, d.getTripNo()); pst.setString(6, d.getRevenueFlag()); pst.setString(7, d.getDirection()); pst.setString(8, d.getFromStopPlatform()); pst.setString(9, d.getFromStopArrivalTime()); pst.setString(10, d.getFromStopDepartTime()); pst.setString(11, d.getToStopPlatform()); pst.setString(12, d.getToStopArrivalTime()); pst.setString(13, d.getToStopDepartTime()); pst.setString(14, d.getDepartInOutIndicator()); pst.setString(15, d.getSingleCoupleCar()); pst.setDouble(16, d.getKm()); pst.setDouble(17, d.getTrips()); pst.addBatch(); } final int []count = pst.executeBatch(); System.out.println("number : " + count.length); //conn.commit(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } finally { if (null != pst) { try { pst.close(); if (null != conn && !conn.isClosed()) { conn.close(); } } catch (SQLException e) { e.printStackTrace(); } } } } }
2. 利用Java异常特性来校验日期格式,代码简洁,不错的功能...
/** * To check the date is valid or not * @param input * @return */ public static boolean isValidDate(final String input) { boolean isValid = false; final String formatString = "yyyy-MM-dd"; try { final SimpleDateFormat format = new SimpleDateFormat(formatString); format.setLenient(false); format.parse(input); isValid = true; } catch (ParseException e) { isValid = false; } catch (IllegalArgumentException e) { isValid = false; } return isValid; }
3. Java操作内存溢出几个案例...
/** * * outOfmemory * @param a * @param b * @return the void */ private static void outOfmemory(int a , int b) { //java.lang.StackOverflowError outOfmemory // outOfmemory(a*b, b); //java.lang.OutOfMemoryError: Java heap space List<String> str = new ArrayList<String>(0); int ab = 0; while(true) { //ab++; str.add("abc"); //Object obk = new Object(); } //java.lang.OutOfMemoryError: PermGen space // List<String> str = new ArrayList<String>(0); // int i = 0; // while(true) { // i++; // str.add(String.valueOf(i).intern()); // } }
4. 四舍五入处理方法...
/** * * jsfRound * @param a * @return the void */ private static void jsfRound(double a) { System.out.println("==0==" + a + "==" + String.format("%.2f", a)); //please attention ROUND_HALF_DOWN ROUND_HALF_UP System.out.println("==1==" + a + "===" + new BigDecimal(String.valueOf(a)).setScale(2, BigDecimal.ROUND_HALF_DOWN).doubleValue()); System.out.println("==2==" + a + "==" + new BigDecimal(String.valueOf(a)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); }
5. 处理集合中重复数据....
/** * * dealWithDuplicationObjArray * @return * @return the List<Object[]> */ private static List<Object[]> dealWithDuplicationObjArray() { final List<Object[]> listObj = new ArrayList<Object[]>(0); listObj.add(new Object[]{"20/10/2012","a","1 REV 4"}); listObj.add(new Object[]{"21/10/2012","b","1 REV 4"}); listObj.add(new Object[]{"22/10/2012","c","1 REV 4"}); listObj.add(new Object[]{"23/10/2012","d","1 REV 4"}); listObj.add(new Object[]{"23/10/2012","666","1 REV 3"}); final List<Object[]> retList = new ArrayList<Object[]>(0); final Map<Object, Object[]> map = new HashMap<Object, Object[]>(); for (Object[] objects : listObj) { map.put(objects[0], objects); } final Set<Entry<Object, Object[]>> set = map.entrySet(); for (Entry<Object, Object[]> entry : set) { retList.add(entry.getValue()); System.out.println("key = " + entry.getKey() + "=value=" + ((Object[])entry.getValue())[1] + "---" + ((Object[])entry.getValue())[2]); } return retList; }
处理重复集合元素另一方法,从已有集合元素中找出重复的元素:
/** * Find Collection duplicated elements,get duplicated elements * @param elements * @return Collection */ public static Collection<?> findCollectionDuplicateElements(final Collection<?> elements) { final Set<Object> set = new HashSet<Object>(); final Set<Object> retSet = new HashSet<Object>(); for (Object object : elements) { set.add(object); } if (elements.size() == set.size()) { return retSet; } else { for (Object object : set) { elements.remove(object); } } for (Object object : elements) { retSet.add(object); } return retSet; }
6. 反射找出javabean对象属性名以及对应值:
/** * * copyObjectToHashMap * @param object * @return * @throws Exception * @return the Map<?,?> */ public static Map<?,?> copyObjectToHashMap(final Object object) throws Exception { final Class clazz = object.getClass(); final Method[] methods = clazz.getDeclaredMethods(); final Map<String, Object> vo = new HashMap<String, Object>(); for (Method method : methods) { String methodName = method.getName(); String tempName = ""; if (methodName.startsWith("get")) { tempName = methodName.substring(3, 4).toLowerCase() + methodName.substring(4); final Object obj = method.invoke(object, (Object[]) method.getParameterTypes()); if (null != obj && !"".equals(obj)) { vo.put(tempName, obj); } } tempName = null; methodName = null; } return vo; }
7. 对于大数值的运算公式(任意整数使用BigInteger类,对于任意浮点数使用BigDecimal类)
private static final int DEF_DIV_SCALE = 10; public static BigDecimal add(BigDecimal v1, BigDecimal v2) { return v1.add(v2); } public static BigDecimal subtract(BigDecimal v1, BigDecimal v2) { return v1.subtract(v2); } public static BigDecimal multiply(BigDecimal v1, BigDecimal v2) { return v1.multiply(v2); } public static BigDecimal div(BigDecimal v1, BigDecimal v2) { return div(v1, v2, DEF_DIV_SCALE); } public static BigDecimal div(BigDecimal v1, BigDecimal v2, int scale) { if (scale < 0) { throw new IllegalArgumentException("The scale must be a positive integer or zero"); } return v1.divide(v2, scale, BigDecimal.ROUND_HALF_UP); } public static double round(double v, int scale) { if (scale < 0) { throw new IllegalArgumentException("The scale must be a positive integer or zero"); } BigDecimal b = new BigDecimal(Double.toString(v)); BigDecimal one = new BigDecimal("1"); return b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); } public static void main(String[] args) { BigDecimal a = new BigDecimal("123456789123"); BigDecimal b = new BigDecimal("987654321987"); System.out.println(add(a, b)); System.out.println(subtract(a, b)); System.out.println(div(a, b)); System.out.println(multiply(a, b)); }
8. 深度克隆方法(推荐数据流方法,或者自己重写必须要写最小的基本数据类型为止(难度大))
//深度克隆, 克隆对象必须实现 java.io.Serializable public final static Object objectCopy(Object oldObj) { Object newObj = null; ByteArrayOutputStream bo = null; ObjectOutputStream oo = null; ByteArrayInputStream bi = null; ObjectInputStream oi = null; try { bo = new ByteArrayOutputStream(); oo = new ObjectOutputStream(bo); oo.writeObject(oldObj);//源对象 bi = new ByteArrayInputStream(bo.toByteArray()); oi = new ObjectInputStream(bi); newObj = oi.readObject();//目标对象 } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } finally { try { bo.close(); oo.close(); bi.close(); bo.close(); } catch (IOException e) { e.printStackTrace(); } } return newObj; }
9,图形化校验一例
三种方式输出:流文件直接输出、base64(有些浏览器存在问题)、保存文件路径方式
后端
private static class GenerateVerifyPicture {
private static char pictureChars[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', '1', '2', '3', '4', '5', '6', '7', '8',
'9', '0' };
public static String getCertPic(int width, int height, OutputStream os) {
if (width <= 0)
width = 60;
if (height <= 0)
height = 20;
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
// Graphics2D g = image.createGraphics();
// 定义字体样式
Font myFont = new Font("黑体", Font.BOLD, 20);
// 获取图形上下文
Graphics g = image.getGraphics();
// 设定背景色
g.setColor(new Color(0xDCDCDC));
g.fillRect(0, 0, width, height);
// 画边框
g.setColor(Color.black);
g.setFont(myFont);
g.drawRect(0, 0, width - 1, height - 1);
// 取随机产生的认证码
StringBuffer strEnsure = new StringBuffer("");
for (int i = 0; i < 5; ++i) {
strEnsure.append(pictureChars[(int) (pictureChars.length * Math.random())]);
}
g.setColor(Color.black);
// g.setColor(getRandomFontColor());
g.setFont(new Font("Atlantic Inline", Font.PLAIN, 18));
String str = strEnsure.substring(0, 1);
g.drawString(str, 8, 17);
str = strEnsure.substring(1, 2);
g.drawString(str, 20, 15);
str = strEnsure.substring(2, 3);
g.drawString(str, 35, 18);
str = strEnsure.substring(3, 4);
g.drawString(str, 45, 15);
str = strEnsure.substring(4, 5);
g.drawString(str, 60, 17);
// 随机产生50个干扰点
Random rand = new Random();
for (int i = 0; i < 50; i++) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
g.drawOval(x, y, 1, 1);
//g.setColor(getRandomBgColor());
}
// 释放图形上下文
g.dispose();
String base64 = "";
Map<Object, Object> m = new LinkedHashMap<Object, Object>();
String uuid = StringUtil.getUUID();
try {
// 输出图像到页面
ImageIO.write(image, "jpg", os);
//os.flush();
} catch (IOException e) {
e.printStackTrace();
m.put("errorCode", -1);
return StringUtil.toJsonString(m);
}
m.put("picValue", base64);
m.put("picKey", uuid);
RedisAPI.setex(uuid, strEnsure.toString(), EXPIRE_TIME);
////do something database into database
System.out.println("picture base64 map=====uuid:\t" + uuid + "\tvalue:\t" + strEnsure.toString());
return StringUtil.toJsonString(m);
}
private static void generateImage(String uuid, byte[] imageInByte)
throws FileNotFoundException, IOException {
if (!AlipayConfig.IS_VERIFY_CODE) {//是否生成指定目录路径下面图片
FileOutputStream fos = new FileOutputStream("/data/image/"+uuid+".jpg");
fos.write(imageInByte, 0, imageInByte.length);
fos.flush();
fos.close();
}
}
public static String getCertPic(int width, int height) {
if (width <= 0)
width = 60;
if (height <= 0)
height = 20;
BufferedImage image = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
// Graphics2D g = image.createGraphics();
// 定义字体样式 // 设置字体
Font myFont = new Font("黑体", Font.BOLD, 20);
// 获取图形上下文
Graphics g = image.getGraphics();
// 设定背景色
g.setColor(new Color(0xDCDCDC));
g.fillRect(0, 0, width, height);
// 画边框
g.setColor(Color.black);
g.setFont(myFont);
g.drawRect(0, 0, width - 1, height - 1);
// 取随机产生的认证码
StringBuffer strEnsure = new StringBuffer("");
for (int i = 0; i < 5; ++i) {
strEnsure.append(pictureChars[(int) (pictureChars.length * Math.random())]);
}
g.setColor(Color.black);
// g.setColor(getRandomFontColor());
g.setFont(new Font("Atlantic Inline", Font.PLAIN, 18));
String str = strEnsure.substring(0, 1);
g.drawString(str, 8, 17);
str = strEnsure.substring(1, 2);
g.drawString(str, 20, 15);
str = strEnsure.substring(2, 3);
g.drawString(str, 35, 18);
str = strEnsure.substring(3, 4);
g.drawString(str, 45, 15);
str = strEnsure.substring(4, 5);
g.drawString(str, 60, 17);
// 随机产生50个干扰点
Random rand = new Random();
for (int i = 0; i < 50; i++) {
int x = rand.nextInt(width);
int y = rand.nextInt(height);
g.drawOval(x, y, 1, 1);
//g.setColor(getRandomBgColor());
}
// 释放图形上下文
g.dispose();
String base64 = "";
Map<Object, Object> m = new LinkedHashMap<Object, Object>();
String uuid = StringUtil.getUUID();
try {
// 输出图像到页面
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "JPEG", baos);
baos.flush();
// IOUtils
byte[] imageInByte = baos.toByteArray();
generateImage(uuid, imageInByte);
base64 = Base64.encodeBase64String(imageInByte);
//System.out.println("base64==============" + base64);
baos.close();
} catch (IOException e) {
e.printStackTrace();
m.put("errorCode", -1);
return StringUtil.toJsonString(m);
}
m.put("picValue", base64);
m.put("picKey", uuid);
RedisAPI.setex(uuid, strEnsure.toString(), EXPIRE_TIME);
////do something database into database
System.out.println("picture base64 map=====uuid:\t" + uuid + "\tvalue:\t" + strEnsure.toString());
return StringUtil.toJsonString(m);
}
@SuppressWarnings("unused")
private static Color getRandomFontColor() {
//Random random = new Random();
String [] cs = {"FF6347","FFA500","FF69B4","FF3030","FF0000","EE5C42","EE7AE9","E066FF","CD2626","CD0000","BF3EFF","8B1A1A","8B008B","7D26CD","3A5FCD","191970","303030","000000","1F1F1F","333333","4F4F4F"};
String color = cs[StringUtil.getRandomNum(cs.length)];
//r =
return Color.getColor(color);
}
@SuppressWarnings("unused")
private static Color getRandomBgColor() {
//Random random = new Random();
String [] cs = {"FFF5EE","F8F8FF","EEE8AA","E5E5E5","D4D4D4","CCCCCC","CAE1FF","D1EEEE","EE9A49","CD6889"};
String color = cs[StringUtil.getRandomNum(cs.length)];
//r =
return Color.getColor(color);
}
}
spring前端控制输出:
/*
* generate picture information
*/
@RequestMapping(value = "/generatePic.do")
public String generatePic(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception {
// 设置不缓存图片
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
response.setDateHeader("Expires", 0);
int width = 80;
int height = 25;
// try {
// width = Integer.parseInt(request.getParameter("width"));
// height = Integer.parseInt(request.getParameter("height"));
// } catch (Exception ex) {
// width = 80;
// height = 25;
// ex.printStackTrace();
// }
String base64 = "";
try {
base64 = purchaseOrderService.generatePictureCode(width, height);
model.put("message", base64);
} catch (Exception ex) {
Map<Object, Object> m = new LinkedHashMap<Object, Object>();
m.put("errorCode", -1);
model.put("message", StringUtil.toJsonString(m));
// ex.printStackTrace();
}
return "message.json";
}
/*
* generate picture information
*/
@RequestMapping(value = "/generatePic2.do")
public String generatePic2(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception {
// 设置不缓存图片
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
response.setDateHeader("Expires", 0);
int width = 80;
int height = 25;
// try {
// width = Integer.parseInt(request.getParameter("width"));
// height = Integer.parseInt(request.getParameter("height"));
// } catch (Exception ex) {
// width = 80;
// height = 25;
// ex.printStackTrace();
// }
String base64 = "";
try {
base64 = purchaseOrderService.generatePictureCode(width, height, response.getOutputStream());
model.put("message", base64);
} catch (Exception ex) {
Map<Object, Object> m = new LinkedHashMap<Object, Object>();
m.put("errorCode", -1);
model.put("message", StringUtil.toJsonString(m));
// ex.printStackTrace();
}
return "message.json";
}
//前端获取图片
<%@ page contentType="text/html;charset=GB2312" %>
<script type="text/javascript">
function reloadcode(){
var verify=document.getElementById('code');
verify.setAttribute('src','../generatePic2.do?it='+Math.random());
}
</script>
<html>
<head><title>Picture check code</title></head>
<body>
<table align="center" border="0">
<tralign="center"><td><fontcolor="red"><html:errors/></font></td></tr>
<form. action="#" method="post" >
<tr><td><img src="../generatePic2.do" id="code" > <input type="text" name="strEnsure" value=""/></td></</td></tr>
<br/>
<tr><td><img src="data:image/jpeg;base64,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" id="code" > <input type="text" name="strEnsure" value=""/></td></</td></tr>
<tr><td><input type="button" onclick="reloadcode()" value="看不清楚,换一张" style="cursor: pointer;"/> </td></tr>
<tralign="left"><td>
<!-- <input type="submit" value="确定"/></td></tr> -->
</form>
</table>
</body>
</html>
效果如图:
相关推荐
JAVA手机记事本,是很好用的JAVA手机记事本,VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV。经验证,金立手机L18可用。JAVA手机记事本,是很好用的JAVA手机记事本,...
在Java记事本中,Swing的JFrame类被用作主窗口,而其他组件如JMenuBar、JMenuItem、JLabel、JTextField等则用于构建菜单栏、下拉菜单、输入框等元素。 定时保存功能是这个记事本的一大亮点。它使用了Java的定时任务...
java记事本java记事本java记事本java记事本java记事本java记事本java记事本
【JAVA记事本实现详解】 在Java编程领域,创建一个简单的记事本程序是一个常见的学习项目,它可以帮助初学者理解GUI(图形用户界面)编程、事件处理和文件操作等核心概念。下面我们将深入探讨如何使用Java来实现...
Java制作记事本 Java制作记事本 Java制作记事本 Java制作记事本Java制作记事本 Java制作记事本
java_记事本的设计与实现报告.pdf
JAVA简单记事本程序设计实验报告是一份详细记录了如何使用Java编程语言开发一个简易记事本应用程序的文档。这个程序旨在实现基本的文本编辑功能,包括文件操作(新建、打开、保存、退出)和编辑操作(剪切、拷贝、...
【标题】"java记事本 源代码"所涉及的知识点主要集中在Java编程语言、图形用户界面(GUI)设计以及文件操作上。这个项目利用Java的Swing库来构建一个类似于Windows记事本的应用程序,它实现了文本编辑的基础功能。 ...
《Java实现带记事本功能的日历应用》 在信息技术领域,Java作为一种广泛使用的编程语言,因其跨平台、面向对象的特性,常被用于开发各种应用程序。本项目以"Java带记事本日历"为主题,旨在探讨如何利用Java技术构建...
这款记事本软件不仅具备基本的文字编辑功能,如新建、打开、保存、复制、粘贴、剪切等,还具有一定的定制性和美观性,使得日常的文本记录工作更加得心应手。 Java是一种广泛使用的编程语言,以其“一次编写,到处...
基于Java语言的记事本代码,基于Java语言的记事本代码
这个Java记事本程序可能包括了基本的文本编辑功能,如新建、打开、保存文件,以及文字的复制、粘贴、剪切、撤销、重做等操作。然而,由于描述中提到的“功能不是很全”,它可能缺乏一些进阶特性,比如查找和替换功能...
10. **程序打包与发布**:最后,为了让用户能够方便地运行这个Java记事本,我们需要将其打包成可执行的JAR文件,这可以通过Java的`jar`命令或使用IDE如Eclipse、IntelliJ IDEA的内置功能来完成。 以上就是实现一个...
【标题】"java日历记事本程序"是一款基于Java编程语言开发的应用程序,它集成了日历、记事本、课程表以及计时提醒等多种功能。这个项目使用了NetBeans IDE进行开发,使得代码组织和工程管理更为便捷。NetBeans是Java...
Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本Java SE程序 记事本...
Java记事本是一款基于Java编程语言开发的文本编辑器,其功能与系统自带的记事本应用程序相似。作为一款轻量级的文本编辑工具,它允许用户创建、查看和编辑纯文本文件,对于程序员和日常用户来说,是进行简单文本处理...
在Java编程领域,开发一个简单的记事本程序是一项常见的练习,它可以帮助初学者理解GUI(图形用户界面)设计、事件处理以及文本操作等基础知识。在这个名为"Java简单记事本程序"的项目中,我们将探讨如何利用Java ...
关于记事本的编辑,里面有查找替换,字体,颜色。不过对于对齐方式自己设计的不怎么行
java swing 记事本java swing 记事本java swing 记事本
java jframe actionlister file java制作记事本实现文件的打开保存,关闭,复制粘贴剪切等功能