v4.0.18版本提交
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { BadRequestException, Body, Controller, ForbiddenException, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
|
||||
import { BadRequestException, Body, Controller, Delete, ForbiddenException, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
|
||||
import { IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';
|
||||
import { FinanceBankAccountService } from './finance-bank-account.service';
|
||||
import { HqPermissionGuard, RequireHqPermissions } from '../../common/guards/hq-permission.guard';
|
||||
import { parseShanghaiYmd } from '@dukang/domain';
|
||||
import { DEFAULT_PARTNER_STORE_STAFF_PERMISSIONS } from '@dukang/shared-types';
|
||||
import { SettlementService } from './settlement.service';
|
||||
@@ -37,6 +39,40 @@ class UpdatePartnerBankDto {
|
||||
bankBranch!: string;
|
||||
}
|
||||
|
||||
class FinanceBankAccountBodyDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(128)
|
||||
name?: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '请填写户名' })
|
||||
@MaxLength(64)
|
||||
bankAccountName!: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty({ message: '请填写银行账号' })
|
||||
@MaxLength(32)
|
||||
bankAccountNo!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(128)
|
||||
bankBranch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(256)
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
class FinanceBankAccountRemarkBodyDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(256)
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
@Controller('partner/settlement')
|
||||
@UseGuards(JwtAuthGuard, PartnerPrimaryGuard)
|
||||
export class SettlementController {
|
||||
@@ -627,6 +663,56 @@ export class AdminLogisticsBillController {
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('admin/finance/bank-accounts')
|
||||
@UseGuards(HqAuthGuard, HqPermissionGuard)
|
||||
@RequireHqPermissions('finance')
|
||||
export class AdminFinanceBankAccountController {
|
||||
constructor(private readonly financeBankAccounts: FinanceBankAccountService) {}
|
||||
|
||||
@Get()
|
||||
list(@Query() query: Record<string, string>) {
|
||||
return this.financeBankAccounts.list({
|
||||
type: query.type,
|
||||
cityId: query.cityId,
|
||||
keyword: query.keyword,
|
||||
page: query.page ? Number(query.page) : 1,
|
||||
pageSize: query.pageSize ? Number(query.pageSize) : 20,
|
||||
});
|
||||
}
|
||||
|
||||
@Get('export')
|
||||
export(@Query() query: Record<string, string>) {
|
||||
return this.financeBankAccounts.export({
|
||||
type: query.type,
|
||||
cityId: query.cityId,
|
||||
keyword: query.keyword,
|
||||
format: query.format,
|
||||
});
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: FinanceBankAccountBodyDto) {
|
||||
return this.financeBankAccounts.createOther(dto);
|
||||
}
|
||||
|
||||
@Put('other/:id')
|
||||
updateOther(@Param('id') id: string, @Body() dto: FinanceBankAccountBodyDto) {
|
||||
if (!/^\d+$/.test(id)) throw new BadRequestException('无效的账户编号');
|
||||
return this.financeBankAccounts.updateOther(BigInt(id), dto);
|
||||
}
|
||||
|
||||
@Delete('other/:id')
|
||||
removeOther(@Param('id') id: string) {
|
||||
if (!/^\d+$/.test(id)) throw new BadRequestException('无效的账户编号');
|
||||
return this.financeBankAccounts.removeOther(BigInt(id));
|
||||
}
|
||||
|
||||
@Put(':id/remark')
|
||||
updateRemark(@Param('id') id: string, @Body() dto: FinanceBankAccountRemarkBodyDto) {
|
||||
return this.financeBankAccounts.updateRemark(id, dto.remark);
|
||||
}
|
||||
}
|
||||
|
||||
@Controller('partner/me')
|
||||
@UseGuards(JwtAuthGuard)
|
||||
export class PartnerMeController {
|
||||
|
||||
Reference in New Issue
Block a user