|
|
|
@ -1,27 +1,5 @@
|
|
|
|
|
package au.com.royalpay.payment.manage.bdprize.core.impls;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.GregorianCalendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.joda.time.DateTime;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper;
|
|
|
|
|
import au.com.royalpay.payment.manage.bdprize.core.BDPrizeService;
|
|
|
|
|
import au.com.royalpay.payment.manage.bdprize.support.BDPrizeCalculator;
|
|
|
|
@ -43,6 +21,28 @@ import au.com.royalpay.payment.tools.lock.Locker;
|
|
|
|
|
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
|
|
|
|
|
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.Order;
|
|
|
|
|
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
import org.joda.time.DateTime;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.GregorianCalendar;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by yixian on 2017-02-07.
|
|
|
|
|
*/
|
|
|
|
@ -110,6 +110,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
|
|
|
|
|
record.put("create_time", new Date());
|
|
|
|
|
record.put("month", month);
|
|
|
|
|
financialBDPrizeRecordMapper.save(record);
|
|
|
|
|
|
|
|
|
|
for (String channel : channels) {
|
|
|
|
|
List<JSONObject> trades = transactionMapper.listTransactionsForBDPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1, channel);
|
|
|
|
|
List<Integer> clientsWithBDAway = clientBDMapper.clientsWithBDAway();
|
|
|
|
@ -134,7 +135,7 @@ public class BDPrizeServiceImpl implements BDPrizeService {
|
|
|
|
|
//BD Leader Prize
|
|
|
|
|
List<JSONObject> bdLeaders = managerMapper.listByRole(1, ManagerRole.BD_LEADER.getMask());
|
|
|
|
|
for (JSONObject leader : bdLeaders) {
|
|
|
|
|
BigDecimal groupAmount = financialBDConfigMapper.getTotalAmount(leader.getString("manager_id"), record.getString("record_id"));
|
|
|
|
|
BigDecimal groupAmount = transactionMapper.TotalAmountForBDLeaderPrize(now.get(Calendar.YEAR), now.get(Calendar.MONTH) + 1,leader.getString("manager_id"));
|
|
|
|
|
JSONObject rateJson = financialBDCommissionConfigMapper.findCurrentCommissionRate(month, groupAmount.toString(), 1);
|
|
|
|
|
BigDecimal groupPrize = new BigDecimal(0);
|
|
|
|
|
if (rateJson != null) {
|
|
|
|
|