| | |
| | | package cc.mrbird.febs.dapp.controller; |
| | | |
| | | import cc.mrbird.febs.common.annotation.ControllerEndpoint; |
| | | import cc.mrbird.febs.common.controller.BaseController; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.utils.FebsUtil; |
| | | import cc.mrbird.febs.dapp.entity.DappAccountMoneyChangeEntity; |
| | | import cc.mrbird.febs.dapp.entity.DappAchieve; |
| | | import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.service.AsyncCjService; |
| | | import cc.mrbird.febs.dapp.service.DappWalletService; |
| | | import cc.mrbird.febs.system.entity.User; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author wzy |
| | | * @author |
| | | * @date 2022-03-22 |
| | | **/ |
| | | @Slf4j |
| | |
| | | public class MemberMoneyFlowController extends BaseController { |
| | | |
| | | private final DappWalletService dappWalletService; |
| | | private final DappFundFlowDao dappFundFlowDao; |
| | | private final AsyncCjService asyncCjService; |
| | | |
| | | @GetMapping("/dappAchieveItem") |
| | | public FebsResponse dappAchieveItem(QueryRequest request, DappAchieve dappAchieve, Integer parentId) { |
| | | if (parentId == null) { |
| | | ViewBannerController.zhiyaID = 0; |
| | | } |
| | | dappAchieve.setId(ViewBannerController.zhiyaID); |
| | | Map<String, Object> dataTable = getDataTable(dappWalletService.dappAchieveItemInPage(dappAchieve, request)); |
| | | return new FebsResponse().success().data(dataTable); |
| | | } |
| | | |
| | | @RequestMapping(value = "/dappAchieve") |
| | | public FebsResponse dappAchieve(DappAchieve dappAchieve, QueryRequest request) { |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.dappAchieveInPage(dappAchieve, request))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/fundFlow") |
| | | public FebsResponse fundFlow(DappFundFlowEntity dappFundFlowEntity, QueryRequest request) { |
| | | User currentUser = FebsUtil.getCurrentUser(); |
| | | if (currentUser.getDeptId() == null) { |
| | | dappFundFlowEntity.setCurrentUser(currentUser.getUserId()); |
| | | } |
| | | return new FebsResponse().success().data(getDataTable(dappWalletService.fundFlowInPage(dappFundFlowEntity, request))); |
| | | } |
| | | |
| | | @GetMapping("confirmOrder") |
| | | @ControllerEndpoint(operation = "批量转账", exceptionMessage = "操作失败") |
| | | public FebsResponse confirmOrder(DappFundFlowEntity dappFundFlowIn){ |
| | | String orderIds = dappFundFlowIn.getOrderIds(); |
| | | List<String> ids = StrUtil.splitTrim(orderIds, ","); |
| | | for(String id : ids){ |
| | | long orderId = Long.parseLong(id); |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(orderId); |
| | | if(1 != dappFundFlowEntity.getStatus()){ |
| | | continue; |
| | | } |
| | | asyncCjService.confirmOrder(dappFundFlowEntity); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @GetMapping("confirmCancel") |
| | | @ControllerEndpoint(operation = "取消", exceptionMessage = "操作失败") |
| | | public FebsResponse confirmCancel(DappFundFlowEntity dappFundFlowIn){ |
| | | String orderIds = dappFundFlowIn.getOrderIds(); |
| | | List<String> ids = StrUtil.splitTrim(orderIds, ","); |
| | | for(String id : ids){ |
| | | long orderId = Long.parseLong(id); |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(orderId); |
| | | if(1 != dappFundFlowEntity.getStatus()){ |
| | | continue; |
| | | } |
| | | asyncCjService.confirmCancel(dappFundFlowEntity); |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @PostMapping(value = "/withdrawAgree/{id}") |
| | | public FebsResponse withdrawAgree(@PathVariable("id") Long id) { |
| | | dappWalletService.withdrawAgreeOrNot(id, 1); |