Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	src/main/java/au/com/royalpay/payment/manage/actchairty/core/impls/ActChairtyServiceImp.java
master
eason 6 years ago
commit fdea0b3d8d

@ -17,6 +17,8 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -66,48 +68,48 @@ public class ActChairtyServiceImp implements ActChairtyService {
List<JSONObject> result = new ArrayList<>(); List<JSONObject> result = new ArrayList<>();
List<JSONObject> getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end")); List<JSONObject> getAnalysis = actChairtyMapper.getChairtyWeekAnalysis(params.getDate("begin"), params.getDate("end"));
DateFormatUtils df = new DateFormatUtils(); DateFormatUtils df = new DateFormatUtils();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(params.getDate("begin")); cal.setTime(params.getDate("begin"));
cal.add(cal.DAY_OF_MONTH, -1); cal.add(cal.DAY_OF_MONTH, -1);
long beginTime = params.getDate("begin").getTime(); long beginTime = params.getDate("begin").getTime();
long endTime = params.getDate("end").getTime(); long endTime = params.getDate("end").getTime();
long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24)); long betweenDays = (long)((endTime - beginTime) / (1000 * 60 * 60 *24));
List<String> weekStart = new ArrayList<>(); List<String> weekStart = new ArrayList<>();
for(int i=0;i<=betweenDays;i++){ for(int i=0;i<=betweenDays;i++){
cal.add(cal.DAY_OF_MONTH, 1);//DATE=日 cal.add(cal.DAY_OF_MONTH, 1);//DATE=日
if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) { if ((cal.get(Calendar.DAY_OF_WEEK)) == 2) {
weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd")); weekStart.add(df.format(cal.getTime(),"yyyy-MM-dd"));
}
} }
for(int i=0;i<weekStart.size();i++){ }
JSONObject weekDay = new JSONObject(); for(int i=0;i<weekStart.size();i++){
BigDecimal count_ordernum = new BigDecimal(0); JSONObject weekDay = new JSONObject();
BigDecimal sum_ordernum = new BigDecimal(0); BigDecimal count_ordernum = new BigDecimal(0);
String weekS = weekStart.get(i); BigDecimal sum_ordernum = new BigDecimal(0);
try { String weekS = weekStart.get(i);
Date dateStar = DateUtils.parseDate(weekS,"yyyy-MM-dd"); try {
Date dateEnd = DateUtils.addDays(dateStar, 7); Date dateStar = DateUtils.parseDate(weekS,"yyyy-MM-dd");
for (int b = 0; b < getAnalysis.size(); b++) { Date dateEnd = DateUtils.addDays(dateStar, 7);
long orderDate = getAnalysis.get(b).getDate("orderdate").getTime(); for (int b = 0; b < getAnalysis.size(); b++) {
if (orderDate >= dateStar.getTime() && orderDate < dateEnd.getTime()) { long orderDate = getAnalysis.get(b).getDate("orderdate").getTime();
count_ordernum = count_ordernum.add(getAnalysis.get(b).getBigDecimal("count_ordernum")); if (orderDate >= dateStar.getTime() && orderDate < dateEnd.getTime()) {
sum_ordernum = sum_ordernum.add(getAnalysis.get(b).getBigDecimal("sum_ordernum")); 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);
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);
} }
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; return result;
} }

@ -2,8 +2,6 @@ package au.com.royalpay.payment.manage.customers.web;
import au.com.royalpay.payment.manage.customers.core.EncourageService; import au.com.royalpay.payment.manage.customers.core.EncourageService;
import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.CommonConsts;
import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;

@ -6,7 +6,7 @@
from act_charity from act_charity
left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id left JOIN pmt_transactions on act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=act_charity.active_time
and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
and pmt_transactions.channel != 'Settlement' and pmt_transactions.channel != 'Settlement'
GROUP BY act_charity.client_id order by count_ordernum desc GROUP BY act_charity.client_id order by count_ordernum desc
</select> </select>
@ -14,6 +14,7 @@
select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id select count(DISTINCT order_id) as count_ordernum,date_format(pmt_transactions.transaction_time,'%Y-%m-%d') as orderdate,client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity inner JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time>=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
and pmt_transactions.channel != 'Settlement' and pmt_transactions.channel != 'Settlement'
and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d') group by date_format(pmt_transactions.transaction_time,'%Y-%m-%d')
</select> </select>
@ -21,6 +22,7 @@
<select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject"> <select id="getChairtyWeekRaking" resultType="com.alibaba.fastjson.JSONObject">
select count(DISTINCT pmt_transactions.order_id) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id select count(DISTINCT pmt_transactions.order_id) *0.01 as chair_ordernum,act_charity.client_moniker,ifnull(sum(pmt_transactions.clearing_amount),0) as sum_ordernum from act_charity left JOIN pmt_transactions ON act_charity.client_id = pmt_transactions.client_id
and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time and pmt_transactions.transaction_type='Credit' and pmt_transactions.transaction_time&gt;=#{begin} and pmt_transactions.transaction_time&lt;=#{end} and pmt_transactions.transaction_time>=act_charity.active_time
and pmt_transactions.transaction_time&lt;'2018-09-01' and pmt_transactions.transaction_time>='2018-07-09'
GROUP BY act_charity.client_moniker order by chair_ordernum desc GROUP BY act_charity.client_moniker order by chair_ordernum desc
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save