Merge branch 'hotfix20180322manualsettle'

master
yixian 7 years ago
commit c846ce2451

@ -1,17 +1,14 @@
package au.com.royalpay.payment.manage.mappers.bill; package au.com.royalpay.payment.manage.mappers.bill;
import java.util.List; import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import org.apache.ibatis.annotations.Param; import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.sun.tracing.dtrace.ProviderAttributes; import org.apache.ibatis.annotations.Param;
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper; import java.util.List;
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
/** /**
* Create by yixian at 2017-12-19 19:09 * Create by yixian at 2017-12-19 19:09

@ -80,16 +80,17 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
if (client.getBooleanValue("skip_clearing")) { if (client.getBooleanValue("skip_clearing")) {
throw new ForbiddenException("Manual Settlement Not Enabled"); throw new ForbiddenException("Manual Settlement Not Enabled");
} }
JSONObject todayTask = taskManualSettleMapper.findTodayTask(clientId); List<JSONObject> unsettleRequests = taskManualSettleMapper.listActiveTasks(clientId);
if (todayTask != null) { JSONObject todayTask = unsettleRequests.isEmpty() ? null : unsettleRequests.get(0);
if (!unsettleRequests.isEmpty()) {
todayTask.put("settle_to", DateFormatUtils.format(todayTask.getDate("settle_to"), "yyyy-MM-dd")); todayTask.put("settle_to", DateFormatUtils.format(todayTask.getDate("settle_to"), "yyyy-MM-dd"));
} else { } else {
todayTask = new JSONObject(); todayTask = new JSONObject();
} }
List<JSONObject> settleLogs = clearingLogMapper.findByDate(new Date()); List<JSONObject> settleLogs = clearingLogMapper.findByDate(new Date());
List<JSONObject> unsettleRequests = taskManualSettleMapper.listActiveTasks(clientId);
//今天未清算则锁定 //今天未清算则锁定
todayTask.put("locked", settleLogs.isEmpty() || !unsettleRequests.isEmpty()); todayTask.put("locked", settleLogs.isEmpty());
if (includingUnsettleData) { if (includingUnsettleData) {
Date end = findSettleTo(clientId); Date end = findSettleTo(clientId);
List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end); List<JSONObject> unsettleReports = transactionMapper.listClientUnsettleDataByDate(clientId, end);

@ -0,0 +1,30 @@
package au.com.royalpay.payment.manage.settlement.core.impls;
import au.com.royalpay.payment.manage.settlement.core.ManualSettleSupport;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import static org.junit.Assert.*;
/**
* Create by yixian at 2018-03-27 14:04
*/
@SpringBootTest
@ActiveProfiles({"proxy", "alipay", "wechat", "jd", "bestpay"})
@RunWith(SpringRunner.class)
public class ManualSettleSupportImplTest {
@Resource
private ManualSettleSupport manualSettleSupport;
@Test
public void findCurrentSettle() {
System.out.println(JSON.toJSONString(manualSettleSupport.findCurrentSettle(9, true), SerializerFeature.PrettyFormat));
}
}
Loading…
Cancel
Save