|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
|
using DS.WMS.Core.Info.Entity;
|
|
|
|
|
using DS.WMS.Core.Info.Interface;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.MainApi.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 往来单位干系人API
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class ClientStakeholderController : ApiController
|
|
|
|
|
{
|
|
|
|
|
readonly IUser _user;
|
|
|
|
|
readonly IClientStakeholderService _invokeService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 构造函数
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="invokeService"></param>
|
|
|
|
|
/// <param name="user"></param>
|
|
|
|
|
public ClientStakeholderController(IClientStakeholderService invokeService, IUser user)
|
|
|
|
|
{
|
|
|
|
|
_invokeService = invokeService;
|
|
|
|
|
_user = user;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 提交审核
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("SubmitAudit")]
|
|
|
|
|
public async Task<DataResult> SubmitAuditAsync([FromBody] IdModel idModel)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage());
|
|
|
|
|
|
|
|
|
|
return await _invokeService.SubmitAuditAsync(idModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 执行审核
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Audit")]
|
|
|
|
|
public async Task<DataResult> AuditAsync([FromBody] AuditRequest request)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage());
|
|
|
|
|
|
|
|
|
|
return await _invokeService.AuditAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 撤销审核
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Withdraw")]
|
|
|
|
|
public async Task<DataResult> WithdrawAsync([FromBody] IdModel idModel)
|
|
|
|
|
{
|
|
|
|
|
if (!ModelState.IsValid)
|
|
|
|
|
return DataResult.Failed(ModelState.GetErrorMessage());
|
|
|
|
|
|
|
|
|
|
return await _invokeService.WithdrawAsync(idModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 审核完成回调
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="callback">回调信息</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("AuditCallback")]
|
|
|
|
|
public async Task<DataResult> AuditCallbackAsync([FromBody] FlowCallback callback)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.AuditCallbackAsync(callback);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("GetList")]
|
|
|
|
|
public async Task<DataResult<List<InfoClientStakeholder>>> GetListAsync(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.GetListAsync(request);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取客户干系人
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpGet, Route("Get")]
|
|
|
|
|
public async Task<DataResult<InfoClientStakeholder>> GetAsync([FromQuery] long id)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.GetAsync(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 创建客户干系人并提交审核
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="clientId">客户ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("CreateSubmit")]
|
|
|
|
|
public async Task<DataResult> AddSubmitAsync(long clientId)
|
|
|
|
|
{
|
|
|
|
|
var date = DateTime.Now.Date;
|
|
|
|
|
return await _invokeService.AddSubmitAsync(new InfoClientStakeholder
|
|
|
|
|
{
|
|
|
|
|
ClientId = clientId,
|
|
|
|
|
UserId = long.Parse(_user.UserId),
|
|
|
|
|
UserName = _user.UserName,
|
|
|
|
|
StartDate = date,
|
|
|
|
|
EndDate = date.AddMonths(4),
|
|
|
|
|
Status = StakeholderStatus.Uncommitted
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新客户干系人
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="stakeholder">干系人</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Edit")]
|
|
|
|
|
public async Task<DataResult> EditAsync([FromBody] InfoClientStakeholder stakeholder)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.EditAsync(stakeholder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除干系人
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idModel"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost, Route("Delete")]
|
|
|
|
|
public async Task<DataResult> DeleteAsync(IdModel idModel)
|
|
|
|
|
{
|
|
|
|
|
return await _invokeService.DeleteAsync(idModel.Ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|