1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using XYY.Authentication.Standard;
- using XYY.Core.Standard.ExcelHelper.MSExcelHelper;
- using XYY.Core.Standard.Mvc;
- using XYY.Data.Standard.Order;
- using XYY.Model.Standard.Finance;
- namespace XYY.Api.Finance.Controllers
- {
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class FBAIncidentalController : ApiControllerBase
- {
- IFBA_IncidentalRepository _incidentalRepository;
- public FBAIncidentalController(IFBA_IncidentalRepository incidentalRepository)
- {
- _incidentalRepository = incidentalRepository;
- }
- [HttpGet]
- public async Task<ApiJsonModel<List<string>>> GetFeeType(FBAIncidentalCalculateTarget target)
- {
- var list = await _incidentalRepository.GetFeeTypes(target);
- return ApiJsonModel<List<string>>.OK(list);
- }
- public async Task<ApiJsonModel<List<FBA_Incidental>>> GetFBA_Incidentals(FBAIncidentalDto dto)
- {
- var list = await _incidentalRepository.GetFBA_Incidentals(dto);
- return ApiJsonModel<List<FBA_Incidental>>.OK(list);
- }
- public async Task<ApiJsonModel<FBAIncidentalDto>> GetFBAIncidentalDto(FBAIncidentalDto dto)
- {
- dto = await _incidentalRepository.GetFBAIncidentalDto(dto);
- return ApiJsonModel<FBAIncidentalDto>.OK(dto);
- }
- public async Task<ApiJsonModel> SetComfig(FBAIncidentalDto dto)
- {
- await _incidentalRepository.SetComfig(dto);
- return ApiJsonModel.OK();
- }
- public async Task<ApiJsonModel> SaveFee(FBAIncidentalDto dto)
- {
- await _incidentalRepository.SaveOtherFee(dto);
- return ApiJsonModel.OK();
- }
- public async Task<IActionResult> GetFBAFee(int OrderId)
- {
- var fees = await _incidentalRepository.GetFBAFee(OrderId);
- return Ok(fees);
- }
- [HttpPost]
- public async Task<IActionResult> IncFBAIncidentals(int IncFBATarget)
- {
- var filelist = (await Request.ReadFormAsync()).Files;
- if (filelist != null && filelist.Count > 0)
- {
- var file = filelist[0];
- var result = await _incidentalRepository.IncFBAIncidentals(IncFBATarget,file.OpenReadStream());
- return Ok(result);
- }
- else
- {
- return Error("请上传一个文件");
- }
-
- }
- }
- }
|