albertshaw 8 lat temu
rodzic
commit
bfdb4cb18c

+ 0 - 15
schema/20170901 -member_order.sql

@@ -1,15 +0,0 @@
-CREATE TABLE `member_order` (
-  `id` bigint(19) NOT NULL,
-  `menber_type` int(11) NOT NULL COMMENT '付费会员类型',
-  `price` double(10,2) NOT NULL COMMENT '价格',
-  `valid_month` int(11) NOT NULL COMMENT '会员月类型',
-  `order_state` int(11) NOT NULL COMMENT '付款状态  0:未付款 1:已付款',
-  `order_time` datetime NOT NULL COMMENT '下单时间',
-  `user_id` varchar(36) NOT NULL COMMENT '用户ID 外键',
-  `payment_time` datetime DEFAULT NULL COMMENT '支付时间',
-  `payment_value` double(10,2) DEFAULT NULL COMMENT '实际支付金额',
-  `payment_type` varchar(16) DEFAULT NULL COMMENT '支付方式',
-  `payment_id` varchar(45) DEFAULT NULL COMMENT '支付流水号',
-  `valid_time` datetime DEFAULT NULL COMMENT '有效时间',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8

+ 15 - 0
schema/20170901-member_order.sql

@@ -0,0 +1,15 @@
+CREATE TABLE `member_order` (
+  `id` bigint(19) NOT NULL,
+  `menber_type` int(11) NOT NULL COMMENT '付费会员类型',
+  `price` double(10,2) NOT NULL COMMENT '价格',
+  `valid_month` int(11) NOT NULL COMMENT '会员月类型',
+  `order_state` int(11) NOT NULL COMMENT '付款状态  0:未付款 1:已付款',
+  `order_time` datetime NOT NULL COMMENT '下单时间',
+  `user_id` varchar(36) NOT NULL COMMENT '用户ID 外键',
+  `payment_time` datetime DEFAULT NULL COMMENT '支付时间',
+  `payment_value` double(10,2) DEFAULT NULL COMMENT '实际支付金额',
+  `payment_type` varchar(16) DEFAULT NULL COMMENT '支付方式',
+  `payment_id` varchar(45) DEFAULT NULL COMMENT '支付流水号',
+  `valid_time` datetime DEFAULT NULL COMMENT '有效时间',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;

+ 8 - 18
src/main/java/com/goafanti/memberGrade/controller/MemberGradeController.java

@@ -1,11 +1,7 @@
 package com.goafanti.memberGrade.controller;
 
-import java.text.DateFormat;
 import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -18,8 +14,11 @@ import org.springframework.web.bind.annotation.RestController;
 import com.alibaba.fastjson.JSON;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.model.MemberOrder;
+import com.goafanti.common.utils.DateUtils;
+import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.memberGrade.bo.MemberGrade;
 import com.goafanti.memberGrade.bo.MemberGradeBO;
@@ -104,7 +103,6 @@ public class MemberGradeController extends BaseApiController {
 			Integer orderState, String startTime, String endTime) {
 		Integer pNo = 1;
 		Integer pSize = 10;
-		String da = null;
 		if (StringUtils.isNumeric(pageSize)) {
 			pSize = Integer.parseInt(pageSize);
 		}
@@ -120,20 +118,12 @@ public class MemberGradeController extends BaseApiController {
 		map.put("nickname", nickname);
 		map.put("orderState", orderState);
 		map.put("startTimes", startTime);
-		if (endTime != null) {
-			DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
-			try {
-				Date date = df.parse(endTime);
-				Calendar calendar = Calendar.getInstance();
-				calendar.setTime(date);
-				calendar.add(Calendar.DAY_OF_MONTH, 1);
-				da = df.format(calendar.getTime());
-			} catch (ParseException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
+		try {
+			map.put("endTimes", DateUtils.addDays(DateUtils.parseDate(endTime, AFTConstants.YYYYMMDD), 1));
+		} catch (ParseException e) {
+			LoggerUtils.error(this.getClass(), "ffff", e);
 		}
-		map.put("endTimes", da);
+
 		List<MemberOrder> list = memberGradeService.selectMemberOrderBa(map);
 		int countWhere = memberGradeService.countMemberOrderWhere(map);
 		Map<String, Object> maps = new HashMap<>();