Commit 9ca7c90d by 程裕兵

feat:sync settle

parent 9c43ba1b
...@@ -8,9 +8,12 @@ import com.jiejing.filecenter.api.authority.vo.SignatureVO; ...@@ -8,9 +8,12 @@ import com.jiejing.filecenter.api.authority.vo.SignatureVO;
import com.jiejing.filecenter.api.common.enums.AccessTypeEnum; import com.jiejing.filecenter.api.common.enums.AccessTypeEnum;
import com.jiejing.filecenter.api.common.util.UploadUtil; import com.jiejing.filecenter.api.common.util.UploadUtil;
import com.jiejing.filecenter.api.resource.ResourceApi; import com.jiejing.filecenter.api.resource.ResourceApi;
import com.jiejing.fitness.finance.repository.service.StudioCashierRecordRpService;
import com.jiejing.fitness.finance.service.utils.FileUtils; import com.jiejing.fitness.finance.service.utils.FileUtils;
import com.jiejing.paycenter.api.merchant.MerchantQueryApi; import com.jiejing.paycenter.api.merchant.MerchantQueryApi;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -36,7 +39,8 @@ public class TestController { ...@@ -36,7 +39,8 @@ public class TestController {
private AuthorityApi authorityApi; private AuthorityApi authorityApi;
@PostMapping(value = "/private/test/upload") @PostMapping(value = "/private/test/upload")
public JsonResult<SignatureVO> upload(@RequestParam String url, @RequestParam Long tenantId) throws IOException { public JsonResult<SignatureVO> upload(@RequestParam String url, @RequestParam Long tenantId)
throws IOException {
GetAuthorityRequest request = new GetAuthorityRequest(); GetAuthorityRequest request = new GetAuthorityRequest();
request.setAccessTypeEnum(AccessTypeEnum.PRIVATE); request.setAccessTypeEnum(AccessTypeEnum.PRIVATE);
request.setBizCode("FINANCE_INFO"); request.setBizCode("FINANCE_INFO");
...@@ -53,6 +57,17 @@ public class TestController { ...@@ -53,6 +57,17 @@ public class TestController {
return result; return result;
} }
@Resource
private StudioCashierRecordRpService studioCashierRecordRpService;
@PostMapping(value = "/private/test/sumMerchantPaySuccessGroupByStudioId")
public JsonResult<Map<Long, BigDecimal>> sumMerchantPaySuccessGroupByStudioId(@RequestParam Long startDate, @RequestParam Long endDate,
@RequestParam Long merchantId) {
return JsonResult.success(studioCashierRecordRpService.sumMerchantPaySuccessGroupByStudioId(
merchantId, new Date(startDate), new Date(endDate)));
}
private String getSuffix(String url) { private String getSuffix(String url) {
String[] split = url.split("\\?"); String[] split = url.split("\\?");
String fileName = StringUtils.substringAfterLast(split[0], "/"); String fileName = StringUtils.substringAfterLast(split[0], "/");
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<select id="sumMerchantPaySuccessGroupByStudioId" <select id="sumMerchantPaySuccessGroupByStudioId"
resultType="com.jiejing.fitness.finance.repository.entity.StudioCashierRecord"> resultType="com.jiejing.fitness.finance.repository.entity.StudioCashierRecord">
select studio_id, sum(actual_amount) as trans_amount select studio_id, sum(actual_amount) as actual_amount
from studio_cashier_record from studio_cashier_record
where merchant_id = #{merchantId} where merchant_id = #{merchantId}
and trans_state = 'PAY_SUCCESS' and trans_state = 'PAY_SUCCESS'
......
...@@ -233,6 +233,7 @@ public class PayServiceImpl implements PayService { ...@@ -233,6 +233,7 @@ public class PayServiceImpl implements PayService {
// 对账 // 对账
BigDecimal totalAmount = studioCashierRecordRpService.sumMerchantPaySuccess(apply.getMerchantId(), BigDecimal totalAmount = studioCashierRecordRpService.sumMerchantPaySuccess(apply.getMerchantId(),
startDate, endDate); startDate, endDate);
log.info("settle vo is {}, local total amount is {}", JSON.toJSONString(vo), totalAmount);
if (BigDecimal.ZERO.compareTo(vo.getTransAmount()) == 0 if (BigDecimal.ZERO.compareTo(vo.getTransAmount()) == 0
&& BigDecimal.ZERO.compareTo(totalAmount) == 0) { && BigDecimal.ZERO.compareTo(totalAmount) == 0) {
// 没有交易 // 没有交易
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment