You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package com.example.demo.controller.cash;
import com.example.demo.Util.JWTUtil;import com.example.demo.domain.entity.Admin;import com.example.demo.domain.entity.CashRecord;import com.example.demo.domain.vo.cash.CashCollection;import com.example.demo.domain.vo.coin.Page;import com.example.demo.domain.vo.coin.Result;import com.example.demo.service.cash.CashCollectionService;import com.github.pagehelper.PageInfo;import jakarta.servlet.http.HttpServletRequest;import lombok.RequiredArgsConstructor;import lombok.extern.slf4j.Slf4j;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.web.bind.annotation.*;import org.springframework.web.context.request.RequestContextHolder;import org.springframework.web.context.request.ServletRequestAttributes;
import java.util.Arrays;import java.util.List;
/** * @program: gold-java * @ClassName CashCollectionController * @description: * @author: Ethan * @create: 2025−09-26 10:22 * @Version 1.0 **/@RestController@RequestMapping("/cashCollection")@RequiredArgsConstructor@Slf4j@CrossOriginpublic class CashCollectionController { @Autowired private CashCollectionService cashCollectionService;
//新增收款订单
@PostMapping("/add") public Result add(@RequestBody CashCollection cashCollection) { try { return cashCollectionService.add(cashCollection); } catch (Exception e) { return Result.error(e.getMessage()); } } //撤回未审核的收款订单
@PostMapping("/cancel") public Result cancel(@RequestBody CashRecord cashRecord) { try { return cashCollectionService.cancel(cashRecord.getOrderCode()); }catch (Exception e){ return Result.error(e.getMessage()); } } //重新提交审核的收款订单
@PostMapping("/reSubmit") public Result reSubmit(@RequestBody CashRecord cashRecord) { try { return cashCollectionService.reSubmit(cashRecord); }catch (Exception e){ return Result.error(e.getMessage()); } } //多条件查询收款订单列表
@PostMapping("/selectCollection") public PageInfo<CashCollection> selectCollection( @RequestBody Page page) throws Exception{ Integer pageNum = page.getPageNum(); Integer pageSize = page.getPageSize(); CashCollection cashCollection = page.getCashCollection(); //解token权限
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String token = request.getHeader("token"); Admin admin = (Admin) JWTUtil.getUserDetailsList(String.valueOf(token), Admin.class); if (admin != null) { List<String> list = Arrays.asList(admin.getMarkets().split(",")); cashCollection.setMarkets(list);
} return cashCollectionService.selectCollection(pageNum, pageSize, cashCollection); } //补全手续费等
@PostMapping("/complete") public Result complete(@RequestBody CashRecord cashRecord) { try { return cashCollectionService.complete(cashRecord); }catch (Exception e){ return Result.error(e.getMessage()); } }}
|