Commit f022c5d1 authored by liudong1993's avatar liudong1993

1财务收据

parent bf404432
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Finance
{
/// <summary>
/// 财务收据配置实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Receipt_Config
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 是否启用 1是 其他否
/// </summary>
public int Enable { get; set; }
/// <summary>
/// 使用的流程IDs 英文逗号分隔
/// </summary>
public string TempleteIds { get; set; }
/// <summary>
/// 章图片地址
/// </summary>
public string Images { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Course;
using System;
using VT.FW.DB;
namespace Edu.Model.Entity.Finance
{
/// <summary>
/// 财务收据实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Receipt_Info
{
/// <summary>
/// Id
/// </summary>
public int Id { get; set; }
/// <summary>
/// 相关财务单据ID
/// </summary>
public int FinanceId { get; set; }
/// <summary>
/// 收据编号
/// </summary>
public string ReceiptNo { get; set; }
/// <summary>
/// 汇款人
/// </summary>
public string Remitter { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal Money { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 状态 1已认领 2未认领
/// </summary>
public int State { get; set; }
/// <summary>
/// 认领码 4位随机数
/// </summary>
public int ClaimCode { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateTime { get; set; }
/// <summary>
/// 关联电商用户Id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 电商用户名称
/// </summary>
public string UserName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.Sale;
using Edu.Model.Entity.Finance;
namespace Edu.Model.ViewModel.Finance
{
/// <summary>
/// 财务收据配置扩展类
/// </summary>
public class RB_Receipt_Config_ViewModel : RB_Receipt_Config
{
/// <summary>
/// 流程
/// </summary>
public List<string> TempleteList { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum.Sale;
using Edu.Model.Entity.Finance;
namespace Edu.Model.ViewModel.Finance
{
/// <summary>
/// 财务收据扩展类
/// </summary>
public class RB_Receipt_Info_ViewModel : RB_Receipt_Info
{
/// <summary>
/// 章图片
/// </summary>
public string SealImages { get; set; }
}
}
......@@ -66,6 +66,11 @@ namespace Edu.Model.ViewModel.WeChat
/// </summary>
public string Q_AddWay { get; set; }
/// <summary>
/// 客户IDs
/// </summary>
public string Q_CustomerIds { get; set; }
/// <summary>
/// 创建开始时间
......
......@@ -138,6 +138,14 @@ namespace Edu.Module.Finance
/// 账户
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 收据配置
/// </summary>
private readonly RB_Receipt_ConfigRepository receipt_ConfigRepository = new RB_Receipt_ConfigRepository();
/// <summary>
/// 收据
/// </summary>
private readonly RB_Receipt_InfoRepository receipt_InfoRepository = new RB_Receipt_InfoRepository();
......@@ -4635,5 +4643,174 @@ namespace Edu.Module.Finance
return RList;
}
#endregion
#region 收据管理
/// <summary>
/// 获取收据配置
/// </summary>
/// <param name="userInfo"></param>
/// <returns></returns>
public RB_Receipt_Config_ViewModel GetReceiptConfigInfo(UserInfo userInfo)
{
var model = receipt_ConfigRepository.GetList(new RB_Receipt_Config_ViewModel() { Group_Id = userInfo.Group_Id }).FirstOrDefault();
if (model != null) {
//查询流程
var tempList = Finance_TemplateRepository.GetList(new Rb_Workflow_Template_Finance_Extend() { RB_GroupId = userInfo.Group_Id, TemplateIds = model.TempleteIds });
model.TempleteList = tempList.Select(x => x.Name).ToList();
}
return model;
}
/// <summary>
/// 保存收据配置
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public string SetReceiptConfingInfo(RB_Receipt_Config_ViewModel demodel) {
if (demodel.Id > 0)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Receipt_Config_ViewModel.Enable), demodel.Enable},
{ nameof(RB_Receipt_Config_ViewModel.TempleteIds), demodel.TempleteIds},
{ nameof(RB_Receipt_Config_ViewModel.Images), demodel.Images},
{ nameof(RB_Receipt_Config_ViewModel.UpdateBy), demodel.UpdateBy},
{ nameof(RB_Receipt_Config_ViewModel.UpdateTime), demodel.UpdateTime},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName = nameof(RB_Receipt_Config_ViewModel.Id),
FiledValue = demodel.Id,
OperatorEnum =OperatorEnum.Equal
}
};
bool flag = receipt_ConfigRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员";
}
else {
bool flag = receipt_ConfigRepository.Insert(demodel) > 0;
return flag ? "" : "出错了,请联系管理员";
}
}
/// <summary>
/// 获取收据分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Receipt_Info_ViewModel> GetReceiptInfoPageList(int pageIndex, int pageSize, out long count, RB_Receipt_Info_ViewModel demodel)
{
return receipt_InfoRepository.GetPageList(pageIndex, pageSize, out count, demodel);
}
/// <summary>
/// 根据财务单据ID获取收据信息
/// </summary>
/// <param name="financeId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public RB_Receipt_Info_ViewModel GetReceiptInfoForFinanceId(int financeId, UserInfo userInfo)
{
var model = receipt_InfoRepository.GetList(new RB_Receipt_Info_ViewModel() { Group_Id = userInfo.Group_Id, FinanceId = financeId }).FirstOrDefault();
if (model != null)
{
var cmodel = receipt_ConfigRepository.GetList(new RB_Receipt_Config_ViewModel() { Group_Id = userInfo.Group_Id }).FirstOrDefault();
if (cmodel != null)
{
model.SealImages = cmodel.Images;
}
}
return model;
}
/// <summary>
/// 新增修改收据信息
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public string SetReceiptInfo(RB_Receipt_Info_ViewModel demodel)
{
if (demodel.Id > 0)
{
var model = receipt_InfoRepository.GetEntity(demodel.Id);
if (model == null) { return "收据不存在"; }
if (model.State == 1) { return "收据已被认领,无法修改"; }
if (model.CreateBy != demodel.CreateBy) { return "无法修改"; }
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Receipt_Info_ViewModel.Remitter), demodel.Remitter},
{ nameof(RB_Receipt_Info_ViewModel.Remark), demodel.Remark},
{ nameof(RB_Receipt_Info_ViewModel.UpdateBy), demodel.UpdateBy},
{ nameof(RB_Receipt_Info_ViewModel.UpdateTime), demodel.UpdateTime},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName = nameof(RB_Receipt_Info_ViewModel.Id),
FiledValue= demodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = receipt_InfoRepository.Update(keyValues, wheres);
return flag ? "" : "出错了,请联系管理员";
}
else {
var list = receipt_InfoRepository.GetList(new RB_Receipt_Info_ViewModel() { Group_Id = demodel.Group_Id, FinanceId = demodel.FinanceId });
if (list.Any()) { return "该单据已生成收据,无法重复生成"; }
var fmodel = RB_FinanceRepository.GetEntity(demodel.FinanceId);
if (fmodel == null) { return "单据不存在"; }
if (fmodel.CreateBy != demodel.CreateBy) { return "不是制单人无法创建"; }
#region 验证流程
var configModel = receipt_ConfigRepository.GetList(new RB_Receipt_Config_ViewModel() { Group_Id = demodel.Group_Id }).FirstOrDefault();
if (configModel == null || configModel.Enable != 1) { return "收据未启用,无法新增收据"; }
if (!("," + configModel.TempleteIds + ",").Contains("," + (fmodel.TemplateId ?? 0) + ",")) {
return "该单据流程未启用收据功能,无法新增收据";
}
#endregion
//获取数据库最大的序列号
string MaxReceiptNo = receipt_InfoRepository.GetMaxReceiptNo(demodel.Group_Id);
if (MaxReceiptNo == "") { MaxReceiptNo = "80000001"; }
else
{
MaxReceiptNo = (Convert.ToInt32(MaxReceiptNo) + 1).ToString();
}
demodel.ReceiptNo = MaxReceiptNo;
demodel.ClaimCode = new Random().Next(1000, 9999);
bool flag = receipt_InfoRepository.Insert(demodel) > 0;
return flag ? "" : "出错了,请联系管理员";
}
}
/// <summary>
/// 删除收据信息
/// </summary>
/// <param name="receiptId"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string DelReceiptInfo(int receiptId, UserInfo userInfo)
{
var model = receipt_InfoRepository.GetEntity(receiptId);
if (model == null || model.Status == 1) { return "收据不存在"; }
if (model.State == 1) { return "收据已认领,无法删除"; }
if (model.CreateBy != userInfo.Id) { return "无法删除"; }
Dictionary<string, object> keyValues = new Dictionary<string, object>()
{
{ nameof(RB_Receipt_Info_ViewModel.Status), 1},
{ nameof(RB_Receipt_Info_ViewModel.UpdateBy), userInfo.Id},
{ nameof(RB_Receipt_Info_ViewModel.UpdateTime), DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName = nameof(RB_Receipt_Info_ViewModel.Id),
FiledValue = receiptId,
OperatorEnum = OperatorEnum.Equal
}
};
bool flag = receipt_InfoRepository.Update(keyValues, wheres);
return flag ? "" : "出问题了,请联系管理员";
}
#endregion
}
}
......@@ -1362,6 +1362,95 @@ namespace Edu.Module.QYWeChat
}
return false;
}
/// <summary>
/// 批量设置客户标签
/// </summary>
/// <param name="customerIds"></param>
/// <param name="lableIds"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetCustomerLabelBatch(string customerIds, string lableIds, UserInfo userInfo)
{
//获取客户列表
var clist = weChat_CustomerInfoRepository.GetList(new RB_WeChat_CustomerInfo_ViewModel() { Group_Id = userInfo.Group_Id, Q_CustomerIds = customerIds });
if (!clist.Any()) { return "未查询到客户列表"; }
#region 获取token
var configmodel = weChat_ConfigRepository.GetList(new RB_WeChat_Config_ViewModel() { Group_Id = userInfo.Group_Id, Enable = 1 }).FirstOrDefault();
if (configmodel == null || configmodel.Enable != 1) { return "企业微信未开启"; }
string token = GetContactToken(userInfo.Group_Id, configmodel);
if (string.IsNullOrEmpty(token)) { return "token获取失败,请联系管理员"; }
#endregion
//获取标签列表
var labelList = weChat_LableRepository.GetList(new RB_WeChat_Lable_ViewModel() { Group_Id = userInfo.Group_Id });
var SetLable = JsonHelper.DeserializeObject<List<int>>("[" + lableIds + "]");
foreach (var item in clist) {
var NowLable = new List<int>();
if (!string.IsNullOrEmpty(item.LableIds)) {
NowLable = JsonHelper.DeserializeObject<List<int>>("[" + item.LableIds + "]");
}
var AddLable = SetLable.Where(x => !NowLable.Contains(x)).ToList();
if (AddLable.Any()) {
var LabelAddList = labelList.Where(x => AddLable.Contains(x.Id)).Select(x => x.WXLableId).Distinct().ToList();
#region 给客户打标签
if (LabelAddList.Any())
{
var lmsg = QYWeiXinHelper.SetUserCoustmerLable(token, item.WorkEmpId, item.ExternalUserId, LabelAddList);
if (lmsg.errcode != Senparc.Weixin.ReturnCode_Work.请求成功)
{
LogHelper.Write("批量设置客户标签失败:" + lmsg.errmsg);
}
}
#endregion
}
}
return "";
}
/// <summary>
/// 设置客户标签(包含删除标签)
/// </summary>
/// <param name="customerId"></param>
/// <param name="lableIds"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public string SetCustomerLabelSingle(int customerId, string lableIds, UserInfo userInfo)
{
var cmodel = weChat_CustomerInfoRepository.GetEntity(customerId);
if (cmodel == null) { return "客户信息不存在"; }
#region 获取token
var configmodel = weChat_ConfigRepository.GetList(new RB_WeChat_Config_ViewModel() { Group_Id = userInfo.Group_Id, Enable = 1 }).FirstOrDefault();
if (configmodel == null || configmodel.Enable != 1) { return "企业微信未开启"; }
string token = GetContactToken(userInfo.Group_Id, configmodel);
if (string.IsNullOrEmpty(token)) { return "token获取失败,请联系管理员"; }
#endregion
//获取标签列表
var labelList = weChat_LableRepository.GetList(new RB_WeChat_Lable_ViewModel() { Group_Id = userInfo.Group_Id });
var SetLable = JsonHelper.DeserializeObject<List<int>>("[" + lableIds + "]");
var NowLable = new List<int>();
if (!string.IsNullOrEmpty(cmodel.LableIds))
{
NowLable = JsonHelper.DeserializeObject<List<int>>("[" + cmodel.LableIds + "]");
}
var AddLable = SetLable.Where(x => !NowLable.Contains(x)).ToList();//增加
var DelLable = NowLable.Where(x => !SetLable.Contains(x)).ToList();//删除
if (AddLable.Any() || DelLable.Any())
{
var LabelAddList = labelList.Where(x => AddLable.Contains(x.Id)).Select(x => x.WXLableId).Distinct().ToList();
var LabelDelList = labelList.Where(x => DelLable.Contains(x.Id)).Select(x => x.WXLableId).Distinct().ToList();// ----
#region 给客户打标签
if (LabelAddList.Any())
{
var lmsg = QYWeiXinHelper.SetUserCoustmerLable(token, cmodel.WorkEmpId, cmodel.ExternalUserId, LabelAddList);
if (lmsg.errcode != Senparc.Weixin.ReturnCode_Work.请求成功)
{
LogHelper.Write("设置客户标签失败:" + lmsg.errmsg);
}
}
#endregion
}
return "";
}
#endregion
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Finance;
using Edu.Model.ViewModel.Finance;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Finance
{
/// <summary>
/// 财务收据配置仓储层
/// </summary>
public class RB_Receipt_ConfigRepository : BaseRepository<RB_Receipt_Config>
{
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Receipt_Config_ViewModel> GetList(RB_Receipt_Config_ViewModel demodel)
{
string where = $@" 1=1 ";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Receipt_Config_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
string sql = $@"
SELECT * From RB_Receipt_Config r
WHERE {where}
ORDER BY r.Id DESC ";
return Get<RB_Receipt_Config_ViewModel>(sql).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Finance;
using Edu.Model.ViewModel.Finance;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Finance
{
/// <summary>
/// 财务收据仓储层
/// </summary>
public class RB_Receipt_InfoRepository : BaseRepository<RB_Receipt_Info>
{
/// <summary>
/// 获取分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Receipt_Info_ViewModel> GetPageList(int pageIndex,int pageSize,out long count, RB_Receipt_Info_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.FinanceId > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.FinanceId)} ={demodel.FinanceId}";
}
if (demodel.State > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.State)} ={demodel.State}";
}
if (!string.IsNullOrEmpty(demodel.ReceiptNo))
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.ReceiptNo)} ='{demodel.ReceiptNo}'";
}
if (!string.IsNullOrEmpty(demodel.Remitter))
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.Remitter)} like @Remitter";
parameters.Add("Remitter", "%" + demodel.Remitter + "%");
}
string sql = $@"
SELECT * From RB_Receipt_Info r
WHERE {where}
ORDER BY r.Id DESC ";
return GetPage<RB_Receipt_Info_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Receipt_Info_ViewModel> GetList(RB_Receipt_Info_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters();
string where = $@" 1=1 and r.Status =0";
if (demodel.Group_Id > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (demodel.FinanceId > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.FinanceId)} ={demodel.FinanceId}";
}
if (demodel.State > 0)
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.State)} ={demodel.State}";
}
if (!string.IsNullOrEmpty(demodel.ReceiptNo))
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.ReceiptNo)} ='{demodel.ReceiptNo}'";
}
if (!string.IsNullOrEmpty(demodel.Remitter))
{
where += $@" and r.{nameof(RB_Receipt_Info_ViewModel.Remitter)} like @Remitter";
parameters.Add("Remitter", "%" + demodel.Remitter + "%");
}
string sql = $@"
SELECT * From RB_Receipt_Info r
WHERE {where}
ORDER BY r.Id DESC ";
return Get<RB_Receipt_Info_ViewModel>(sql, parameters).ToList();
}
/// <summary>
/// 获取收据最大的编码
/// </summary>
/// <param name="group_Id"></param>
/// <returns></returns>
public string GetMaxReceiptNo(int group_Id)
{
string sql = "SELECT MAX(ReceiptNo) FROM rb_receipt_info WHERE `Status` =0 and Group_Id =" + group_Id;
var obj = ExecuteScalar(sql);
return obj == null ? "" : obj.ToString();
}
}
}
using System.Collections.Generic;
using System.Linq;
using Edu.Model.Entity.Finance;
using Edu.Model.ViewModel.Finance;
namespace Edu.Repository.Finance
{
......@@ -42,5 +43,53 @@ namespace Edu.Repository.Finance
string sql = string.Format(" SELECT * FROM {0} {1}", nameof(Rb_Workflow_Auditrecord), where);
return Get<Rb_Workflow_Auditrecord>(sql).ToList();
}
/// <summary>
/// 获取模板列表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public List<Rb_Workflow_Template_Finance_Extend> GetList(Rb_Workflow_Template_Finance_Extend model)
{
string where = " WHERE 1=1 ";
if (model.Status > 0) //状态==0的时候查询停用和正常的
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.Status) + "={0}", (int)model.Status);
}
else
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.Status) + "!={0}", 3);
}
if (model.Id > 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.Id) + "={0}", model.Id);
}
if (model.Type > 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.Type) + "={0}", (int)model.Type);
}
if (model.RB_GroupId > 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.RB_GroupId) + "={0}", model.RB_GroupId);
}
if (model.RB_BranchId >= 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.RB_BranchId) + "={0}", model.RB_BranchId);
}
if (model.TemplateType.HasValue && model.TemplateType.Value > 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.TemplateType) + "={0}", (int)model.TemplateType);
}
if (!string.IsNullOrEmpty(model.TemplateIds))
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.Id) + " in ({0})", model.TemplateIds);
}
if (model.TemplateSorce > 0)
{
where += string.Format(" AND " + nameof(Rb_Workflow_Template.TemplateSorce) + "={0}", model.TemplateSorce);
}
string sql = string.Format(" SELECT * FROM Rb_Workflow_Template {0}", where);
return Get<Rb_Workflow_Template_Finance_Extend>(sql).ToList();
}
}
}
......@@ -361,6 +361,10 @@ ORDER BY {orderByStr} ";
{
where += $@" and r.{nameof(RB_WeChat_CustomerInfo_ViewModel.Group_Id)} ={demodel.Group_Id}";
}
if (!string.IsNullOrEmpty(demodel.Q_CustomerIds))
{
where += $@" and r.{nameof(RB_WeChat_CustomerInfo_ViewModel.Id)} in({demodel.Q_CustomerIds})";
}
if (demodel.CustomerType > 0)
{
where += $@" and r.{nameof(RB_WeChat_CustomerInfo_ViewModel.CustomerType)} ={demodel.CustomerType}";
......
......@@ -2131,5 +2131,182 @@ namespace Edu.WebApi.Controllers.Finance
}
#endregion
#region 收据管理
/// <summary>
/// 获取收据配置信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetReceiptConfigInfo() {
var userInfo = base.UserInfo;
var model = financeModule.GetReceiptConfigInfo(userInfo);
return ApiResult.Success("", new
{
model?.Id,
model?.Enable,
model?.TempleteIds,
model?.TempleteList,
model?.Images,
});
}
/// <summary>
/// 保存收据配置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetReceiptConfigInfo() {
var userInfo = base.UserInfo;
RB_Receipt_Config_ViewModel demodel = JsonHelper.DeserializeObject<RB_Receipt_Config_ViewModel>(base.RequestParm.Msg.ToString());
if (string.IsNullOrEmpty(demodel.TempleteIds))
{
return ApiResult.ParamIsNull("请选择使用流程");//-1表示通用
}
demodel.Group_Id = userInfo.Group_Id;
demodel.CreateBy = userInfo.Id;
demodel.CreateTime = DateTime.Now;
demodel.UpdateBy = userInfo.Id;
demodel.UpdateTime = DateTime.Now;
string msg = financeModule.SetReceiptConfingInfo(demodel);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 获取收据分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetReceiptInfoPageList() {
var userInfo = base.UserInfo;
ResultPageModel pmodel = JsonHelper.DeserializeObject<ResultPageModel>(base.RequestParm.Msg.ToString());
RB_Receipt_Info_ViewModel demodel = JsonHelper.DeserializeObject<RB_Receipt_Info_ViewModel>(base.RequestParm.Msg.ToString());
demodel.Group_Id = demodel.Group_Id;
var list = financeModule.GetReceiptInfoPageList(pmodel.PageIndex, pmodel.PageSize, out long count, demodel);
pmodel.Count = Convert.ToInt32(count);
pmodel.PageData = list.Select(x => new
{
x.Id,
x.FinanceId,
x.ReceiptNo,
x.Remitter,
x.Money,
x.Remark,
x.State,
x.ClaimCode,
x.UserId,
x.UserName,
x.CreateBy,
CreateByName = Cache.User.UserReidsCache.GetUserLoginInfo(x.CreateBy)?.AccountName ?? "",
CreateTime = x.CreateTime.ToString("yyyy-MM-dd")
});
return ApiResult.Success("", pmodel);
}
/// <summary>
/// 获取收据详情
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetReceiptInfoForFinanceId() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int FinanceId = parms.GetInt("FinanceId", 0);
if (FinanceId <= 0) {
return ApiResult.ParamIsNull();
}
var model = financeModule.GetReceiptInfoForFinanceId(FinanceId, userInfo);
return ApiResult.Success("", new
{
model?.Id,
model?.FinanceId,
model?.ReceiptNo,
model?.Remitter,
model?.Money,
model?.Remark,
model?.State,
model?.ClaimCode,
model?.UserId,
model?.UserName,
model?.CreateBy,
model?.SealImages,
CreateByName = model != null ? Cache.User.UserReidsCache.GetUserLoginInfo(model?.CreateBy)?.AccountName ?? "" : "",
CreateTime = model?.CreateTime.ToString("yyyy-MM-dd")
});
}
/// <summary>
/// 新增修改收据
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetReceiptInfo() {
var userInfo = base.UserInfo;
RB_Receipt_Info_ViewModel demodel = JsonHelper.DeserializeObject<RB_Receipt_Info_ViewModel>(base.RequestParm.Msg.ToString());
if (demodel.FinanceId <= 0) {
return ApiResult.ParamIsNull("请传递财务单据ID");
}
if (string.IsNullOrEmpty(demodel.Remitter)) {
return ApiResult.ParamIsNull("请传递汇款人");
}
if (demodel.Money <= 0) {
return ApiResult.ParamIsNull("请传递收据金额");
}
demodel.Group_Id = userInfo.Group_Id;
demodel.State = 2;
demodel.Status = 0;
demodel.UserId = 0;
demodel.UserName = "";
demodel.CreateBy = userInfo.Id;
demodel.CreateTime = DateTime.Now;
demodel.UpdateBy = userInfo.Id;
demodel.UpdateTime = DateTime.Now;
string msg = financeModule.SetReceiptInfo(demodel);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 删除收据
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelReceiptInfo() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int ReceiptId = parms.GetInt("ReceiptId", 0);
if (ReceiptId <= 0) {
return ApiResult.ParamIsNull();
}
string msg = financeModule.DelReceiptInfo(ReceiptId, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
#endregion
}
}
......@@ -156,12 +156,6 @@ namespace Edu.WebApi.Controllers.QYWeChat
return ApiResult.Success("", list);
}
#endregion
#region 客户管理
#endregion
#region 客户阶段
......@@ -541,6 +535,66 @@ namespace Edu.WebApi.Controllers.QYWeChat
}
}
/// <summary>
/// 批量设置客户标签
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCustomerLabelBatch() {
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
string CustomerIds = parms.GetStringValue("CustomerIds");//客户ids 英文逗号分隔
string LableIds = parms.GetStringValue("LableIds");//标签ids
if (string.IsNullOrEmpty(CustomerIds)) {
return ApiResult.ParamIsNull("请传递客户ID");
}
if (string.IsNullOrEmpty(LableIds)) {
return ApiResult.ParamIsNull("请传递标签ID");
}
string msg = customerModule.SetCustomerLabelBatch(CustomerIds, LableIds, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
/// <summary>
/// 单客户标签设置
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetCustomerLabelSingle()
{
var userInfo = base.UserInfo;
JObject parms = JObject.Parse(base.RequestParm.Msg.ToString());
int CustomerId = parms.GetInt("CustomerId", 0);//客户id
string LableIds = parms.GetStringValue("LableIds");//标签ids
if (CustomerId <= 0)
{
return ApiResult.ParamIsNull("请传递客户ID");
}
if (string.IsNullOrEmpty(LableIds))
{
return ApiResult.ParamIsNull("请传递标签ID");
}
string msg = customerModule.SetCustomerLabelSingle(CustomerId, LableIds, userInfo);
if (msg == "")
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed(msg);
}
}
//修改客户企业标签(批量处理)
//批量转移 放弃 导出 删除
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment