机构修改及银行账户 用户添加字段
parent
f459ad554e
commit
c8801d194f
@ -0,0 +1,91 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DS.Module.Core;
|
||||
using FluentValidation;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Sys.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 银行信息请求实体
|
||||
/// </summary>
|
||||
public class BankReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 关联Id
|
||||
/// </summary>
|
||||
public long LinkId { get; set; }
|
||||
/// <summary>
|
||||
/// 代码
|
||||
/// </summary>
|
||||
public string CodeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 币别
|
||||
/// </summary>
|
||||
public string Currency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 银行名称
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
/// <summary>
|
||||
/// 银行名称2
|
||||
/// </summary>
|
||||
public string BankName2 { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:银行账户
|
||||
/// </summary>
|
||||
public string BankAccountNo { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:户头名称
|
||||
/// </summary>
|
||||
public string AccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 科目代码
|
||||
/// </summary>
|
||||
public string SubjectCode { get; set; }
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
public string FinanceSoftCode { get; set; }
|
||||
/// <summary>
|
||||
/// 是否默认 0否 1是
|
||||
/// </summary>
|
||||
public bool IsDefault { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 验证
|
||||
/// </summary>
|
||||
public class BankReqValidator : AbstractValidator<BankReq>
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public BankReqValidator()
|
||||
{
|
||||
this.RuleFor(o => o.CodeName)
|
||||
.NotEmpty().WithName("银行代码");
|
||||
// this.RuleFor(o => o.ColumnView)
|
||||
// .NotEmpty().WithName("中文视图名");
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using DS.Module.Core;
|
||||
|
||||
namespace DS.WMS.Core.Sys.Dtos;
|
||||
|
||||
/// <summary>
|
||||
/// 银行信息返回实体
|
||||
/// </summary>
|
||||
public class BankRes
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 关联Id
|
||||
/// </summary>
|
||||
public long LinkId { get; set; }
|
||||
/// <summary>
|
||||
/// 代码
|
||||
/// </summary>
|
||||
public string CodeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 币别
|
||||
/// </summary>
|
||||
public string Currency { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 银行名称
|
||||
/// </summary>
|
||||
public string BankName { get; set; }
|
||||
/// <summary>
|
||||
/// 银行名称2
|
||||
/// </summary>
|
||||
public string BankName2 { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:银行账户
|
||||
/// </summary>
|
||||
public string BankAccountNo { get; set; }
|
||||
/// <summary>
|
||||
/// Desc:户头名称
|
||||
/// </summary>
|
||||
public string AccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 科目代码
|
||||
/// </summary>
|
||||
public string SubjectCode { get; set; }
|
||||
/// <summary>
|
||||
/// 财务软件代码
|
||||
/// </summary>
|
||||
public string FinanceSoftCode { get; set; }
|
||||
/// <summary>
|
||||
/// 是否默认 0否 1是
|
||||
/// </summary>
|
||||
public bool IsDefault { get; set; } = false;
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int? OrderNo { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 状态 0 启用 1 禁用
|
||||
/// </summary>
|
||||
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Note { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
using DS.Module.Core;
|
||||
using DS.WMS.Core.Sys.Dtos;
|
||||
using DS.WMS.Core.Sys.Entity;
|
||||
|
||||
namespace DS.WMS.Core.Sys.Interface;
|
||||
|
||||
public interface IBankService
|
||||
{
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<List<BankRes>> GetListByPage(PageRequest request);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
DataResult EditBank(BankReq model);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
DataResult<BankRes> GetBankInfo(string id);
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.UserModule;
|
||||
using DS.WMS.Core.Sys.Dtos;
|
||||
using DS.WMS.Core.Sys.Entity;
|
||||
using DS.WMS.Core.Sys.Interface;
|
||||
using Mapster;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace DS.WMS.Core.Sys.Method;
|
||||
|
||||
public class BankService : IBankService
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly ISqlSugarClient db;
|
||||
private readonly IUser user;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="serviceProvider"></param>
|
||||
public BankService(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
user = _serviceProvider.GetRequiredService<IUser>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<List<BankRes>> GetListByPage(PageRequest request)
|
||||
{
|
||||
//序列化查询条件
|
||||
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
||||
var data = db.Queryable<SysBank>()
|
||||
.Where(whereList)
|
||||
.Select<BankRes>().ToQueryPage(request.PageCondition);
|
||||
return data;
|
||||
}
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult EditBank(BankReq req)
|
||||
{
|
||||
if (req.Id == 0)
|
||||
{
|
||||
|
||||
if (db.Queryable<SysBank>().Where(x=>x.CodeName == req.CodeName && x.LinkId == req.LinkId).Any())
|
||||
{
|
||||
return DataResult.Failed("银行信息已存在!",MultiLanguageConst.BankExist);
|
||||
}
|
||||
|
||||
var data = req.Adapt<SysBank>();
|
||||
|
||||
var entity = db.Insertable(data).ExecuteReturnEntity();
|
||||
|
||||
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
||||
}
|
||||
else
|
||||
{
|
||||
var info = db.Queryable<SysBank>().Where(x => x.Id == req.Id).First();
|
||||
|
||||
info = req.Adapt(info);
|
||||
|
||||
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
||||
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public DataResult<BankRes> GetBankInfo(string id)
|
||||
{
|
||||
var data = db.Queryable<SysBank>()
|
||||
.Where(a => a.Id == long.Parse(id))
|
||||
.Select<BankRes>()
|
||||
.First();
|
||||
return DataResult<BankRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue