|
|
@@ -20,6 +20,7 @@ import com.github.microservice.types.OrderModeType;
|
|
|
import com.github.microservice.types.OrderState;
|
|
|
import com.zhongshu.card.client.model.base.SuperSearch;
|
|
|
import com.zhongshu.card.client.model.operLogs.OperationLogsAddParam;
|
|
|
+import com.zhongshu.card.client.model.org.UserJoinBusOrgModel;
|
|
|
import com.zhongshu.card.client.model.payment.ExpenseFlowCount;
|
|
|
import com.zhongshu.card.client.model.payment.ExpenseFlowModel;
|
|
|
import com.zhongshu.card.client.model.payment.ExpenseFlowSearch;
|
|
|
@@ -494,6 +495,22 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultContent<Page<ExpenseFlowModel>> busPage(ExpenseFlowSearch param, Pageable pageable) {
|
|
|
+ param.setIsPaySuccess(Boolean.TRUE);
|
|
|
+ param.setOrderModeType(OrderModeType.Consume);
|
|
|
+
|
|
|
+ initSearchProjectOid(param);
|
|
|
+ // 用户搜索的商户
|
|
|
+ List<String> shopOids = getSearchAllShopOid(param);
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ param.setShopOids(shopOids);
|
|
|
+ Page<ExpenseFlow> page = expenseFlowDao.page(pageable, param);
|
|
|
+ return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
+ }
|
|
|
+
|
|
|
private void initSearchProjectOid(SuperSearch param) {
|
|
|
if (param != null) {
|
|
|
String projectOid = param.getProjectOid();
|
|
|
@@ -519,11 +536,11 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
|
|
|
initSearchProjectOid(param);
|
|
|
// 用户搜索的商户
|
|
|
-// List<String> shopOids = getSearchAllShopOid(param);
|
|
|
-// if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
-// return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
-// }
|
|
|
-// param.setShopOids(shopOids);
|
|
|
+ List<String> shopOids = getSearchAllShopOid(param);
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ param.setShopOids(shopOids);
|
|
|
Page<ExpenseFlow> page = expenseFlowDao.page(pageable, param);
|
|
|
return ResultContent.buildSuccess(PageEntityUtil.concurrent2PageModel(page, this::toModel));
|
|
|
}
|
|
|
@@ -537,11 +554,15 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
public List<String> getSearchAllShopOid(ExpenseFlowSearch param) {
|
|
|
List<String> shopOids = new ArrayList<String>();
|
|
|
if (param.getIsAllBusinessMain() != null && param.getIsAllBusinessMain()) {
|
|
|
- // 查询当前用户所有的商户信息
|
|
|
- List<Organization> orgs = organizationService.getUserAllOrgs(getCurrentUserId(), AuthType.BusinessMain);
|
|
|
- if (ObjectUtils.isNotEmpty(orgs)) {
|
|
|
- shopOids = orgs.stream().map(it -> it.getOid()).collect(Collectors.toList());
|
|
|
+ List<UserJoinBusOrgModel> list = organizationService.getUserAboutShopList(getCurrentUserId());
|
|
|
+ if (ObjectUtils.isNotEmpty(list)) {
|
|
|
+ shopOids = list.stream().map(it -> it.getBusOid()).collect(Collectors.toList());
|
|
|
}
|
|
|
+// // 查询当前用户所有的商户信息
|
|
|
+// List<Organization> orgs = organizationService.getUserAllOrgs(getCurrentUserId(), AuthType.BusinessMain);
|
|
|
+// if (ObjectUtils.isNotEmpty(orgs)) {
|
|
|
+// shopOids = orgs.stream().map(it -> it.getOid()).collect(Collectors.toList());
|
|
|
+// }
|
|
|
} else {
|
|
|
if (StringUtils.isNotEmpty(param.getShopOid())) {
|
|
|
shopOids.add(param.getShopOid());
|
|
|
@@ -561,6 +582,18 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
return ResultContent.buildSuccess(expenseFlowDao.countUserPayment(param));
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResultContent<ExpenseFlowCount> countBusPayment(ExpenseFlowSearch param) {
|
|
|
+ initSearchProjectOid(param);
|
|
|
+ // 用户搜索的商户
|
|
|
+ List<String> shopOids = getSearchAllShopOid(param);
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ param.setShopOids(shopOids);
|
|
|
+ return ResultContent.buildSuccess(expenseFlowDao.countUserPayment(param));
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 统计用户今天支付的总金额
|
|
|
*
|
|
|
@@ -589,11 +622,11 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
|
|
|
initSearchProjectOid(param);
|
|
|
// // 用户搜索的商户
|
|
|
-// List<String> shopOids = getSearchAllShopOid(param);
|
|
|
-// if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
-// return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
-// }
|
|
|
-// param.setShopOids(shopOids);
|
|
|
+ List<String> shopOids = getSearchAllShopOid(param);
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ param.setShopOids(shopOids);
|
|
|
ExpenseFlowCount flowCount = expenseFlowDao.countBuinessMainPayment(param);
|
|
|
return ResultContent.buildSuccess(flowCount);
|
|
|
}
|
|
|
@@ -611,13 +644,15 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
param.setIsPaySuccess(Boolean.TRUE);
|
|
|
param.setOrderModeType(OrderModeType.Consume);
|
|
|
BeanUtils.copyProperties(statisticSearch, param);
|
|
|
-
|
|
|
+ // 查询当前项目的
|
|
|
initSearchProjectOid(param);
|
|
|
-// List<String> shopOids = getSearchAllShopOid(param);
|
|
|
-// if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
-// return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
-// }
|
|
|
-// param.setShopOids(shopOids);
|
|
|
+
|
|
|
+ List<String> shopOids = getSearchAllShopOid(param);
|
|
|
+ if (ObjectUtils.isEmpty(shopOids)) {
|
|
|
+ return ResultContent.buildFail("请选择查询商户或所有的");
|
|
|
+ }
|
|
|
+ param.setShopOids(shopOids);
|
|
|
+ log.info("shopOids; {}", shopOids);
|
|
|
|
|
|
param.setYear(DateUtils.getCurrentYear());
|
|
|
// 统计模型,按 月、周
|
|
|
@@ -728,34 +763,11 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
if (expenseFlow.getOrderType() == OrderState.HAVE_PAID) {
|
|
|
return ResultContent.buildFail(String.format("订单状态不是已支付状态,不能退款"));
|
|
|
}
|
|
|
- // 调用支付中心退款
|
|
|
- AmountUpdateParam updateParam = new AmountUpdateParam();
|
|
|
- updateParam.setOid(expenseFlow.getProjectOid());
|
|
|
- updateParam.setUserId(expenseFlow.getUserId());
|
|
|
- updateParam.setShopId(expenseFlow.getShopOid());
|
|
|
- updateParam.setSchoolId(expenseFlow.getSchoolOid());
|
|
|
- updateParam.setTotal(expenseFlow.getPayAmount());
|
|
|
- updateParam.setOutTradeNo(expenseFlow.getPaymentNo());
|
|
|
-
|
|
|
- // 调用支付中心退款
|
|
|
- ResultContent content = walletFeignService.refund(updateParam);
|
|
|
- expenseFlow.setIsRefund(Boolean.TRUE);
|
|
|
- expenseFlow.setRefundRemark(param.getRemark());
|
|
|
- expenseFlow.setRefundTime(System.currentTimeMillis());
|
|
|
- if (content.isSuccess()) {
|
|
|
- // 申请人
|
|
|
- expenseFlow.setApplicant(getCurrentUserId());
|
|
|
- // 退款人
|
|
|
- expenseFlow.setRefundUserId(getCurrentUserId());
|
|
|
- expenseFlow.setRefundAMount(expenseFlow.getPayAmount());
|
|
|
- expenseFlow.setOrderType(OrderState.REFUNDED);
|
|
|
- expenseFlow.setRefundState(RefundState.Refunded);
|
|
|
- expenseFlow.setRefuseRemark("退款成功");
|
|
|
- expenseFlowDao.save(expenseFlow);
|
|
|
- return ResultContent.buildSuccess();
|
|
|
- } else {
|
|
|
- return ResultContent.buildFail(String.format("%s", content.getMsg()));
|
|
|
+ ResultContent resultContent = payCallService.refund(expenseFlow, param);
|
|
|
+ if (resultContent.isFailed()) {
|
|
|
+ return ResultContent.buildFail(resultContent.getMsg());
|
|
|
}
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
public ExpenseFlowModel toModel(ExpenseFlow entity) {
|
|
|
@@ -766,7 +778,6 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
|
|
|
// 卡片信息
|
|
|
|
|
|
// 用户信息
|
|
|
-
|
|
|
}
|
|
|
return model;
|
|
|
}
|