java
文章平均质量分 92
weixin_40650583
这个作者很懒,什么都没留下…
展开
-
求两个时间相隔的天数
public class Test { public static void main(String[] args) throws Exception { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); String time1="2019-01-31 00:00:01"; Stri...原创 2019-01-07 15:08:42 · 120 阅读 · 0 评论 -
sql实现--根据不同类型的时间戳按24小时每小时统计数据,并补齐数据和取整
两种不同的时间戳转换成24小时第一种:1546308369067(标准时间戳)FROM_UNIXTIME(C.RECHARGE_TIME/1000,’%H’) AS DATE_NO第二种:20181205193346(自定义时间戳)SUBSTR(W.BUYCOIN_TIME,9,2) AS DATE_NO补齐24小时没有数据的小时(永远24条数据)//一天24小时消费时段分析曲线L...原创 2019-01-07 15:02:36 · 4300 阅读 · 0 评论 -
请求返回String不为null并且是请求成功result=1的情况做判断
String strRes4DeviceCount = new HTTPHandler().httpPostJson if(!LString.isNull(strRes4DeviceCount)) { JSONObject jsonRes4DeviceCount = JSONObject.fromObject(strRes4DeviceCount); if(jsonRes4Devic...原创 2018-12-05 14:17:53 · 403 阅读 · 0 评论 -
将一个自组装list数据放入对象List
List<DeviceVO> devices = fanAwardMapper.getDevices(param); if (devices==null||devices.size()<=0||devices.get(0) == null) { List<DevciesVO> devciesVo = param.getDevciesVO(); Arra...原创 2018-12-05 10:24:35 · 855 阅读 · 0 评论 -
JSONObject获取JSONArray转JSONObject获取某个属性值
String httpPost4Instream = http.httpPost4InstreamJSONObject jsonbject = JSONObject.fromObject(httpPost4Instream);JSONArray jsonArray = jsonbject.getJSONArray("stores");String string = jsonArray.get...原创 2018-12-05 10:20:43 · 10669 阅读 · 1 评论 -
JSON获取JSONArray转java--list
String httpPost4Instream1 = http1.httpPost4InstreamJSONObject jsonbject1 = JSONObject.fromObject(httpPost4Instream1);JSONArray jsonArray1 = jsonbject1.getJSONArray("models");@SuppressWarnings("all"...原创 2018-12-05 10:17:30 · 910 阅读 · 0 评论 -
Collections常用方法
public class CollectionsTest { public static void main(String[] args) {List list = new ArrayList();list.add(34);list.add(55); list.add(56);list.add(89);list.add(12); list.add(23);list.add(12...翻译 2018-12-03 10:27:16 · 154 阅读 · 0 评论 -
根据已有条件查询—-补齐数据--并且排序
Map<String, String> stores,Set<String> storeIds = stores.keySet(); for (String integer : storeIds) { query.getStoreIds().add(Integer.parseInt(integer)); }Map<String, String>...原创 2018-12-03 10:24:38 · 362 阅读 · 1 评论 -
按结束日期往前推30天,12个周,12个月获取数据,补齐缺失的数据
public List<Integer> getThirtyDates() { List<Integer> weeks = new ArrayList<Integer>(); long endTime = LDateTime.getTime(LDateTime.FORMAT_YYYYMMDD, this.toDate.toString()); for...原创 2018-12-03 10:19:35 · 3200 阅读 · 0 评论 -
获取某个日期是所属周的第几天
//获取某个日期是所属周的第几天 int date = 20190107; Integer fristWeekDay = LDateTime.getFristWeekDay(date); System.out.println(date-fristWeekDay+1);// 得到当前周的第一天 public static Integer getFristWeekDay(int da...原创 2019-01-07 15:24:27 · 790 阅读 · 1 评论 -
将字符串分解为数组
public class StringDemo { public static void main(String[] args) { String str = &quot;老王,小宋,小白,小陈&quot;; String[] split = str.split(&quot;,&quot;); for (String string : split) { System.err.println(string);原创 2019-01-07 15:50:46 · 408 阅读 · 0 评论 -
ssm框架get请求写法
@RequestMapping(value = "/123", method=RequestMethod.GET) @SuppressWarnings("all") private Object excleUserRecordsget(Integer userId,Integer startDate,Integer endDate, HttpServletReque...原创 2019-07-04 17:58:07 · 1075 阅读 · 0 评论 -
导出excel多个sheet
设置导出文件名,设置编码格式String fileName = "用户【"+userId+"】记录";//工具类ExportExcelUtils exportExcelUtils = new ExportExcelUtils();response.setContentType("application/binary;charset=UTF-8");ServletOutputStream ...原创 2019-07-04 17:52:09 · 1287 阅读 · 0 评论 -
多个List对象去重合并
public static void main(String[] args) { ArrayList<Student> list1 = new ArrayList<Student>(); Student student = new Student(); student.setId(1); student.setName("小王"); student.s...原创 2019-05-16 14:19:59 · 2769 阅读 · 0 评论 -
多个List去重合并
public class DedList { public static void main(String[] args) { List<Integer> l1 = new ArrayList<Integer>(); l1.add(20190101); l1.add(20190102); l1.add(20190103); List<In...原创 2019-05-15 16:08:47 · 1897 阅读 · 0 评论 -
map通过Key获取Value值
List&lt;Student&gt; arrayList = new ArrayList&lt;Student&gt;(); for (int i = 1; i &lt; 5; i++) { Student student = new Student(); student.setId(i); arrayList.add(student); } System.err....原创 2019-01-07 18:01:00 · 29577 阅读 · 2 评论 -
获取JSONObject中的某个属性的方法
原数据{“result”:1,“stores”:[{“storeId”:86,“startDate”:20181024,“endDate”:20181108}],“errormsg”:“处理成功”}JSONObject jsonbject = JSONObject.fromObject(httpPost4Instream);net.sf.json.JSONArray jsonArray = ...原创 2018-12-04 14:54:24 · 11866 阅读 · 1 评论