From ef3cd5d822d936705ff00d9dfb0ba4b1ca7b246a Mon Sep 17 00:00:00 2001
From: luoyang14z7 <704328506@qq.com>
Date: Thu, 12 Jul 2018 19:27:14 +0800
Subject: [PATCH 1/2] fix : ActChairty
---
.../payment/manage/mappers/act/ActChairtyMapper.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
index dcf7d88f4..a958486dd 100644
--- a/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
+++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/act/ActChairtyMapper.xml
@@ -2,16 +2,16 @@
\ No newline at end of file
From b182cb794bae11ebe1a7def083885dfa274426e0 Mon Sep 17 00:00:00 2001
From: luoyang14z7 <704328506@qq.com>
Date: Fri, 13 Jul 2018 13:06:50 +0800
Subject: [PATCH 2/2] fix : ActChairty
---
.../core/impls/ActChairtyServiceImp.java | 88 +++++++++----------
1 file changed, 43 insertions(+), 45 deletions(-)
diff --git a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
index b7d86ffbf..494d041c8 100644
--- a/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
+++ b/src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
@@ -10,6 +10,9 @@ import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import org.apache.commons.lang3.time.DateFormatUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -26,7 +29,7 @@ import java.util.List;
*/
@Service
public class ActChairtyServiceImp implements ActChairtyService {
-
+ Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private ClientManager clientManager;
@Resource
@@ -64,54 +67,49 @@ public class ActChairtyServiceImp implements ActChairtyService {
public List getWeekendAnalysis(JSONObject params) {
List result = new ArrayList<>();
List getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end"));
- SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
- Calendar cal = Calendar.getInstance();
- cal.setTime(params.getDate("begin"));
- cal.add(cal.DAY_OF_MONTH, -1);
- long beginTime = params.getDate("begin").getTime();
- long endTime = params.getDate("end").getTime();
- long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24));
- List weekStart = new ArrayList();
- for(int i=0;i<=betweenDays;i++){
- cal.add(cal.DAY_OF_MONTH, 1);//DATE=日
- if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) {
- weekStart.add(df.format(cal.getTime()));
- }
+ DateFormatUtils df = new DateFormatUtils();
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(params.getDate("begin"));
+ cal.add(cal.DAY_OF_MONTH, -1);
+ long beginTime = params.getDate("begin").getTime();
+ long endTime = params.getDate("end").getTime();
+ long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24));
+ List weekStart = new ArrayList<>();
+ for(int i=0;i<=betweenDays;i++){
+ cal.add(cal.DAY_OF_MONTH, 1);//DATE=日
+ if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) {
+ weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd"));
}
- for(int i=0;i= dateStar.getTime() && orderDate < dateEnd.getTime()) {
- count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum"));
- sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum"));
- }
+ }
+ for(int i=0;i= dateStar.getTime() && orderDate < dateEnd.getTime()) {
+ count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum"));
+ sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum"));
}
- BigDecimal chairty = new BigDecimal(0.01);
- BigDecimal chairty_amount = count_ordernum.multiply(chairty);
- double f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
- double f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
-
- weekDay.put("weekstart", weekStart.get(i));
- weekDay.put("count_ordernum", count_ordernum);
- weekDay.put("sum_ordernum", f1);
- weekDay.put("chairty_amount",f2 );
- result.add(weekDay);
- } catch (Exception e) {
- e.printStackTrace();
-
}
+ BigDecimal chairty = new BigDecimal(0.01);
+ BigDecimal chairty_amount = count_ordernum.multiply(chairty);
+ BigDecimal f1 = sum_ordernum.setScale(2, BigDecimal.ROUND_HALF_UP);
+ BigDecimal f2 = chairty_amount.setScale(2, BigDecimal.ROUND_HALF_UP);
+ weekDay.put("weekstart", weekStart.get(i));
+ weekDay.put("count_ordernum", count_ordernum);
+ weekDay.put("sum_ordernum", f1);
+ weekDay.put("chairty_amount",f2 );
+ result.add(weekDay);
+ } catch (Exception e) {
+ logger.info("Act_Chairty Error:",e);
+
}
+ }
return result;
}