Long型070000L前面0去掉比较大小,token,mysql innodb,properties,switch匹配空字符串对象
- public class TestJava {
- //定义获取资源文件
- private static final ResourceBundle bundle = initBundle();
- private static ResourceBundle initBundle(){
- return ResourceBundle.getBundle("conf/chinapay", Locale.CHINA);
- }
- //键值对
- private final static String MERID_UPOP_TEST = bundle.getString("merid.upop.test");
- /**
- * @param args
- */
- public static void main(String[] args) {
- // Long reqTime = 20150227233132L; //
- Long reqTimeAllowMin = 070000L; //
- Long reqTimeAllowMax = 220000L; //
- Long reqTime = null;
- if(reqTime != null && (reqTime % 1000000 >= reqTimeAllowMin && reqTime % 1000000 <= reqTimeAllowMax) ){
- System.out.println("OK");
- }else{
- System.out.println("NO"); //NO
- }
- // try {
- System.out.println(20150227103132L % 1000000); //
- System.out.println(20150227143453L % 1000000); //
- System.out.println(20150227171104L % 1000000); //
- System.out.println(20150302153222L % 1000000); //153222
- // CommonConstants.TIME_SEC_STR.format("070000");
- // Date dd = CommonConstants.DATETIME_SEC_STR.parse(reqTime.toString());
- // CommonConstants.TIME_SEC_STR.format(obj)
- // } catch (ParseException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // } //转换成日期
- //1.生成token值方法
- System.out.println("TOKEN=" + java.util.UUID.randomUUID().toString()); //TOKEN=572061ad-522f-4cc4-8484-aab5f9e44120
- System.out.println("TOKEN2=" + java.util.UUID.randomUUID().toString().replace("-", "")); //TOKEN2=f858b55617c6421bbbc90a66747c62ea
- //2.Long值比较大小
- /** 允许自动语音和15分钟自动拒绝订单开始的时间点*/
- Long REQTIME_ALLOW_MIN = 070000L; // 7前面这个0需要去掉。
- /** 允许自动语音和15分钟自动拒绝订单结束的时间点*/
- Long REQTIME_ALLOW_MAX = 220000L; //
- // Long currTime = Long.valueOf(CommonConstants.DATETIME_SEC_STR.format(new Date()));
- Long currTime = 20150319050809L;
- System.out.println("currTime="+currTime); //currTime=20150319050809
- System.out.println("获取时分秒="+currTime % 1000000); //获取时分秒=50809
- System.out.println("是否大于7点="+(currTime % 1000000 >= REQTIME_ALLOW_MIN)); //是否大于7点=true,这个比较值错误!!??
- System.out.println("是否小于22点="+(currTime % 1000000 <= REQTIME_ALLOW_MAX)); //是否小于22点=true
- /*
- * 拨打语音功能点:1.支付订金成功时,语音通知。(车主同意或拒绝订单)
- * 2.发起延时申请成功,语音通知。(车主同意或拒绝延时申请)
- * 3.取车前2小时,未支付租车押金或违章押金,语音通知。(租客支付租车押金和违章押金)
- * 4.还车前2小时,语音通知。(租客还车)
- */
- //050809 这个时间应该是不打电话的。 05:08:09
- if(currTime != null && (currTime % 1000000 >= REQTIME_ALLOW_MIN && currTime % 1000000 <= REQTIME_ALLOW_MAX) ){
- System.out.println("拨打语音电话通知!"); //拨打语音电话通知!
- }else{
- System.out.println("夜间10点到第二天早上7点防打扰功能,语音电话屏蔽。");
- }
- // Long atest = 050809L;
- // Long REQTIME_ALLOW_MIN = 070000L; //后面4位都是0可以
- // System.out.println("@@@"+(050809l > 70000l)); //编译通不过。??!!
- System.out.println("@@@"+(50809l > 70000l)); //@@@false
- System.out.println("@@@"+(50809l > 070000l)); //@@@true 错误!!
- /**
- * 3.mysql事务
- * InnoDB,MyIsam
- * mysql5.6事务支持操作多个表的InnoDB表类型,不允许同时操作InnoDB和MyIsam表。
- */
- //4.获取proerties文件,注意点:properties文件中不允许有"" 空格 逗号等。
- //merid.upop.test=808080031312345
- System.out.println("打印输出properties文件key值:" + MERID_UPOP_TEST);
- //打印输出properties文件key值:808080031394973
- //5.判断条件及switch匹配string字符串。
- System.out.println("5.判断条件及switch匹配string字符串");
- String rentReason = null; //判断租车理由,这个条件返回的是 1111111111
- // if(rentReason != null){ //如果没有这个条件判断,会报空指针异常。
- switch (rentReason) { //java.lang.NullPointerException
- case "周边旅游":
- System.out.println("11111");
- break;
- case "外地出差":
- System.out.println("22222");
- break;
- default:
- System.out.println("33333"); //
- break;
- }
- // }else{
- // System.out.println("33333");
- // }
- //下面这样的写法是正确的。
- String rentReason2 = "周边旅游"; //判断租车理由 "" null
- if("周边旅游".equals(rentReason2)){
- System.out.println("aaaaaa"); //aaaaaa
- }else if("外地出差".equals(rentReason2)){
- System.out.println("bbbbbb");
- }else {
- System.out.println("cccccc");
- }
- String rs = null;
- // System.out.println(rs.equals("周边旅游")); //null对象调equals会报错 //java.lang.NullPointerException
- System.out.println("周边旅游".equals(rs)); //这样不会报错,返回false。 false
- }
- }
Long型070000L前面0去掉比较大小,token,mysql innodb,properties,switch匹配空字符串对象的更多相关文章
- Javascript 中的false、0、null、undefined和空字符串对象
在Javascript中,我们经常会接触到题目中提到的这5个比较特别的对象——false.0.空字符串.null和undefined.这几个对象很容易用错,因此在使用时必须得小心. 类型检测 我们下来 ...
- WINCE6.0去掉桌面快捷方式
WINCE6.0去掉桌面快捷方式,主要是修改xxx.bat文件,比如我要去掉My Documents和Media Player的快捷方式. (1) 去掉My Documents桌面快捷方式 找到 ...
- sqlserver把小数点后面多余的0去掉
Sql中想把小数点后多余的0去掉,怎么办? select 5000/10000.0 --想变成0.5select 5500/10000.0 --想变成0.55select 5550/10000.0 - ...
- 如果不空null并且不是空字符串才去修改这个值,但这样写只能针对字符串(String)类型,如果是Integer类型的话就会有问题了。 int i = 0; i!=''。 mybatis中会返回tr
mybatis 参数为Integer型数据并赋值0时,有这样一个问题: mybatis.xml中有if判断条件判断参数不为空时,赋值为0的Integer参数被mybatis判断为空,因此不执行< ...
- mytatis将Integer等于0识别成空字符串
在进行myBatis条件查询的时候,会有如下操作: <if test="delFlag !=null and delFlag != ''"> and t.del_fla ...
- 弱类型语言中的0和空字符串(''或"")以及字符串'0'
在弱类型语言(js/PHP)中, 当我们用==判断0和'0'以及空字符串(''或"")是否相等的时候, 返回的是true. 而且在PHP中, 当我们用==判断0和null是否相等的 ...
- 【Linux】【MySQL】CentOS7安装最新版MySQL8.0.13(最新版MySQL从安装到运行)
1.前言 框框博客在线报时:2018-11-07 19:31:06 当前MySQL最新版本:8.0.13 (听说比5.7快2倍) 官方之前表示:MySQL 8.0 正式版 8.0.11 已发布,MyS ...
- mybatis将传入的Integer类型的0被识别成空字符串的问题
更改mapper文件的sql如下: <if test="interger != null"> interger= #{interger} </if> 原因: ...
- Jquery取小数后边2位,N位;jQuery去掉字符串首尾空字符串
function fix(num, N) { , N); return Math.round(num * base) / base; } 实例,取小数后边两位 var yhmoney2 = fix(1 ...
随机推荐
- StyleCop学习笔记——默认的规则
在StyleCop中有一些官方自己写好的检测规则下面就是英文的解释 文档规则 1.SA1600:ElementsMustBeDocumented元素必须添加注释 2.SA1601: PartialEl ...
- 分享我常用的一些JS验证和函数
下面是我常用一些JS验证和函数,有一些验证我直接写到了对象的属性里面了,可以直接通过对象.方法来调用//浮点数除法运算 function fdiv(a, b, n) { if (n == undefi ...
- hdu 1277 全文检索
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1277 全文检索 Description 我们大家经常用google检索信息,但是检索信息的程序是很困难 ...
- android EditText获取光标位置并安插字符删除字符
android EditText获取光标位置并插入字符删除字符1.获取光标位置int index = editText.getSelectionStart(); 2.在光标处插入字符int index ...
- IOS中的UINavigationController(导航控制器)
UINavigationController UINavigationControlle:导航控制器,是iOS中最常用的多视图控制器之一,它用来管理多个试图控制器 导航控制器可以认为是管理控制器的控制 ...
- mif_maker2010.exe下载和使用说明
mif_malker2010.exe下载地址:http://pan.baidu.com/s/1bCqAp4 使用说明:http://www.cnblogs.com/BitArt/archive/201 ...
- JAVA标签的使用跳出循环
public static void main(String args[]) { int i=10,j=10; outer: while (i > 0) { inner: while (j &g ...
- ibatis查找date类型
ibatis从oracle查询的时候,返回的类型是java.sql.Date,这个类型是不带时分秒的,我们只有在写sql的时候用to_char来转换.
- 程序开发心理学阅读笔记——第I篇
1.软件的任务是为了解决某一特定的问题,而软件开发者的任务却需要解决一系列问题.2.温伯格说,我们不能要求每个人都聪明异常,能够解决所有难题:但是我们必须持续思考,因为只有如此,我们才能明白自己在做什 ...
- 【每日scrum】NO.7
Yesterday:学习和设计路线的编程 Today:编写代码 Problem:.在设计查询参观路线的时候,整个逻辑特别的混乱,设想了各种树,图以及网的遍历问题,但经过多次与同学的交流以及网上的查询资 ...