Merge branch 'hotfix20180322manualsettle' into develop

master
yixian 7 years ago
commit be462ec53d

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

@ -80,16 +80,17 @@ public class ManualSettleSupportImpl implements ManualSettleSupport {
if (client.getBooleanValue("skip_clearing")) {
throw new ForbiddenException("Manual Settlement Not Enabled");
}
JSONObject todayTask = taskManualSettleMapper.findTodayTask(clientId);
if (todayTask != null) {
List<JSONObject> unsettleRequests = taskManualSettleMapper.listActiveTasks(clientId);
JSONObject todayTask = unsettleRequests.isEmpty() ? null : unsettleRequests.get(0);
if (!unsettleRequests.isEmpty()) {
todayTask.put("settle_to", DateFormatUtils.format(todayTask.getDate("settle_to"), "yyyy-MM-dd"));
} else {
todayTask = new JSONObject();
}
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) {
Date end = findSettleTo(clientId);
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