初始提交
This commit is contained in:
1632
Services/Hncore.Pass.BaseInfo/AppData/enums.json
Normal file
1632
Services/Hncore.Pass.BaseInfo/AppData/enums.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Hncore.Pass.Vpn.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
namespace Hncore.Pass.BaseInfo.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/baseinfo/v{version:apiVersion}/chargeorder/[action]")]
|
||||
public class ChargeOrderController : HncoreControllerBase
|
||||
{
|
||||
private UserService _userService;
|
||||
private WxAppUserService m_WxAppUserService;
|
||||
private IConfiguration _Configuration;
|
||||
private UserScoreService m_UserScoreService;
|
||||
|
||||
private UserChargeOrderService m_ChargeOrderService;
|
||||
public ChargeOrderController(UserService userService
|
||||
, UserScoreService _UserScoreService
|
||||
, UserChargeOrderService _ChargeOrderService
|
||||
, IConfiguration configuration)
|
||||
{
|
||||
_userService = userService;
|
||||
_Configuration = configuration;
|
||||
m_ChargeOrderService = _ChargeOrderService;
|
||||
m_UserScoreService = _UserScoreService;
|
||||
}
|
||||
|
||||
public async Task<ApiResult> Page([FromQuery]QueryChargeOrdertRequest request)
|
||||
{
|
||||
Expression<Func<UserChargeOrderEntity, bool>> expr = m => m.OrderState == UOrderStatus.PayOk || m.OrderState == UOrderStatus.Complete;
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
expr = expr.And(m =>
|
||||
m.UserName.Contains(request.KeyWord)
|
||||
|| m.OrderNo.Contains(request.KeyWord)
|
||||
|| m.TradeNo.Contains(request.KeyWord));
|
||||
}
|
||||
if (request.BTime.HasValue && request.ETime.HasValue)
|
||||
{
|
||||
expr = expr.And(m => m.CreateTime >= request.BTime && m.CreateTime <= request.ETime);
|
||||
}
|
||||
var ret = await m_ChargeOrderService.PageDesc(request.PageIndex, request.PageSize, expr, true, m => m.Id);
|
||||
var data = ret.ToApiResult();
|
||||
return data;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ExportOrder([FromQuery]QueryChargeOrdertRequest request)
|
||||
{
|
||||
Expression<Func<UserChargeOrderEntity, bool>> expr = m => m.OrderState == UOrderStatus.PayOk || m.OrderState == UOrderStatus.Complete;
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
expr = expr.And(m =>
|
||||
m.UserName.Contains(request.KeyWord)
|
||||
|| m.OrderNo.Contains(request.KeyWord)
|
||||
|| m.TradeNo.Contains(request.KeyWord));
|
||||
}
|
||||
if (request.BTime.HasValue && request.ETime.HasValue)
|
||||
{
|
||||
expr = expr.And(m => m.CreateTime >= request.BTime && m.CreateTime <= request.ETime);
|
||||
}
|
||||
var ret = await m_ChargeOrderService.PageDesc(1, 10000, expr, true, m => m.Id);
|
||||
|
||||
|
||||
var data = new ExcelData<UserChargeOrderEntity>
|
||||
{
|
||||
SheetName = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Data = ret.List
|
||||
};
|
||||
|
||||
var title = new List<ExcelTitle>(){
|
||||
new ExcelTitle { Property = "CreateTime", Title = "创建日期",Format=(val)=>((DateTime) val).ToString("yyyy-MM-dd hh:mm:ss") },
|
||||
new ExcelTitle { Property = "OrderNo", Title = "订单号" },
|
||||
new ExcelTitle { Property = "TradeNo", Title = "交易号" },
|
||||
new ExcelTitle { Property = "UserName", Title = "用户" },
|
||||
new ExcelTitle { Property = "OrderAmount", Title = "充值金额" },
|
||||
|
||||
};
|
||||
var fileBytes = ExcelHelper.ExportListToExcel(data, title);
|
||||
|
||||
var fileName = $"{DateTime.Now.ToString("yyyyMMdd")}充值明细.xlsx";
|
||||
Response.Headers.Add("X-Suggested-Filename", fileName.UrlEncode());
|
||||
return File(fileBytes, "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
103
Services/Hncore.Pass.BaseInfo/Controllers/ManagerController.cs
Normal file
103
Services/Hncore.Pass.BaseInfo/Controllers/ManagerController.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.Manager;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/baseinfo/v{version:apiVersion}/Manager/[action]")]
|
||||
public class ManagerController : HncoreControllerBase
|
||||
{
|
||||
private ManageService _manageService;
|
||||
private IConfiguration _Configuration;
|
||||
|
||||
public ManagerController(ManageService manageService, IConfiguration configuration)
|
||||
{
|
||||
_manageService = manageService;
|
||||
_Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> LogIn([FromBody] LoginRequest request)
|
||||
{
|
||||
return Success(await _manageService.Login(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> LogInTemp([FromBody] LoginRequest request)
|
||||
{
|
||||
return Success(await _manageService.LoginTemp(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> LoginAndroidTemp([FromBody] LoginRequest request)
|
||||
{
|
||||
return Success(await _manageService.LoginAndroidTemp(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 图片验证码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<ApiResult> GetValidateCode()
|
||||
{
|
||||
var code = "1234";// vCode.MakeCode(4);
|
||||
|
||||
var key = "validate:" + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + Guid.NewGuid().ToString("N");
|
||||
|
||||
if (!EnvironmentVariableHelper.IsAspNetCoreProduction)
|
||||
{
|
||||
LogHelper.Debug("登录验证码", $"code:{code},key:{key}");
|
||||
}
|
||||
var expireSeconds = 600;
|
||||
// await RedisHelper.SetAsync(key, code, expireSeconds);
|
||||
|
||||
var img = ValidateCodeHelper.GenerateCodeImg(code);
|
||||
var data = new
|
||||
{
|
||||
key = key,
|
||||
img = img,
|
||||
expireSeconds = expireSeconds,
|
||||
};
|
||||
return Success(data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新token
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult> AgainGetToken(RequestBase<AgainTokenDTO> request)
|
||||
{
|
||||
request.TenantId = Request.GetManageUserInfo().TenantId;
|
||||
request.OperaterId = Request.GetManageUserInfo().OperaterId;
|
||||
return Success(await _manageService.AgainGetToken(request),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
305
Services/Hncore.Pass.BaseInfo/Controllers/UserController.cs
Normal file
305
Services/Hncore.Pass.BaseInfo/Controllers/UserController.cs
Normal file
@@ -0,0 +1,305 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/baseinfo/v{version:apiVersion}/user/[action]")]
|
||||
public class UserController : HncoreControllerBase
|
||||
{
|
||||
private UserService _userService;
|
||||
private WxAppUserService m_WxAppUserService;
|
||||
private IConfiguration _Configuration;
|
||||
private UserScoreService m_UserScoreService;
|
||||
public UserController(UserService userService, UserScoreService _UserScoreService, WxAppUserService _WxAppUserService, IConfiguration configuration)
|
||||
{
|
||||
_userService = userService;
|
||||
_Configuration = configuration;
|
||||
m_WxAppUserService = _WxAppUserService;
|
||||
m_UserScoreService = _UserScoreService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> WxLogin([FromBody] WxLoginRequest request)
|
||||
{
|
||||
return Success(await _userService.LoginAndBindWx(request));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, AllowAnonymous]
|
||||
public async Task<ApiResult> WebLogin([FromBody] LoginRequest request)
|
||||
{
|
||||
return Success(await _userService.Login(request));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Post([FromBody]PostUserRequest request)
|
||||
{
|
||||
var entity = request.MapTo<User>();
|
||||
entity.CreateType = UserCreateType.ManagerAdd;
|
||||
return await _userService.Regist(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Put([FromBody]PostUserRequest request)
|
||||
{
|
||||
if (request.Password.NotHas())
|
||||
{
|
||||
return Error("密码不能为空");
|
||||
}
|
||||
var userEntity = await _userService.GetById(request.Id);
|
||||
userEntity.Phone = request.Phone;
|
||||
userEntity.QQ = request.QQ;
|
||||
userEntity.Wx = request.Wx;
|
||||
userEntity.TaoBao = request.TaoBao;
|
||||
userEntity.Email = request.Email;
|
||||
userEntity.Password =UserService.HashPassword(request.Password);
|
||||
var ret= await _userService.Update(userEntity);
|
||||
if (ret)
|
||||
{
|
||||
return Success("设置成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Error("设置失败");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Delete([FromQuery]int id)
|
||||
{
|
||||
var flag = await _userService.DeleteById(id);
|
||||
if (flag)
|
||||
return Success();
|
||||
else
|
||||
return Error("删除失败");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> Page([FromQuery]PageRequestBase request)
|
||||
{
|
||||
var ret = await _userService.PageDesc(request.PageIndex, request.PageSize,
|
||||
m=> request.KeyWord.NotHas()
|
||||
||m.LoginCode.Contains(request.KeyWord)
|
||||
|| m.Phone.Contains(request.KeyWord)
|
||||
|| m.Name.Contains(request.KeyWord),true,m=>m.Id);
|
||||
ret.List.ForEach(m => m.Password = "");
|
||||
|
||||
var data = ret.ToApiResult();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> Search([FromQuery]QueryUserRequest request)
|
||||
{
|
||||
Expression<Func<User, bool>> exp = (m) => 1 == 1;
|
||||
if (request.All.HasValue && request.All == 0)
|
||||
{
|
||||
exp = exp.And(m => m.ManagerId == 0);
|
||||
}
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
exp = exp.And(m => m.Phone.Contains(request.KeyWord));
|
||||
}
|
||||
|
||||
var ret = await _userService.PageDesc(request.PageIndex, request.PageSize, exp, true, m => m.Id);
|
||||
ret.List.ForEach(m => m.Password = "");
|
||||
var data = ret.ToApiResult();
|
||||
return data;
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> SearchInfo([FromQuery]PageRequestBase request)
|
||||
{
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
var ret = await _userService.PageDesc(request.PageIndex, 50,
|
||||
m => m.LoginCode== request.KeyWord
|
||||
|| m.Phone== request.KeyWord, true, m => m.Id);
|
||||
ret.List.ForEach(m => m.Password = "");
|
||||
var data = ret.ToApiResult();
|
||||
return data;
|
||||
}
|
||||
return Error("请输入关键字");
|
||||
|
||||
}
|
||||
|
||||
public async Task<ApiResult> UpdateAmount([FromBody] UpdateAmountRequest request)
|
||||
{
|
||||
request.OperateUserName = this.Request.GetManageUserInfo().LoginName;
|
||||
return await _userService.UpdateAmount(request);
|
||||
}
|
||||
|
||||
public async Task<ApiResult> UpdateTestCount([FromBody] UpdateTestCountRequest request)
|
||||
{
|
||||
var userEntity = await _userService.GetById(request.UserId);
|
||||
userEntity.TestCountLimit = request.Limit;
|
||||
await _userService.Update(userEntity);
|
||||
return Success();
|
||||
}
|
||||
|
||||
//public async Task<ApiResult> ChargeByTaoBao([FromBody] UpdateAmountRequest request)
|
||||
//{
|
||||
// return await _userService.UpdateAmount(request);
|
||||
//}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> AmountDetail([FromQuery] int userId)
|
||||
{
|
||||
var model = await m_UserScoreService.Details(userId);
|
||||
return Success(model);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> AmountDetails([FromQuery] QueryAmountRequest request)
|
||||
{
|
||||
var model = await m_UserScoreService.Details(request);
|
||||
return model.ToApiResult();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> ExportAmount([FromQuery]QueryAmountRequest request)
|
||||
{
|
||||
var model = await m_UserScoreService.DetailsAll(request);
|
||||
|
||||
|
||||
var data = new ExcelData<UserScore>
|
||||
{
|
||||
SheetName = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Data = model
|
||||
};
|
||||
|
||||
var title = new List<ExcelTitle>(){
|
||||
new ExcelTitle { Property = "CreateTime", Title = "创建日期",Format=(val)=>((DateTime) val).ToString("yyyy-MM-dd hh:mm:ss") },
|
||||
new ExcelTitle { Property = "UserName", Title = "用户" },
|
||||
new ExcelTitle { Property = "OperateUserName", Title = "操作人员" },
|
||||
new ExcelTitle { Property = "ScoreTypeName", Title = "资金项目" },
|
||||
new ExcelTitle { Property = "ScoreValue", Title = "金额" }
|
||||
};
|
||||
var fileBytes = ExcelHelper.ExportListToExcel(data, title);
|
||||
|
||||
var fileName = $"{DateTime.Now.ToString("yyyyMMdd")}资金明细.xlsx";
|
||||
Response.Headers.Add("X-Suggested-Filename", fileName.UrlEncode());
|
||||
return File(fileBytes, "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Export()
|
||||
{
|
||||
var ret = await _userService.GetAll(true);
|
||||
|
||||
var data = new ExcelData<User>
|
||||
{
|
||||
SheetName = DateTime.Now.ToString("yyyy-MM-dd"),
|
||||
Data = ret
|
||||
};
|
||||
|
||||
var title = new List<ExcelTitle>(){
|
||||
new ExcelTitle { Property = "LoginCode", Title = "手机号" },
|
||||
new ExcelTitle { Property = "CreateTime", Title = "注册时间",Format=(val)=>((DateTime) val).ToString("yyyy-MM-dd hh:mm:ss") },
|
||||
new ExcelTitle { Property = "CreateType", Title = "注册方式", Format=(val)=>((UserCreateType)val).GetEnumDisplayName() },
|
||||
new ExcelTitle { Property = "RestAmount", Title = "余额"},
|
||||
new ExcelTitle { Property = "TestCountLimit", Title = "测试限额",Format=(val)=>((int)val)==0?3:(int)val },
|
||||
new ExcelTitle { Property = "UseTestCount", Title = "领用数",Format=(val)=>((int)val)==0?3:(int)val },
|
||||
new ExcelTitle { Property = "Wx", Title = "微信"},
|
||||
new ExcelTitle { Property = "QQ", Title = "QQ"},
|
||||
new ExcelTitle { Property = "Email", Title = "Email"},
|
||||
new ExcelTitle { Property = "TaoBao", Title = "淘宝"},
|
||||
new ExcelTitle { Property = "WangWang", Title = "旺旺"},
|
||||
};
|
||||
var fileBytes = ExcelHelper.ExportListToExcel(data, title);
|
||||
|
||||
var fileName = $"{DateTime.Now.ToString("yyyyMMdd")}用户明细.xlsx";
|
||||
Response.Headers.Add("X-Suggested-Filename", fileName.UrlEncode());
|
||||
return File(fileBytes, "application/octet-stream", fileName);
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> SetManager([FromBody] SetManagerRequest request)
|
||||
{
|
||||
if (request.ManagerId == 0 || request.ManagerName.NotHas())
|
||||
{
|
||||
return Error("请选择客户经理");
|
||||
}
|
||||
|
||||
if (request.UserIds == null || request.UserIds.Count() == 0)
|
||||
{
|
||||
return Error("请选择用户");
|
||||
}
|
||||
|
||||
var users = await _userService.Query(m => request.UserIds.Contains(m.Id)).ToListAsync();
|
||||
|
||||
if (users != null)
|
||||
{
|
||||
users.ForEach(m =>
|
||||
{
|
||||
m.ManagerId = request.ManagerId;
|
||||
m.ManagerName = request.ManagerName;
|
||||
});
|
||||
await _userService.Update(users);
|
||||
}
|
||||
return Success();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> UpdateProfile([FromBody] UpdateProfileRequest request)
|
||||
{
|
||||
var userInfo = await _userService.GetById(request.UserId);
|
||||
userInfo.Profile = request.Profile;
|
||||
await _userService.Update(userInfo);
|
||||
return Success();
|
||||
}
|
||||
}
|
||||
}
|
||||
143
Services/Hncore.Pass.BaseInfo/Domain/Enum.cs
Normal file
143
Services/Hncore.Pass.BaseInfo/Domain/Enum.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
|
||||
#region 管理员
|
||||
public enum ManagerState
|
||||
{
|
||||
/// <summary>
|
||||
/// 禁用
|
||||
/// </summary>
|
||||
[Display(Name = "未启用")]
|
||||
Disabled = 0,
|
||||
/// <summary>
|
||||
/// 启用
|
||||
/// </summary>
|
||||
[Display(Name = "启用")]
|
||||
Enabled = 1
|
||||
}
|
||||
public enum AgainTokenType
|
||||
{
|
||||
/// <summary>
|
||||
/// 刷新过期时间
|
||||
/// </summary>
|
||||
[Display(Name = "刷新token过期时间")]
|
||||
Expire = 0,
|
||||
/// <summary>
|
||||
/// 刷新管理项目
|
||||
/// </summary>
|
||||
[Display(Name = "刷新管理项目")]
|
||||
Project = 1
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 用户注册来源
|
||||
/// </summary>
|
||||
public enum UserCreateType
|
||||
{
|
||||
[Display(Name = "管理员添加")]
|
||||
ManagerAdd = 1,
|
||||
[Display(Name = "用户注册")]
|
||||
UserRegist = 2,
|
||||
[Display(Name = "淘宝注册")]
|
||||
TaoBaoRegist = 3,
|
||||
}
|
||||
|
||||
public enum ScoreType
|
||||
{
|
||||
[Display(Name = "管理员充值")]
|
||||
ManagerAdd = 1,
|
||||
[Display(Name = "管理员扣除")]
|
||||
ManagerDeduct = 2,
|
||||
[Display(Name = "淘宝充值")]
|
||||
TaoBaoAdd = 3,
|
||||
[Display(Name = "淘宝退款")]
|
||||
TaoBaoRefund = 4,
|
||||
[Display(Name = "账号退款")]
|
||||
AccountRefund = 5,
|
||||
|
||||
[Display(Name = "账号付款")]
|
||||
Pay = 6,
|
||||
|
||||
[Display(Name = "用户充值")]
|
||||
UserCharge = 7,
|
||||
}
|
||||
|
||||
public enum UPayChannel
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信H5
|
||||
/// </summary>
|
||||
[Display(Name = "微信H5")]
|
||||
WxH5 = 10,
|
||||
/// <summary>
|
||||
/// 微信公众号
|
||||
/// </summary>
|
||||
[Display(Name = "微信公众号")]
|
||||
WxMp = 20,
|
||||
|
||||
/// <summary>
|
||||
/// 微信公众号
|
||||
/// </summary>
|
||||
[Display(Name = "微信Pc")]
|
||||
WxPc = 30,
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝H5
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝H5")]
|
||||
AliH5 = 40,
|
||||
/// <summary>
|
||||
/// 支付宝
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝Pc")]
|
||||
AliPc = 50,
|
||||
}
|
||||
|
||||
public enum UOrderStatus
|
||||
{
|
||||
[Display(Name = "默认")]
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// 待支付
|
||||
/// </summary>
|
||||
[Display(Name = "待付款")]
|
||||
NoPay = 10,
|
||||
/// <summary>
|
||||
/// 已支付
|
||||
/// </summary>
|
||||
[Display(Name = "已付款")]
|
||||
PayOk = 20,
|
||||
/// <summary>
|
||||
/// 申请退款
|
||||
/// </summary>
|
||||
[Display(Name = "申请退款")]
|
||||
RequestRefund = 30,
|
||||
/// <summary>
|
||||
/// 人工退款
|
||||
/// </summary>
|
||||
[Display(Name = "人工退款")]
|
||||
UserRefundOver = 40,
|
||||
/// <summary>
|
||||
/// 自送退款
|
||||
/// </summary>
|
||||
[Display(Name = "自动退款")]
|
||||
AutoRefundOver = 50,
|
||||
/// <summary>
|
||||
/// 订单超时关闭
|
||||
/// </summary>
|
||||
[Display(Name = "超时关闭")]
|
||||
TimeOutClose = 80,
|
||||
|
||||
/// <summary>
|
||||
/// 订单完成
|
||||
/// </summary>
|
||||
[Display(Name = "订单完成")]
|
||||
Complete = 90,
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
99
Services/Hncore.Pass.BaseInfo/Domain/Manager.cs
Normal file
99
Services/Hncore.Pass.BaseInfo/Domain/Manager.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class Manager : EntityWithTime<int>, ITenant
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名[16
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员角色
|
||||
/// </summary>
|
||||
public int RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址[30
|
||||
/// </summary>
|
||||
public string PhotoUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信openid[50]
|
||||
/// </summary>
|
||||
public string WxOpenid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string WxNickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string WxImage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public int Source { get; set; }
|
||||
/// <summary>
|
||||
/// 系统ID
|
||||
/// </summary>
|
||||
public int systemid { get; set; }
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// 账号code
|
||||
/// </summary>
|
||||
public string ManagerCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主管理员权限
|
||||
/// </summary>
|
||||
public int IsRoot { get; set; }
|
||||
|
||||
public int SystemId { get; set; }
|
||||
|
||||
public string Tags { get; set; }
|
||||
}
|
||||
}
|
||||
81
Services/Hncore.Pass.BaseInfo/Domain/User.cs
Normal file
81
Services/Hncore.Pass.BaseInfo/Domain/User.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class User : EntityWithTime<int>, ITenant
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// <summary>
|
||||
public int TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名[16
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public string Profile { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int Enabled { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址[30
|
||||
/// </summary>
|
||||
public string PhotoUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主管理员权限
|
||||
/// </summary>
|
||||
public DateTime? LastLoginDate { get; set; } = DateTime.Now;
|
||||
|
||||
public int Sex { get; set; }
|
||||
|
||||
//1:管理员添加 2:自己注册 3:来自淘宝
|
||||
public UserCreateType CreateType { get; set; }= UserCreateType.ManagerAdd;
|
||||
|
||||
public int ProductAccountCount { get; set; } = 0;
|
||||
|
||||
public int ExpiredProductAccountCount { get; set; } = 0;
|
||||
|
||||
public decimal RestAmount { get; set; } = 0;
|
||||
|
||||
public decimal ConsumeAmount { get; set; } = 0;
|
||||
|
||||
public string Remark { get; set; }
|
||||
public string Wx { get; set; }
|
||||
public string QQ { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string TaoBao { get; set; }
|
||||
public string WangWang { get; set; }
|
||||
|
||||
public int? TestCountLimit { get; set; } = 0;
|
||||
public int? UseTestCount { get; set; } = 0;
|
||||
|
||||
public int? ManagerId { get; set; } = 0;
|
||||
public string ManagerName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class UserChargeOrderEntity : EntityWithTime<int>
|
||||
{
|
||||
public int TenantId { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string OrderName { get; set; }
|
||||
public string OrderNo { get; set; }
|
||||
public string TradeNo { get; set; }
|
||||
public UOrderStatus OrderState { get; set; }
|
||||
public UPayChannel PayChannel { get; set; } = UPayChannel.WxPc;
|
||||
public int PayState { get; set; } = 0;
|
||||
public decimal OrderAmount { get; set; }
|
||||
public decimal PaymentAmount { get; set; }
|
||||
public int ChannelType { get; set; }
|
||||
public string Channel { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
72
Services/Hncore.Pass.BaseInfo/Domain/UserDbContext.cs
Normal file
72
Services/Hncore.Pass.BaseInfo/Domain/UserDbContext.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public class UserDbContext : DbContextBase
|
||||
{
|
||||
public UserDbContext(DbContextOptions<UserDbContext> options, IHttpContextAccessor httpContextAccessor) :
|
||||
base(options, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Manager>(entity =>
|
||||
{
|
||||
entity.ToTable("manager");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
modelBuilder.Entity<User>(entity =>
|
||||
{
|
||||
entity.ToTable("user");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
//modelBuilder.Entity<etor_authority_role>(entity =>
|
||||
//{
|
||||
// entity.ToTable("Wx_App");
|
||||
// entity.HasKey(t => t.Id);
|
||||
// entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
//});
|
||||
//modelBuilder.Entity<etor_authority_managerdatadomain>(entity =>
|
||||
//{
|
||||
// entity.ToTable("Wx_App");
|
||||
// entity.HasKey(t => t.Id);
|
||||
// entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
//});
|
||||
modelBuilder.Entity<WxAppEntity>(entity =>
|
||||
{
|
||||
entity.ToTable("Wx_App");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
modelBuilder.Entity<WxAppUserEntity>(entity =>
|
||||
{
|
||||
entity.ToTable("wx_app_user");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<UserScore>(entity =>
|
||||
{
|
||||
entity.ToTable("user_score");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
|
||||
modelBuilder.Entity<UserChargeOrderEntity>(entity =>
|
||||
{
|
||||
entity.ToTable("user_charge_order");
|
||||
entity.HasKey(t => t.Id);
|
||||
entity.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
});
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Services/Hncore.Pass.BaseInfo/Domain/UserScore.cs
Normal file
36
Services/Hncore.Pass.BaseInfo/Domain/UserScore.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class UserScore : EntityWithTime<int>, ITenant
|
||||
{
|
||||
public int TenantId { get; set; } = 0;
|
||||
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string OperateUserName { get; set; }
|
||||
|
||||
public ScoreType ScoreType { get; set; }
|
||||
|
||||
public string ScoreTypeName { get; set; }
|
||||
|
||||
public decimal ScoreValue { get; set; } = 0;
|
||||
|
||||
public string ScoreTarget { get; set; }
|
||||
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ïû·ÑǰÓà¶î
|
||||
/// </summary>
|
||||
public decimal? RestAmount1 { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ïû·ÑºóÓà¶î
|
||||
/// </summary>
|
||||
public decimal? RestAmount2 { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
28
Services/Hncore.Pass.BaseInfo/Domain/WxAppEntity.cs
Normal file
28
Services/Hncore.Pass.BaseInfo/Domain/WxAppEntity.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class WxAppEntity : EntityWithDelete<int>, ITenant
|
||||
{
|
||||
public int TenantId { get; set; }
|
||||
public int StoreId { get; set; }
|
||||
public string OpenAppId { get; set; }
|
||||
public string Appid { get; set; }
|
||||
public int AppType { get; set; }
|
||||
|
||||
public string HeadImg { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string PrincipalName { get; set; }
|
||||
public string Bussinessinfo { get; set; }
|
||||
public string Createtime { get; set; }
|
||||
|
||||
public int AuthorizerState { get; set; }
|
||||
public string RefreshToken { get; set; }
|
||||
|
||||
public int ExpiresIn { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
||||
31
Services/Hncore.Pass.BaseInfo/Domain/WxAppUserEntity.cs
Normal file
31
Services/Hncore.Pass.BaseInfo/Domain/WxAppUserEntity.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public partial class WxAppUserEntity : EntityWithDelete<int>, ITenant
|
||||
{
|
||||
public int TenantId { get; set; } = 0;
|
||||
public int StoreId { get; set; } = 0;
|
||||
public string Appid { get; set; }
|
||||
public int AppType { get; set; } = 0;
|
||||
public int UserId { get; set; }
|
||||
public string Unionid { get; set; }
|
||||
public string Openid { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string HeadImgUrl { get; set; }
|
||||
public int Sex { get; set; }
|
||||
public string City { get; set; }
|
||||
public string Country { get; set; }
|
||||
public int IsSubscribe { get; set; }
|
||||
public int InvateUserId { get; set; }
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
public DateTime UpdateTime{ get; set; } = DateTime.Now;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public class etor_authority_managerdatadomain
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水id
|
||||
/// <summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int owner_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int updatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int creatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// </summary>
|
||||
public int managerid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小区/写字楼编码
|
||||
/// </summary>
|
||||
public int projectcode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
61
Services/Hncore.Pass.BaseInfo/Domain/etor_authority_role.cs
Normal file
61
Services/Hncore.Pass.BaseInfo/Domain/etor_authority_role.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Models
|
||||
{
|
||||
public class etor_authority_role
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
/// <summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int owner_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int updatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int creatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色名称[16]
|
||||
/// </summary>
|
||||
public string rolename { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public byte state { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否物业的根角色(超级管理员角色)
|
||||
/// </summary>
|
||||
public bool isroot { get; set; }
|
||||
/// <summary>
|
||||
/// 系统ID
|
||||
/// </summary>
|
||||
public int systemid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
namespace Etor.PSIP.BaseInfo.Models
|
||||
{
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// 缴费项目关联表
|
||||
/// </summary>
|
||||
public partial class etor_property_feeitem_relation
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 流水id
|
||||
/// <summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int owner_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int updatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int creatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收费项目id
|
||||
/// </summary>
|
||||
public int feeitemid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 收费标准id
|
||||
/// </summary>
|
||||
public int feestandardid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime begintime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有结束时间
|
||||
/// </summary>
|
||||
public bool islong { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额计算方式为每户单独输入
|
||||
/// </summary>
|
||||
public decimal amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public DateTime? endtime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 缴费类型 房屋
|
||||
/// </summary>
|
||||
public int sourcetype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 缴费 房屋
|
||||
/// </summary>
|
||||
public string sourcecode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注[100]
|
||||
/// </summary>
|
||||
public string bak { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账单生成时间
|
||||
/// </summary>
|
||||
public DateTime billtime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
53
Services/Hncore.Pass.BaseInfo/Hncore.Pass.BaseInfo.csproj
Normal file
53
Services/Hncore.Pass.BaseInfo/Hncore.Pass.BaseInfo.csproj
Normal file
@@ -0,0 +1,53 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<NoWarn>1701;1702;1998</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Response\Room\**" />
|
||||
<Content Remove="Response\Room\**" />
|
||||
<EmbeddedResource Remove="Response\Room\**" />
|
||||
<None Remove="Response\Room\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Domain\etor_property_feeitem_relation.cs" />
|
||||
<Compile Remove="Request\QueryPropertyFeeitemRequest.cs" />
|
||||
<Compile Remove="Response\QueryPropertyFeeitemResponse.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.App">
|
||||
<PrivateAssets Condition="'%(PackageReference.Version)' == ''">all</PrivateAssets>
|
||||
<Publish Condition="'%(PackageReference.Version)' == ''">true</Publish>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
|
||||
<PackageReference Include="NPinyin.Core" Version="2.1.3" />
|
||||
<PackageReference Include="PinYinConverterCore" Version="1.0.2" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
|
||||
<PackageReference Include="ThoughtWorks.QRCode.Core" Version="1.0.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Infrastructure\Hncore.Infrastructure\Hncore.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\Hncore.Pass.Sells\Hncore.Pass.Sells.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="AppData\enums.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
17
Services/Hncore.Pass.BaseInfo/Map/MapConfig.cs
Normal file
17
Services/Hncore.Pass.BaseInfo/Map/MapConfig.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Map
|
||||
{
|
||||
public class MapConfig
|
||||
{
|
||||
public static void Config()
|
||||
{
|
||||
TinyMapperExtension.Binds<WxLoginRequest, WxAppUserEntity>();
|
||||
|
||||
TinyMapperExtension.Binds<PostUserRequest, User>();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Services/Hncore.Pass.BaseInfo/Program.cs
Normal file
32
Services/Hncore.Pass.BaseInfo/Program.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
|
||||
{
|
||||
LogHelper.Fatal("未捕获的异常", e.ExceptionObject.ToString());
|
||||
};
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (_, ev) => { LogHelper.Fatal("未捕获的异常", ev.Exception); };
|
||||
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>();
|
||||
}
|
||||
}
|
||||
27
Services/Hncore.Pass.BaseInfo/Properties/launchSettings.json
Normal file
27
Services/Hncore.Pass.BaseInfo/Properties/launchSettings.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:16867",
|
||||
"sslPort": 44324
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Hncore.Pass.BaseInfo": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5008"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.Manager
|
||||
{
|
||||
public class AgainTokenDTO
|
||||
{
|
||||
public string Token { get; set; }
|
||||
/// <summary>
|
||||
/// 0刷新过期时间,1刷新管理项目
|
||||
/// </summary>
|
||||
public AgainTokenType Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
namespace Hncore.Pass.BaseInfo.Request
|
||||
{
|
||||
public class LoginRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public System.String Logincode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public System.String Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 验证码key
|
||||
/// </summary>
|
||||
public string CodeKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Etor.Infrastructure.WebApi;
|
||||
using Etor.PSIP.BaseInfo.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Etor.PSIP.BaseInfo.Request
|
||||
{
|
||||
public class QueryPropertyFeeitemRequest: PageRequestBase
|
||||
{
|
||||
[FromQuery(Name = "data.SceneType")] public SceneType SceneType { get; set; }
|
||||
public BillSourceType? BillSourceType { get; set; }
|
||||
|
||||
}
|
||||
//Request URL: https://psiptestapi.wx.weiyu.etor.vip/api/v1/PropertyFeeitem/
|
||||
//GetByScene?PageIndex=&PageSize=&OwnerID=1157&OperaterID=282&ProjectCode=&uuid=+&Data=&data.SceneType=2
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class AmountDetailRequest
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
public ScoreType OpAmountType { get; set; }
|
||||
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
public string AttchInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request
|
||||
{
|
||||
public class CreateOrderRequest {
|
||||
public decimal ChargeAmount { get; set; }
|
||||
public UPayChannel PayChannel { get; set; }
|
||||
|
||||
public string Channel { get; set; }
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class PostUserRequest
|
||||
{
|
||||
|
||||
public int Id { get; set; }
|
||||
/// <summary>
|
||||
/// 管理员登录名[16
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public int Profile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public int Remark { get; set; }
|
||||
|
||||
public string QQ { get; set; }
|
||||
|
||||
public string Wx { get; set; }
|
||||
public string TaoBao { get; set; }
|
||||
public string Email { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class QueryAmountRequest: PageRequestBase
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
|
||||
public int? Type { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class QueryChargeOrdertRequest : PageRequestBase
|
||||
{
|
||||
public DateTime? BTime { get; set; }
|
||||
public DateTime? ETime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class QueryUserRequest : PageRequestBase
|
||||
{
|
||||
public int? All { get; set; } = 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class SetManagerRequest
|
||||
{
|
||||
public int ManagerId { get; set; }
|
||||
public string ManagerName { get; set; }
|
||||
public List<int> UserIds { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class UpdateAmountRequest
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string OperateUserName { get; set; }
|
||||
|
||||
public ScoreType OpAmountType { get; set; }
|
||||
|
||||
public decimal Amount { get; set; }
|
||||
|
||||
public string AttchInfo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class UpdateProfileRequest
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
|
||||
public string Profile { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class UpdateTestCountRequest
|
||||
{
|
||||
public int UserId { get; set; }
|
||||
public int Limit { get; set; }
|
||||
}
|
||||
}
|
||||
44
Services/Hncore.Pass.BaseInfo/Request/User/WxAuthUserInfo.cs
Normal file
44
Services/Hncore.Pass.BaseInfo/Request/User/WxAuthUserInfo.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Request.User
|
||||
{
|
||||
public class WxAuthUserInfo
|
||||
{
|
||||
//
|
||||
// 摘要:
|
||||
// 用户的唯一标识
|
||||
public string openid { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 用户昵称
|
||||
public string nickname { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 用户的性别,值为1时是男性,值为2时是女性,值为0时是未知
|
||||
public int sex { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 用户个人资料填写的省份
|
||||
public string province { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 普通用户个人资料填写的城市
|
||||
public string city { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 国家,如中国为CN
|
||||
public string country { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空
|
||||
public string headimgurl { get; set; }
|
||||
//
|
||||
// 摘要:
|
||||
// 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom) 作者注:其实这个格式称不上JSON,只是个单纯数组。
|
||||
public string[] privilege { get; set; }
|
||||
public string unionid { get; set; }
|
||||
}
|
||||
}
|
||||
16
Services/Hncore.Pass.BaseInfo/Request/User/WxLoginRequest.cs
Normal file
16
Services/Hncore.Pass.BaseInfo/Request/User/WxLoginRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Hncore.Pass.BaseInfo.Request
|
||||
{
|
||||
public class WxLoginRequest
|
||||
{
|
||||
public string AppId { get; set; }
|
||||
public int AppType { get; set; } = 1;
|
||||
public string Unionid { get; set; }
|
||||
public string Openid { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string HeadImgUrl { get; set; }
|
||||
public int Sex { get; set; }
|
||||
public string City { get; set; }
|
||||
public string Country { get; set; }
|
||||
}
|
||||
}
|
||||
214
Services/Hncore.Pass.BaseInfo/Response/Manager/LoginResponse.cs
Normal file
214
Services/Hncore.Pass.BaseInfo/Response/Manager/LoginResponse.cs
Normal file
@@ -0,0 +1,214 @@
|
||||
using System;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Response
|
||||
{
|
||||
public class LoginResponse
|
||||
{
|
||||
public string Token { get; set; }
|
||||
|
||||
public LoginManagerResponse Manager { get; set; }
|
||||
}
|
||||
public class LoginManagerResponse
|
||||
{
|
||||
public System.Int32 ID { get; set; }
|
||||
public System.DateTime CreateTime { get; set; }
|
||||
public System.DateTime UpdateTime { get; set; }
|
||||
public System.Int32 DeleteTag { get; set; }
|
||||
public System.Int32 TenantId { get; set; }
|
||||
public System.Int32 Updatorid { get; set; }
|
||||
public System.Int32 Creatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public System.String Logincode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
///public System.String Password { get; set; }
|
||||
/// <summary>
|
||||
/// 员工id
|
||||
/// </summary>
|
||||
public System.Int32 Workerid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
/// </summary>
|
||||
public System.Int32 Roleid { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 (枚举: ManagerState)
|
||||
/// </summary>
|
||||
//public System.Int32 State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像路径
|
||||
/// </summary>
|
||||
public System.String Photourl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
public string RoleName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 员工姓名
|
||||
/// </summary>
|
||||
public string WorkerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 员工方式
|
||||
/// </summary>
|
||||
public string WorkerMobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联的楼宇数量
|
||||
/// </summary>
|
||||
public int BuildingCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信openid[50]
|
||||
/// </summary>
|
||||
public string Wxopenid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string DepartmentName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string Wxnickname { get; set; }
|
||||
|
||||
public System.String PropertyCompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 真实姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用编码(有值为单一应用,无值为混合应用)
|
||||
/// </summary>
|
||||
public string AppCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 过期时间
|
||||
/// </summary>
|
||||
public DateTime ExpiredTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统有效期
|
||||
/// </summary>
|
||||
public int ValidDays { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是超级管理员
|
||||
/// </summary>
|
||||
public bool IsRootUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public int? Sex { get; set; }
|
||||
|
||||
public LoginManagerResponse FromEntity(Manager manager)
|
||||
{
|
||||
ID = manager.Id;
|
||||
CreateTime = manager.CreateTime;
|
||||
UpdateTime = manager.UpdateTime;
|
||||
DeleteTag = manager.DeleteTag;
|
||||
TenantId = manager.TenantId;
|
||||
Updatorid = manager.UpdatorId;
|
||||
Creatorid = manager.CreatorId;
|
||||
Logincode = manager.LoginCode;
|
||||
Workerid =0;
|
||||
Roleid = manager.RoleId;
|
||||
Photourl = manager.PhotoUrl;
|
||||
Wxopenid = manager.WxOpenid;
|
||||
Wxnickname = manager.WxNickName;
|
||||
RealName = manager.RealName;
|
||||
Email = manager.Email;
|
||||
Phone = manager.Phone;
|
||||
IsRootUser = manager.IsRoot==1;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 安卓登陆的返回
|
||||
/// </summary>
|
||||
public class LoginAndroidManagerResponse
|
||||
{
|
||||
public System.Int32 ID { get; set; }
|
||||
public System.Int32 OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public System.String Logincode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像路径
|
||||
/// </summary>
|
||||
public System.String Photourl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
public string RoleName { get; set; }
|
||||
|
||||
|
||||
public System.String PropertyCompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 真实姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public int? Sex { get; set; }
|
||||
|
||||
public string Logo { get; set; }
|
||||
|
||||
public LoginAndroidManagerResponse FromEntity(Manager manager)
|
||||
{
|
||||
ID = manager.Id;
|
||||
OwnerId = manager.TenantId;
|
||||
Logincode = manager.LoginCode;
|
||||
Photourl = manager.PhotoUrl;
|
||||
RealName = manager.RealName;
|
||||
Email = manager.Email;
|
||||
Phone = manager.Phone;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Etor.Infrastructure.WebApi;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Etor.PSIP.BaseInfo.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// 收费输出
|
||||
/// </summary>
|
||||
public class QueryPropertyFeeitemResponse
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
39
Services/Hncore.Pass.BaseInfo/Response/User/ResponseUser.cs
Normal file
39
Services/Hncore.Pass.BaseInfo/Response/User/ResponseUser.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户统计
|
||||
/// </summary>
|
||||
/// mzh 2018/1/6 add
|
||||
public class PropertyUserStatisticsDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// 总用户数
|
||||
/// </summary>
|
||||
public int AllUserCount { get; set; }
|
||||
/// <summary>
|
||||
/// 已迁入用户数
|
||||
/// </summary>
|
||||
public int InRoomUserCount { get; set; }
|
||||
/// <summary>
|
||||
/// 未审核用户数
|
||||
/// </summary>
|
||||
public int NotCheckUserCount { get; set; }
|
||||
/// <summary>
|
||||
/// 未通过用户数
|
||||
/// </summary>
|
||||
public int NotPassUserCount { get; set; }
|
||||
/// <summary>
|
||||
/// 已迁出用户数
|
||||
/// </summary>
|
||||
public int OutRoomUserCount { get; set; }
|
||||
/// <summary>
|
||||
/// 黑名单用户数
|
||||
/// </summary>
|
||||
public int BlackUserCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Response
|
||||
{
|
||||
public class UserLoginResponse
|
||||
{
|
||||
public string Token { get; set; }
|
||||
|
||||
public WxMpUserModel MpUser{get;set;}
|
||||
|
||||
public UserLoginModel User { get; set; }
|
||||
}
|
||||
public class UserLoginModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
public string LoginCode { get; set; }
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public string Profile { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址[30
|
||||
/// </summary>
|
||||
public string PhotoUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主管理员权限
|
||||
/// </summary>
|
||||
public DateTime? LastLoginDate { get; set; }
|
||||
|
||||
public int Sex { get; set; }
|
||||
public string OpenId { get; set; }
|
||||
public UserLoginModel FromEntity(User manager)
|
||||
{
|
||||
Id = manager.Id;
|
||||
LastLoginDate = manager.LastLoginDate;
|
||||
TenantId = manager.TenantId;
|
||||
LoginCode = manager.LoginCode;
|
||||
Phone = manager.Phone;
|
||||
LoginCode = manager.LoginCode;
|
||||
Profile = manager.Profile;
|
||||
Enabled = manager.Enabled;
|
||||
PhotoUrl = manager.PhotoUrl;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public class WxMpUserModel
|
||||
{
|
||||
public string AppId { get; set; }
|
||||
|
||||
public string OpenId { get; set; }
|
||||
}
|
||||
}
|
||||
342
Services/Hncore.Pass.BaseInfo/Service/ManageService.cs
Normal file
342
Services/Hncore.Pass.BaseInfo/Service/ManageService.cs
Normal file
@@ -0,0 +1,342 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.Serializer;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.Manager;
|
||||
using Hncore.Pass.BaseInfo.Response;
|
||||
using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Serializers;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Service
|
||||
{
|
||||
public class ManageService
|
||||
{
|
||||
private static string _secret = "etor_yh_lzh_20f_2017_PETER";
|
||||
|
||||
private UserDbContext _dbContext;
|
||||
|
||||
public ManageService(UserDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<LoginResponse> Login(LoginRequest request)
|
||||
{
|
||||
if (request == null
|
||||
// || !request.Code.Has()
|
||||
|| !request.CodeKey.Has()
|
||||
|| !request.Logincode.Has()
|
||||
|| !request.Password.Has()
|
||||
)
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
//string valCode = await RedisHelper.GetAsync(request.CodeKey);
|
||||
//if (!valCode.Has() || valCode.ToLower() != request.Code.ToLower())
|
||||
//{
|
||||
// BusinessException.Throw("验证码错误");
|
||||
//}
|
||||
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.FirstOrDefaultAsync(m => (m.LoginCode == request.Logincode || m.Phone == request.Logincode)
|
||||
&& m.State == (int)ManagerState.Enabled);
|
||||
|
||||
if (manage == null)
|
||||
{
|
||||
BusinessException.Throw("登录名不存在");
|
||||
}
|
||||
|
||||
if (HashPassword(request.Password).ToUpper() != manage.Password.ToUpper())
|
||||
{
|
||||
BusinessException.Throw("密码错误");
|
||||
}
|
||||
|
||||
return await LoginInternal(manage);
|
||||
}
|
||||
|
||||
public async Task<LoginResponse> LoginTemp(LoginRequest request)
|
||||
{
|
||||
if (request == null
|
||||
|| !request.Logincode.Has()
|
||||
|| !request.Password.Has()
|
||||
)
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.FirstOrDefaultAsync(m => (m.LoginCode == request.Logincode || m.Phone == request.Logincode)
|
||||
&& m.State == (int)ManagerState.Enabled);
|
||||
|
||||
if (manage == null)
|
||||
{
|
||||
BusinessException.Throw("登录名不存在");
|
||||
}
|
||||
|
||||
if (HashPassword(request.Password).ToUpper() != manage.Password.ToUpper())
|
||||
{
|
||||
BusinessException.Throw("密码错误");
|
||||
}
|
||||
|
||||
return await LoginInternal(manage);
|
||||
}
|
||||
|
||||
public async Task<LoginAndroidManagerResponse> LoginAndroidTemp(LoginRequest request)
|
||||
{
|
||||
if (request == null
|
||||
|| !request.Logincode.Has()
|
||||
|| !request.Password.Has()
|
||||
)
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.FirstOrDefaultAsync(m => (m.LoginCode == request.Logincode || m.Phone == request.Logincode)
|
||||
&& m.DeleteTag == 0
|
||||
&& m.State == (int)ManagerState.Enabled);
|
||||
|
||||
if (manage == null)
|
||||
{
|
||||
BusinessException.Throw("登录名不存在");
|
||||
}
|
||||
|
||||
if (HashPassword(request.Password).ToUpper() != manage.Password.ToUpper())
|
||||
{
|
||||
BusinessException.Throw("密码错误");
|
||||
}
|
||||
|
||||
return await LoginAndroidInternal(manage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过微信的opid登录
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<LoginResponse> LoginOpenid(string openId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(openId))
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
openId = openId.Trim();
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.FirstOrDefaultAsync(m => (m.WxOpenid == openId
|
||||
&& m.DeleteTag == 0
|
||||
&& m.State == (int)ManagerState.Enabled));
|
||||
if (manage == null)
|
||||
{
|
||||
BusinessException.Throw("没有绑定微信登录");
|
||||
}
|
||||
|
||||
return await LoginInternal(manage);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过微信的opid登录
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<string> GenerateTokenByOpenid(string openId)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(openId))
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
openId = openId.Trim();
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.FirstOrDefaultAsync(m => (m.WxOpenid == openId
|
||||
&& m.DeleteTag == 0
|
||||
&& m.State == (int)ManagerState.Enabled));
|
||||
if (manage == null)
|
||||
{
|
||||
BusinessException.Throw("没有绑定微信登录");
|
||||
}
|
||||
|
||||
var tokenDic = new Dictionary<string, object>()
|
||||
{
|
||||
{"OpenId",openId},
|
||||
{"LoginName", manage.LoginCode},
|
||||
{"RoleName", ""},
|
||||
{"OperaterID", manage.Id},
|
||||
{"TenantId", manage.TenantId}
|
||||
};
|
||||
|
||||
var token = GenerateToken(tokenDic);
|
||||
return token;
|
||||
}
|
||||
|
||||
private async Task<LoginResponse> LoginInternal(Manager manage)
|
||||
{
|
||||
var tokenDic = new Dictionary<string, object>()
|
||||
{
|
||||
{"LoginName", manage.LoginCode},
|
||||
{"RoleName", ""},
|
||||
{"OperaterID", manage.Id},
|
||||
{"TenantId", manage.TenantId}
|
||||
};
|
||||
|
||||
if (manage.IsRoot != 1)
|
||||
{
|
||||
//int[] domains = await _dbContext.Set<etor_authority_managerdatadomain>()
|
||||
// .Where(p => p.owner_id == manage.TenantId && p.DeleteTag == 0 && p.managerid == manage.Id)
|
||||
// .Select(t => t.projectcode)
|
||||
// .ToArrayAsync();
|
||||
|
||||
//tokenDic.Add("DataDomain", domains);
|
||||
}
|
||||
|
||||
var token = GenerateToken(tokenDic);
|
||||
|
||||
var response = new LoginManagerResponse().FromEntity(manage);
|
||||
return new LoginResponse()
|
||||
{
|
||||
Token = token,
|
||||
Manager = response
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// 重新获取token
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<string> AgainGetToken(RequestBase<AgainTokenDTO> request)
|
||||
{
|
||||
if (null == request|| request.Data==null) BusinessException.Throw("参数错误");
|
||||
var token = request.Data.Token;
|
||||
var ManageUserInfo = new ManageUserInfo();
|
||||
if (CheckToken(request.Data.Token, out ManageUserInfo))
|
||||
{
|
||||
var tokenDic = new Dictionary<string, object>()
|
||||
{
|
||||
{"LoginName", ManageUserInfo.LoginName},
|
||||
{"RoleName", ManageUserInfo.RoleName},
|
||||
{"OperaterID", ManageUserInfo.OperaterId},
|
||||
{"OwnerID", ManageUserInfo.TenantId}
|
||||
};
|
||||
switch (request.Data.Type)
|
||||
{
|
||||
case AgainTokenType.Expire:
|
||||
break;
|
||||
//case AgainTokenType.Project:
|
||||
// var manager = await _dbContext.Set<Manager>()
|
||||
// .FirstOrDefaultAsync(s=>s.Id == request.OperaterId);
|
||||
// if (manager.IsRoot != 1)
|
||||
// {
|
||||
// int[] domains = await _dbContext.Set<etor_authority_managerdatadomain>()
|
||||
// .Where(p => p.owner_id == manager.TenantId && p.DeleteTag == 0 && p.managerid == manager.Id)
|
||||
// .Select(t => t.projectcode)
|
||||
// .ToArrayAsync();
|
||||
|
||||
// tokenDic.Add("DataDomain", domains);
|
||||
// }
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
token = GenerateToken(tokenDic);
|
||||
}
|
||||
else
|
||||
{
|
||||
BusinessException.Throw("参数错误");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private async Task<LoginAndroidManagerResponse> LoginAndroidInternal(Manager manage)
|
||||
{
|
||||
var response = new LoginAndroidManagerResponse().FromEntity(manage);
|
||||
return response;
|
||||
}
|
||||
|
||||
private static string GenerateToken(Dictionary<string, object> param, int timeoutMinutes = 180)
|
||||
{
|
||||
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
|
||||
IJsonSerializer serializer = new JsonNetSerializer();
|
||||
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
|
||||
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
|
||||
|
||||
long now = DateTimeHelper.ToUnixTimestamp(DateTime.Now);
|
||||
|
||||
param["iat"] = now; //签发时间
|
||||
param["exp"] = now + Math.Max(0, timeoutMinutes) * 60; //过期时间
|
||||
|
||||
var token = encoder.Encode(param, _secret);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
public bool CheckToken(string token, out ManageUserInfo userInfo)
|
||||
{
|
||||
userInfo = null;
|
||||
try
|
||||
{
|
||||
IJsonSerializer serializer = new JsonNetSerializer();
|
||||
IDateTimeProvider provider = new UtcDateTimeProvider();
|
||||
IJwtValidator validator = new JwtValidator(serializer, provider);
|
||||
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
|
||||
IJwtDecoder decoder = new JwtDecoder(serializer, validator, urlEncoder);
|
||||
var payload = decoder.Decode(token, _secret, verify: true);
|
||||
|
||||
userInfo = payload.FromJsonTo<ManageUserInfo>();
|
||||
|
||||
if (userInfo == null || userInfo.TenantId == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.IssueTimestamp == 0
|
||||
|| DateTimeHelper.UnixTimeStampToDateTime(userInfo.IssueTimestamp) <
|
||||
DateTime.Now.AddHours(-4))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (TokenExpiredException ex)
|
||||
{
|
||||
LogHelper.Error("oken has expired", ex.Message);
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error("CheckToken失败", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static string HashPassword(string password)
|
||||
{
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
byte[] bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
||||
return Convert.ToBase64String(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Manager> GetById(int id)
|
||||
{
|
||||
var manage = await _dbContext.Set<Manager>().FindAsync(id);
|
||||
|
||||
return manage;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
115
Services/Hncore.Pass.BaseInfo/Service/UserChargeOrderService.cs
Normal file
115
Services/Hncore.Pass.BaseInfo/Service/UserChargeOrderService.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Vpn.Service
|
||||
{
|
||||
public partial class UserChargeOrderService : ServiceBase<UserChargeOrderEntity>, IFindService
|
||||
{
|
||||
UserDbContext m_DbContext;
|
||||
UserService m_UserService;
|
||||
public UserChargeOrderService(UserDbContext dbContext
|
||||
, UserService _UserService
|
||||
, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
m_DbContext = dbContext;
|
||||
m_UserService = _UserService;
|
||||
}
|
||||
|
||||
public async Task<ApiResult<UserChargeOrderEntity>> CreateOrder(CreateOrderRequest request, int userId)
|
||||
{
|
||||
if (request.ChargeAmount <= 0)
|
||||
{
|
||||
BusinessException.Throw("充值金额不正确");
|
||||
}
|
||||
var userEntity = await m_UserService.GetById(userId);
|
||||
|
||||
if (userEntity == null)
|
||||
{
|
||||
BusinessException.Throw("用户不存在");
|
||||
}
|
||||
var order = new UserChargeOrderEntity()
|
||||
{
|
||||
OrderName = $"充值{request.ChargeAmount}",
|
||||
OrderNo = GeneratOrderNO(userId),
|
||||
OrderState = UOrderStatus.NoPay,
|
||||
UserId = userId,
|
||||
UserName = userEntity.LoginCode,
|
||||
PayChannel = request.PayChannel,
|
||||
Channel = request.Channel,
|
||||
OrderAmount = request.ChargeAmount,
|
||||
PaymentAmount = request.ChargeAmount,
|
||||
};
|
||||
await this.Add(order);
|
||||
return new ApiResult<UserChargeOrderEntity>(order);
|
||||
}
|
||||
|
||||
private string GeneratOrderNO(int userId)
|
||||
{
|
||||
var code = ValidateCodeHelper.MakeNumCode(6);
|
||||
var userStr = userId.ToString().PadRight(6, '0');
|
||||
var str = $"{DateTime.Now.ToString("yyyyMMdd")}{userStr}{code}";
|
||||
var pre = "cz";
|
||||
return pre + str;
|
||||
}
|
||||
|
||||
public async Task<UserChargeOrderEntity> GetOrderByNo(string no, UOrderStatus status = 0)
|
||||
{
|
||||
var order = await this.Query(m => m.OrderNo == no && (status == 0 || m.OrderState == status)).FirstOrDefaultAsync();
|
||||
return order;
|
||||
}
|
||||
|
||||
public async Task<List<UserChargeOrderEntity>> GetOrders(UOrderStatus status = 0, int top = 100)
|
||||
{
|
||||
var orders = await this.Query(m => m.OrderState == status).OrderByDescending(m => m.Id).Take(top).ToListAsync();
|
||||
return orders;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 处理成功的订单
|
||||
/// </summary>
|
||||
/// <param name="order"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ProcessOrderAccount(UserChargeOrderEntity order)
|
||||
{
|
||||
if (order.OrderState != UOrderStatus.PayOk) return false;
|
||||
|
||||
var request = new UpdateAmountRequest()
|
||||
{
|
||||
Amount = order.OrderAmount,
|
||||
AttchInfo = order.OrderNo,
|
||||
OpAmountType = ScoreType.UserCharge,
|
||||
OperateUserName = order.UserName,
|
||||
UserId = order.UserId
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
var ret = await m_UserService.UpdateAmount(request);
|
||||
if (ret.Code == ResultCode.C_SUCCESS)
|
||||
{
|
||||
order.OrderState = UOrderStatus.Complete;
|
||||
await this.Update(order);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Error("处理充值订单", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
Services/Hncore.Pass.BaseInfo/Service/UserScoreService.cs
Normal file
70
Services/Hncore.Pass.BaseInfo/Service/UserScoreService.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Service
|
||||
{
|
||||
public class UserScoreService : ServiceBase<UserScore>, IFindService
|
||||
{
|
||||
private UserDbContext m_DbContext;
|
||||
public UserScoreService(UserDbContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
m_DbContext = dbContext;
|
||||
}
|
||||
|
||||
public bool ExistTaoBaoScore(string orderNo)
|
||||
{
|
||||
return this.Exist(m => m.ScoreType == ScoreType.TaoBaoAdd && m.Remark == orderNo);
|
||||
}
|
||||
|
||||
public async Task<List<UserScore>> Details(int userId)
|
||||
{
|
||||
return await this.Query(m => m.UserId == userId).OrderByDescending(m => m.Id).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<PageData<UserScore>> Details(QueryAmountRequest request)
|
||||
{
|
||||
|
||||
Expression<Func<UserScore, bool>> exp = m => true;
|
||||
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
exp = exp.And(m => m.UserName.Contains(request.KeyWord) || m.OperateUserName.Contains(request.KeyWord));
|
||||
}
|
||||
if (request.Type.HasValue&&request.Type>0)
|
||||
{
|
||||
exp = exp.And(m => m.ScoreType == (ScoreType)request.Type);
|
||||
}
|
||||
|
||||
return await this.Query(exp).OrderByDescending(m=>m.Id).ListPagerAsync(request.PageSize, request.PageIndex,true);
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<UserScore>> DetailsAll(QueryAmountRequest request)
|
||||
{
|
||||
|
||||
Expression<Func<UserScore, bool>> exp = m => true;
|
||||
|
||||
if (request.KeyWord.Has())
|
||||
{
|
||||
exp = exp.And(m => m.UserName.Contains(request.KeyWord) || m.OperateUserName.Contains(request.KeyWord));
|
||||
}
|
||||
if (request.Type.HasValue && request.Type > 0)
|
||||
{
|
||||
exp = exp.And(m => m.ScoreType == (ScoreType)request.Type);
|
||||
}
|
||||
|
||||
return await this.Query(exp).OrderByDescending(m => m.Id).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
342
Services/Hncore.Pass.BaseInfo/Service/UserService.cs
Normal file
342
Services/Hncore.Pass.BaseInfo/Service/UserService.cs
Normal file
@@ -0,0 +1,342 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Request;
|
||||
using Hncore.Pass.BaseInfo.Request.User;
|
||||
using Hncore.Pass.BaseInfo.Response;
|
||||
using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Serializers;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Service
|
||||
{
|
||||
public class UserService : ServiceBase<User>, IFindService
|
||||
{
|
||||
private static string _secret = "hncore_yh_lzh_20f_2017_PETER";
|
||||
|
||||
private UserDbContext _dbContext;
|
||||
|
||||
private WxAppService m_WxAppService;
|
||||
private WxAppUserService m_WxAppUserService;
|
||||
private UserScoreService m_UserScoreService;
|
||||
private ManageService m_ManageService;
|
||||
|
||||
private static ConcurrentDictionary<int, int> manangeDic = new ConcurrentDictionary<int, int>();
|
||||
public UserService(UserDbContext dbContext
|
||||
, WxAppService _WxAppService
|
||||
, WxAppUserService _WxAppUserService
|
||||
,UserScoreService _UserScoreService
|
||||
, ManageService _ManageService
|
||||
, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
m_WxAppUserService = _WxAppUserService;
|
||||
m_WxAppService = _WxAppService;
|
||||
m_UserScoreService = _UserScoreService;
|
||||
m_ManageService = _ManageService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过微信的opid登录
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<UserLoginResponse> LoginAndBindWx(WxLoginRequest request)
|
||||
{
|
||||
|
||||
if (request == null || request.Openid.NotHas() || request.AppId.NotHas())
|
||||
{
|
||||
BusinessException.Throw("登陆信息异常");
|
||||
}
|
||||
|
||||
var existWxUserInfo = await m_WxAppUserService.GetWxAppUserInfo(request.AppId, request.Openid);
|
||||
if (existWxUserInfo == null || existWxUserInfo.UserId == 0)
|
||||
{
|
||||
var wxApp = await m_WxAppService.GetApp(request.AppId);
|
||||
if (wxApp == null)
|
||||
BusinessException.Throw("没有关联公众号");
|
||||
var userEntity = new User()
|
||||
{
|
||||
Name = request.UserName,
|
||||
PhotoUrl = request.HeadImgUrl,
|
||||
Sex = request.Sex,
|
||||
TenantId = wxApp.TenantId,
|
||||
Password = RandomHelper.GetRandomString(6)
|
||||
};
|
||||
await this.Add(userEntity);
|
||||
var wxUserInfo = request.MapTo<WxAppUserEntity>();
|
||||
wxUserInfo.UserId = userEntity.Id;
|
||||
wxUserInfo.TenantId = wxApp.TenantId;
|
||||
wxUserInfo.StoreId = wxApp.StoreId;
|
||||
existWxUserInfo = await m_WxAppUserService.Bind(wxUserInfo);
|
||||
}
|
||||
var user = new User()
|
||||
{
|
||||
TenantId = existWxUserInfo.TenantId,
|
||||
Id = existWxUserInfo.UserId
|
||||
};
|
||||
var ret = LoginInternal(user, existWxUserInfo);
|
||||
ret.MpUser = new WxMpUserModel()
|
||||
{
|
||||
AppId = request.AppId,
|
||||
OpenId = existWxUserInfo.Openid,
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过微信的opid登录
|
||||
/// </summary>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<UserLoginResponse> Login(LoginRequest request)
|
||||
{
|
||||
|
||||
if (request == null || request.Logincode.NotHas() || request.Password.NotHas())
|
||||
{
|
||||
BusinessException.Throw("用户名或者密码为空");
|
||||
}
|
||||
var userInfo = await this.Query(m => m.LoginCode == request.Logincode && m.Password == HashPassword(request.Password)).FirstOrDefaultAsync();
|
||||
if (userInfo == null)
|
||||
{
|
||||
BusinessException.Throw("用户名或者密码不正确");
|
||||
}
|
||||
var ret = LoginInternal(userInfo);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
public UserLoginResponse LoginInternal(User manage, WxAppUserEntity wxUser)
|
||||
{
|
||||
var tokenDic = new Dictionary<string, object>()
|
||||
{
|
||||
{"LoginName", manage.LoginCode},
|
||||
{ "Name", wxUser.NickName},
|
||||
{"UserId", manage.Id},
|
||||
{"TenantId", manage.TenantId},
|
||||
{"OpenId", wxUser.Openid},
|
||||
{"AppType", wxUser.AppType},
|
||||
{"AppId", wxUser.Appid},
|
||||
{"StoreId", wxUser.StoreId},
|
||||
};
|
||||
var token = GenerateToken(tokenDic);
|
||||
var response = new UserLoginModel().FromEntity(manage);
|
||||
return new UserLoginResponse()
|
||||
{
|
||||
Token = token,
|
||||
User = response
|
||||
};
|
||||
}
|
||||
private UserLoginResponse LoginInternal(User manage)
|
||||
{
|
||||
var tokenDic = new Dictionary<string, object>()
|
||||
{
|
||||
{"LoginName", manage.LoginCode},
|
||||
{ "Name", manage.Name},
|
||||
{"UserId", manage.Id},
|
||||
{"TenantId", manage.TenantId},
|
||||
{"OpenId", ""},
|
||||
{"AppType", ""},
|
||||
{"AppId", ""},
|
||||
{"StoreId", "0"},
|
||||
};
|
||||
var token = GenerateToken(tokenDic);
|
||||
var response = new UserLoginModel().FromEntity(manage);
|
||||
return new UserLoginResponse()
|
||||
{
|
||||
Token = token,
|
||||
User = response
|
||||
};
|
||||
}
|
||||
|
||||
private static string GenerateToken(Dictionary<string, object> param, int timeoutMinutes = 180)
|
||||
{
|
||||
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
|
||||
IJsonSerializer serializer = new JsonNetSerializer();
|
||||
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
|
||||
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
|
||||
|
||||
long now = DateTimeHelper.ToUnixTimestamp(DateTime.Now);
|
||||
|
||||
param["iat"] = now; //签发时间
|
||||
param["exp"] = DateTimeHelper.ToUnixTimestamp(DateTime.Now.AddDays(10)); //now + Math.Max(0, timeoutMinutes) * 60; //过期时间
|
||||
|
||||
var token = encoder.Encode(param, _secret);
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
public static string HashPassword(string password)
|
||||
{
|
||||
using (MD5 md5 = MD5.Create())
|
||||
{
|
||||
byte[] bytes = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
|
||||
return Convert.ToBase64String(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResult> Regist(User entity)
|
||||
{
|
||||
if (entity.LoginCode.NotHas() || entity.Phone.NotHas())
|
||||
{
|
||||
return new ApiResult(ResultCode.C_LONGIN_NAME_ERROR, "账号或者手机号为空");
|
||||
}
|
||||
|
||||
if (this.Exist(m => m.LoginCode == entity.LoginCode || m.Phone == entity.Phone))
|
||||
{
|
||||
return new ApiResult(ResultCode.C_ALREADY_EXISTS_ERROR, "该账号或者手机号被注册了");
|
||||
}
|
||||
entity.Password = HashPassword(entity.Password);
|
||||
|
||||
entity = await this.Add(entity);
|
||||
|
||||
await RandomAssignManager(entity.Id);
|
||||
|
||||
return new ApiResult(entity);
|
||||
}
|
||||
|
||||
public async Task<User> GetByPhone(string phone)
|
||||
{
|
||||
var entity = await this.Query(m => m.Phone == phone).FirstOrDefaultAsync();
|
||||
return entity;
|
||||
}
|
||||
|
||||
public async Task<ApiResult> UpdatePwd(int userId, string oldPwd, string newPwd)
|
||||
{
|
||||
var entity = await this.GetById(userId);
|
||||
if (newPwd.NotHas())
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "新密码不能为空");
|
||||
}
|
||||
if (entity.Password != HashPassword(oldPwd))
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "密码不正确");
|
||||
}
|
||||
entity.Password = HashPassword(newPwd);
|
||||
await this.Update(entity);
|
||||
return new ApiResult(entity);
|
||||
}
|
||||
|
||||
public async Task<ApiResult> UpdatePwd(User entity, string newPwd)
|
||||
{
|
||||
if (newPwd.NotHas())
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "新密码不能为空");
|
||||
}
|
||||
entity.Password = HashPassword(newPwd);
|
||||
await this.Update(entity);
|
||||
return new ApiResult(ResultCode.C_SUCCESS,"重置成功");
|
||||
}
|
||||
|
||||
public async Task<ApiResult> UpdateAmount(UpdateAmountRequest request)
|
||||
{
|
||||
var entity = await this.GetById(request.UserId);
|
||||
if (entity == null)
|
||||
return new ApiResult(ResultCode.C_NOT_EXISTS_ERROR, "用户不存在");
|
||||
if (request.Amount <= 0)
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "金额必须大于0");
|
||||
|
||||
|
||||
var userScore = new UserScore()
|
||||
{
|
||||
UserId = request.UserId,
|
||||
UserName = entity.LoginCode,
|
||||
ScoreType = request.OpAmountType,
|
||||
ScoreValue = request.Amount,
|
||||
ScoreTypeName = request.OpAmountType.GetEnumDisplayName(),
|
||||
Remark = request.AttchInfo,
|
||||
OperateUserName = request.OperateUserName
|
||||
};
|
||||
|
||||
if (request.OpAmountType == ScoreType.ManagerDeduct || request.OpAmountType == ScoreType.Pay)
|
||||
{
|
||||
if (entity.RestAmount < request.Amount)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR, "余额不足");
|
||||
}
|
||||
userScore.RestAmount1 = entity.RestAmount;
|
||||
entity.RestAmount -= request.Amount;
|
||||
userScore.RestAmount2 = entity.RestAmount;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
userScore.RestAmount1 = entity.RestAmount;
|
||||
entity.RestAmount += request.Amount;
|
||||
userScore.RestAmount2 = entity.RestAmount;
|
||||
}
|
||||
|
||||
using (var tran = await m_DbContextBase.Database.BeginTransactionAsync())
|
||||
{
|
||||
try
|
||||
{
|
||||
await m_UserScoreService.Add(userScore);
|
||||
await this.Update(entity);
|
||||
tran.Commit();
|
||||
return new ApiResult(ResultCode.C_SUCCESS);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tran.Rollback();
|
||||
LogHelper.Error("UpdateAmount", ex.Message);
|
||||
return new ApiResult(ResultCode.C_INVALID_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<bool> RandomAssignManager(int userId)
|
||||
{
|
||||
var userEntity = await this.GetById(userId);
|
||||
var manage = await _dbContext.Set<Manager>()
|
||||
.Where(m => m.RoleId == 100).ToListAsync();
|
||||
|
||||
if (manage == null || manage.Count == 0)
|
||||
return false;
|
||||
|
||||
manage.ForEach(m =>
|
||||
{
|
||||
|
||||
if (!manangeDic.ContainsKey(m.Id))
|
||||
manangeDic[m.Id] = 1;
|
||||
|
||||
|
||||
});
|
||||
|
||||
var removeIds = manangeDic.Where(m => !manage.Select(p => p.Id).Contains(m.Key));
|
||||
|
||||
|
||||
foreach (var kv in removeIds)
|
||||
{
|
||||
manangeDic.TryRemove(kv.Key, out int data);
|
||||
}
|
||||
|
||||
var minKv = manangeDic.OrderBy(m => m.Value).FirstOrDefault();
|
||||
|
||||
userEntity.ManagerId = minKv.Key;
|
||||
userEntity.ManagerName = manage.FirstOrDefault(m => m.Id == minKv.Key).RealName;
|
||||
|
||||
await this.Update(userEntity);
|
||||
|
||||
manangeDic[minKv.Key] = manangeDic[minKv.Key] + 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Services/Hncore.Pass.BaseInfo/Service/WxAppService.cs
Normal file
22
Services/Hncore.Pass.BaseInfo/Service/WxAppService.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Service
|
||||
{
|
||||
|
||||
public partial class WxAppService : ServiceBase<WxAppEntity>, IFindService
|
||||
{
|
||||
public WxAppService(UserDbContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public async Task<WxAppEntity> GetApp(string appId,int appType=1)
|
||||
{
|
||||
return await this.Query(m => m.AppType == appType && m.Appid == appId).FirstOrDefaultAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Services/Hncore.Pass.BaseInfo/Service/WxAppUserService.cs
Normal file
63
Services/Hncore.Pass.BaseInfo/Service/WxAppUserService.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.Sells.Service;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Service
|
||||
{
|
||||
|
||||
public partial class WxAppUserService : ServiceBase<WxAppUserEntity>, IFindService
|
||||
{
|
||||
WxAppService m_WxAppService;
|
||||
CouponService couponService;
|
||||
public WxAppUserService(WxAppService _WxAppService, CouponService _couponService, UserDbContext dbContext, IHttpContextAccessor httpContextAccessor) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
m_WxAppService = _WxAppService;
|
||||
couponService = _couponService;
|
||||
}
|
||||
|
||||
public async Task<WxAppUserEntity> GetWxAppUserInfo(string appId,string openId, int appType=1)
|
||||
{
|
||||
var wxappInfo = await this.Query(false).FirstOrDefaultAsync(m => m.Appid == appId&&m.AppType==appType&&m.Openid==openId);
|
||||
|
||||
return wxappInfo;
|
||||
}
|
||||
|
||||
public async Task<WxAppUserEntity> Bind(WxAppUserEntity userInfo)
|
||||
{
|
||||
var wxUserInfo = await GetWxUser(userInfo.Appid, userInfo.Openid);
|
||||
if (wxUserInfo == null)
|
||||
{
|
||||
wxUserInfo = await this.Add(userInfo);
|
||||
}
|
||||
else //if (!string.IsNullOrEmpty(userInfo.Openid))
|
||||
{
|
||||
if (wxUserInfo.UserId == 0 && wxUserInfo.IsSubscribe == 1)
|
||||
{
|
||||
await couponService.Give(5, "", userInfo.UserId, 1, Hncore.Pass.Sells.Domain.Enums.CouponOriginType.MP, "¹Ø×¢¹«ÖÚºÅÔùËÍ");
|
||||
}
|
||||
wxUserInfo.UserId = userInfo.UserId;
|
||||
await this.Update(wxUserInfo);
|
||||
}
|
||||
return wxUserInfo;
|
||||
}
|
||||
|
||||
public async Task<WxAppUserEntity> GetWxUser(string appId, int userId)
|
||||
{
|
||||
return await this.Query(m => m.Appid == appId && m.UserId == userId).FirstOrDefaultAsync();
|
||||
}
|
||||
public async Task<WxAppUserEntity> GetWxUser(string appId, string openId)
|
||||
{
|
||||
return await this.Query(m => m.Appid == appId && m.Openid == openId).FirstOrDefaultAsync();
|
||||
}
|
||||
public WxAppUserEntity GetByOpenId(string openId)
|
||||
{
|
||||
return this.Query(m => m.Openid == openId).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
52
Services/Hncore.Pass.BaseInfo/Startup.cs
Normal file
52
Services/Hncore.Pass.BaseInfo/Startup.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Hncore.Infrastructure.Service;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.BaseInfo.Map;
|
||||
using Hncore.Pass.BaseInfo.Models;
|
||||
using Hncore.Pass.BaseInfo.Service;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
Configuration = env.UseAppsettings();
|
||||
}
|
||||
|
||||
public IServiceProvider ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddDbContext<UserDbContext>(opt => { opt.UseMySql(Configuration["MySql"]); });
|
||||
|
||||
RedisHelper.Initialization(new CSRedis.CSRedisClient(Configuration["Redis"]));
|
||||
|
||||
services.AddHttpClient();
|
||||
|
||||
services.AddScoped<ManageService>();
|
||||
services.AddScoped<UserService>();
|
||||
services.AutoAddService();
|
||||
|
||||
return services.Init(Configuration, CompatibilityVersion.Version_2_2, new ServiceOption
|
||||
{
|
||||
UseGlobalManageAuthFilter = true,
|
||||
IgnoreJsonNullValue=true
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
app.Init(loggerFactory, applicationLifetime);
|
||||
MapConfig.Config();
|
||||
}
|
||||
}
|
||||
}
|
||||
100
Services/Hncore.Pass.BaseInfo/Utils/PinYinHelper.cs
Normal file
100
Services/Hncore.Pass.BaseInfo/Utils/PinYinHelper.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using Microsoft.International.Converters.PinYinConverter;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Common
|
||||
{
|
||||
public class PinYinHelper
|
||||
{
|
||||
/*
|
||||
两种方法共用://优先使用NPinyin,转换失败则用 Pinyinconverter
|
||||
NPinyin 错误集:洺(不识别)
|
||||
Pinyinconverter 多音字错误集:广a,区o,强j。都是多音字
|
||||
*/
|
||||
/// <summary>
|
||||
/// 汉字转全拼
|
||||
/// </summary>
|
||||
/// <param name="strChinese"></param>
|
||||
/// <returns></returns>
|
||||
public static string ConvertToAllSpell(string strChinese)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (strChinese.Length != 0)
|
||||
{
|
||||
StringBuilder fullSpell = new StringBuilder();
|
||||
for (int i = 0; i < strChinese.Length; i++)
|
||||
{
|
||||
var chr = strChinese[i];
|
||||
fullSpell.Append(GetSpell(chr));
|
||||
}
|
||||
|
||||
return fullSpell.ToString().ToUpper();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 汉字转首字母
|
||||
/// </summary>
|
||||
/// <param name="strChinese"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFirstSpell(string strChinese)
|
||||
{
|
||||
//NPinyin.Pinyin.GetInitials(strChinese) 有Bug 洺无法识别
|
||||
//return NPinyin.Pinyin.GetInitials(strChinese);
|
||||
|
||||
try
|
||||
{
|
||||
if (strChinese.Length != 0)
|
||||
{
|
||||
StringBuilder fullSpell = new StringBuilder();
|
||||
for (int i = 0; i < strChinese.Length; i++)
|
||||
{
|
||||
var chr = strChinese[i];
|
||||
fullSpell.Append(GetSpell(chr)[0]);
|
||||
}
|
||||
|
||||
return fullSpell.ToString().ToUpper();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 汉字转拼音
|
||||
/// </summary>
|
||||
/// <param name="chr"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetSpell(char chr)
|
||||
{
|
||||
var coverchr = NPinyin.Pinyin.GetPinyin(chr);
|
||||
//优先使用NPinyin,转换失败则用 Pinyinconverter
|
||||
bool isChineses = ChineseChar.IsValidChar(coverchr[0]);
|
||||
if (isChineses)
|
||||
{
|
||||
ChineseChar chineseChar = new ChineseChar(coverchr[0]);
|
||||
foreach (string value in chineseChar.Pinyins)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
return value.Remove(value.Length - 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return coverchr;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Services/Hncore.Pass.BaseInfo/Utils/RedisConfig.cs
Normal file
18
Services/Hncore.Pass.BaseInfo/Utils/RedisConfig.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Hncore.Infrastructure.Common
|
||||
{
|
||||
public class RedisConfig
|
||||
{
|
||||
public static string EstateKey = "PROPERTY:ESTATE_{0}";
|
||||
public static string RoomKey = "PROPERTY:ESTATE_ROOM_{0}";
|
||||
public static string VISITORKey = "PROPERTY:VISITOR:UNIONID_{0}";
|
||||
public static string WxKey = "Wechat:{0}";
|
||||
public static string Payment = "Payment:{0}";
|
||||
public static string WxOauth = "WxOauth:{0}";
|
||||
public static string FaceVisitor = "FaceVisitor:{0}";
|
||||
public static string Order = "Order:{0}";
|
||||
}
|
||||
}
|
||||
27
Services/Hncore.Pass.BaseInfo/Utils/ValidAttribute.cs
Normal file
27
Services/Hncore.Pass.BaseInfo/Utils/ValidAttribute.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.BaseInfo.Common
|
||||
{
|
||||
///// <summary>
|
||||
///// 自然数0,1,2...
|
||||
///// </summary>
|
||||
//[AttributeUsage(AttributeTargets.Property)]
|
||||
//public class ValidNaturalNumberAttribute : Attribute
|
||||
//{
|
||||
|
||||
//}
|
||||
public sealed class RequiredAttribute : Attribute
|
||||
{
|
||||
public bool Validate(object value)
|
||||
{
|
||||
if (value == null) return true;
|
||||
if (string.IsNullOrEmpty(value.ToString())) return true;
|
||||
if (string.IsNullOrWhiteSpace(value.ToString())) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
10
Services/Hncore.Pass.BaseInfo/appsettings.Development.json
Normal file
10
Services/Hncore.Pass.BaseInfo/appsettings.Development.json
Normal file
@@ -0,0 +1,10 @@
|
||||
//{
|
||||
// "MySql": "Server=rm-bp12e1533udh1827azo.mysql.rds.aliyuncs.com;Database=etor_property_test;User=etor_test;Password=etor_test!QAZ2wsx;Convert Zero Datetime=True;TreatTinyAsBoolean=false;",
|
||||
// "Redis": "47.92.85.90:6379,password=etor0070x01,defaultDatabase=7,poolsize=1"
|
||||
//}
|
||||
{
|
||||
"Host_BaseUrl": "http://ipistest.etor.top11",
|
||||
"Wx_Mp_Appid": "wxd6b150a17c252fec",
|
||||
"MySql": "Server=47.92.244.89;Database=property;User=root;Password=qaz123!@#;Convert Zero Datetime=True;TreatTinyAsBoolean=false;port=5000;",
|
||||
"Redis": "47.92.244.89:8088,password=123456,defaultDatabase=7,poolsize=1"
|
||||
}
|
||||
10
Services/Hncore.Pass.BaseInfo/appsettings.Local.json
Normal file
10
Services/Hncore.Pass.BaseInfo/appsettings.Local.json
Normal file
@@ -0,0 +1,10 @@
|
||||
//{
|
||||
// "MySql": "Server=rm-bp12e1533udh1827azo.mysql.rds.aliyuncs.com;Database=etor_property_test;User=etor_test;Password=etor_test!QAZ2wsx;Convert Zero Datetime=True;TreatTinyAsBoolean=false;",
|
||||
// "Redis": "47.92.85.90:6379,password=etor0070x01,defaultDatabase=7,poolsize=1"
|
||||
//}
|
||||
{
|
||||
"Host_BaseUrl": "http://ipistest.etor.top11",
|
||||
"Wx_Mp_Appid": "wxd6b150a17c252fec",
|
||||
"MySql": "Server=47.92.244.89;Database=property;User=root;Password=qaz123!@#;Convert Zero Datetime=True;TreatTinyAsBoolean=false;port=5000;",
|
||||
"Redis": "47.92.85.90:6379,password=etor0070x01,defaultDatabase=10,poolsize=1"
|
||||
}
|
||||
10
Services/Hncore.Pass.BaseInfo/appsettings.Production.json
Normal file
10
Services/Hncore.Pass.BaseInfo/appsettings.Production.json
Normal file
@@ -0,0 +1,10 @@
|
||||
//{
|
||||
// "MySql": "Server=rm-bp12e1533udh1827azo.mysql.rds.aliyuncs.com;Database=etor_property_test;User=etor_test;Password=etor_test!QAZ2wsx;Convert Zero Datetime=True;TreatTinyAsBoolean=false;",
|
||||
// "Redis": "47.92.85.90:6379,password=etor0070x01,defaultDatabase=7,poolsize=1"
|
||||
//}
|
||||
{
|
||||
"Host_BaseUrl": "http://ipistest.etor.top11",
|
||||
"Wx_Mp_Appid": "wxd6b150a17c252fec",
|
||||
"MySql": "Server=47.92.244.89;Database=property;User=root;Password=qaz123!@#;Convert Zero Datetime=True;TreatTinyAsBoolean=false;port=5000;",
|
||||
"Redis": "47.92.244.89:8088,password=123456,defaultDatabase=7,poolsize=1"
|
||||
}
|
||||
8
Services/Hncore.Pass.BaseInfo/appsettings.json
Normal file
8
Services/Hncore.Pass.BaseInfo/appsettings.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
1
Services/Hncore.Pass.BaseInfo/生成模型.txt
Normal file
1
Services/Hncore.Pass.BaseInfo/生成模型.txt
Normal file
@@ -0,0 +1 @@
|
||||
dotnet ef dbcontext scaffold "Server=47.92.244.89;Database=course;User=root;Password=qaz123!@#;Convert Zero Datetime=True;TreatTinyAsBoolean=false;port=5000;" "Pomelo.EntityFrameworkCore.MySql" -o Domain -t tenant -t manager
|
||||
31
Services/Hncore.Pass.Manage/Configs/AppSettings.cs
Normal file
31
Services/Hncore.Pass.Manage/Configs/AppSettings.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
namespace Hncore.Pass.Manage.Configs
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前Web项目的appsettings.xxx.json配置信息承载类
|
||||
/// </summary>
|
||||
///
|
||||
public class AppSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// 允许的主机列表
|
||||
/// </summary>
|
||||
public string AllowedHosts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 新数据库连接字符串
|
||||
/// </summary>
|
||||
public string DbConString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 旧数据库连接字符串
|
||||
/// </summary>
|
||||
public string OldDbConString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Redis连接信息
|
||||
/// </summary>
|
||||
public string Redis { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
34
Services/Hncore.Pass.Manage/Configs/RabbitMqConfig.cs
Normal file
34
Services/Hncore.Pass.Manage/Configs/RabbitMqConfig.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
namespace Hncore.Pass.Manage.Configs
|
||||
{
|
||||
/// <summary>
|
||||
/// RabbitMQ配置信息承载类
|
||||
/// </summary>
|
||||
///
|
||||
public class RabbitMqConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 主机地址
|
||||
/// </summary>
|
||||
public string HostName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 端口号
|
||||
/// </summary>
|
||||
public string Port { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 虚拟主机路径
|
||||
/// </summary>
|
||||
public string VirtualHost { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Configs;
|
||||
using Hncore.Pass.Manage.Util;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员权限模块专用父控制器(提供了一些在管理员权限模块中专用的功能)
|
||||
/// </summary>
|
||||
///
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/Manage/v{version:apiVersion}/[controller]/[action]")]
|
||||
public class ManageControllerBase : HncoreControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置文件数据承载对象
|
||||
/// </summary>
|
||||
protected readonly AppSettings _appSettings;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="hca">HTTP上下文访问对象</param>
|
||||
///
|
||||
public ManageControllerBase (IHttpContextAccessor hca)
|
||||
{
|
||||
//获取当前应用配置信息承载对象
|
||||
var oa=hca.HttpContext.RequestServices.GetService(typeof(IOptionsMonitor<AppSettings>)) as IOptionsMonitor<AppSettings>;
|
||||
this._appSettings = oa.CurrentValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建成功分页结果对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T">数据类型</typeparam>
|
||||
/// <param name="total">记录总数</param>
|
||||
/// <param name="data">数据对象</param>
|
||||
/// <param name="message">提示信息</param>
|
||||
/// <returns>响应给客户端的结果对象</returns>
|
||||
///
|
||||
protected ApiResultPaged<T> SuccessPaged<T>(int total, T data, string message = "") where T : class, new()
|
||||
{
|
||||
return new ApiResultPaged<T>(ResultCode.C_SUCCESS, message) {TotalCount=total, Data = data };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建失败分页结果对象
|
||||
/// </summary>
|
||||
/// <typeparam name="T">数据类型</typeparam>
|
||||
/// <param name="message">提示信息</param>
|
||||
/// <returns>响应给客户端的结果对象</returns>
|
||||
///
|
||||
protected ApiResultPaged<T> ErrorPaged<T>(string message = "") where T : class, new()
|
||||
{
|
||||
return new ApiResultPaged<T>(ResultCode.C_UNKNOWN_ERROR, message) { TotalCount = 0 };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Pass.Manage.Response;
|
||||
using Hncore.Pass.Manage.Service;
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Response.ManagerToPermission;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Pass.Manage.Repository;
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Pass.ManageDataDomain.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/Manage/v{version:apiVersion}/ManageDataDomain/[action]")]
|
||||
public class ManageDataDomainController : HncoreControllerBase
|
||||
{
|
||||
EfDbContext m_DbContext { get; set; }
|
||||
|
||||
public ManageDataDomainController(EfDbContext _DbContext)
|
||||
{
|
||||
m_DbContext = _DbContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个管理员
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
|
||||
public async Task<ApiResult> GetOne([FromQuery] QueryByIdRequest param)
|
||||
{
|
||||
return Success(await QueryItemManagerResponse.Query(
|
||||
m_DbContext.Set<Manager>().GetQueryable()
|
||||
, m_DbContext.Set<ManagerToPermission>().GetQueryable()
|
||||
, m_DbContext.Set<AuthorityManagerDataDomain>().GetQueryable()
|
||||
, param)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个管理员,门禁调用
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet, AllowAnonymous]
|
||||
|
||||
public async Task<ApiResult> GetOneManage([FromQuery] QueryByIdRequest param)
|
||||
{
|
||||
return Success(await m_DbContext.Set<Manager>().GetOneAsync(p => p.Id == param.Id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取管理员的项目列表
|
||||
/// </summary>
|
||||
/// <param name="request">请求参数对象</param>
|
||||
/// <returns>响应结果对象</returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> Get([FromQuery]int id)
|
||||
{
|
||||
var projectcodes =await m_DbContext.Set<AuthorityManagerDataDomain>().Where(p => p.ManagerId == id && p.DeleteTag == 0).Select(s => s.ProjectCode).ToArrayAsync();
|
||||
var ret = new
|
||||
{
|
||||
Projectcodes = projectcodes,
|
||||
Managerid = id
|
||||
};
|
||||
return Success(ret);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定项目
|
||||
/// </summary>
|
||||
/// <param name="request">请求参数对象</param>
|
||||
/// <returns>响应结果对象</returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> BindDataDomain([FromBody]RequestBase<BindDataDomainRequest> request)
|
||||
{
|
||||
var requestCodes = request.Data.Projectcodes;
|
||||
//获取当前管理员关联的小区编码
|
||||
var currentProjects = await m_DbContext.Set<AuthorityManagerDataDomain>().Where(p => p.TenantId == request.TenantId && p.DeleteTag == 0 && p.ManagerId == request.Data.Managerid).ToListAsync();
|
||||
|
||||
//添加目前未关联的小区编码
|
||||
var addList = new List<AuthorityManagerDataDomain>();
|
||||
var currentCodes = currentProjects.Select(s => s.ProjectCode).ToArray();
|
||||
foreach (var projectCode in requestCodes.Where(code => !currentCodes.Contains(code)))
|
||||
{
|
||||
addList.Add(new AuthorityManagerDataDomain()
|
||||
{
|
||||
ProjectCode = projectCode,
|
||||
CreatorId = request.OperaterId,
|
||||
TenantId = request.TenantId,
|
||||
ManagerId = request.Data.Managerid,
|
||||
UpdatorId = request.OperaterId,
|
||||
});
|
||||
}
|
||||
await m_DbContext.Set<AuthorityManagerDataDomain>().AddRangeAsync(addList);
|
||||
|
||||
//移除将来未关联的小区编码
|
||||
var removeList = new List<AuthorityManagerDataDomain>();
|
||||
var removeCodes = currentCodes.Where(code => !requestCodes.Contains(code)).ToArray();
|
||||
foreach (var managerDataDomain in currentProjects.Where(m => removeCodes.Contains(m.ProjectCode)))
|
||||
{
|
||||
managerDataDomain.UpdatorId = request.OperaterId;
|
||||
managerDataDomain.DeleteTag = 1;
|
||||
removeList.Add(managerDataDomain);
|
||||
}
|
||||
m_DbContext.Set<AuthorityManagerDataDomain>().UpdateRange(removeList);
|
||||
|
||||
//提交
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
return Success(request.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
285
Services/Hncore.Pass.Manage/Controllers/ManagerController.cs
Normal file
285
Services/Hncore.Pass.Manage/Controllers/ManagerController.cs
Normal file
@@ -0,0 +1,285 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Repository;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Pass.Manage.Response;
|
||||
using Hncore.Pass.Manage.Response.ManagerToPermission;
|
||||
using Hncore.Pass.Manage.Service;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
|
||||
public class ManagerController : ManageControllerBase
|
||||
{
|
||||
EfDbContext m_DbContext { get; set; }
|
||||
|
||||
private ManagerService _managerService;
|
||||
|
||||
|
||||
public ManagerController(EfDbContext _DbContext, ManagerService managerService, IHttpContextAccessor hca) : base(hca)
|
||||
{
|
||||
m_DbContext = _DbContext;
|
||||
_managerService = managerService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建管理员添加权限
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Post([FromBody] EditManagerRequest param)
|
||||
{
|
||||
param.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
var manager = await Manager.Create(param, m_DbContext.Set<Manager>().GetQueryable());
|
||||
await m_DbContext.Set<Manager>().AddAsync(manager);
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
List<ManagerToPermission> list = new List<ManagerToPermission>();
|
||||
foreach (var item in param.Permissions)
|
||||
{
|
||||
if (item.AllowView == 1)
|
||||
{
|
||||
ManagerToPermission mp = new ManagerToPermission();
|
||||
mp.TenantId = param.TenantId;
|
||||
mp.ManagerId = manager.Id;
|
||||
mp.PermissionCode = item.PermissionCode;
|
||||
mp.AllowView = item.AllowView;
|
||||
mp.AllowAdd = item.AllowAdd;
|
||||
mp.AllowEdit = item.AllowEdit;
|
||||
mp.AllowDel = item.AllowDel;
|
||||
mp.CreateTime = DateTime.Now;
|
||||
mp.UpdateTime = DateTime.Now;
|
||||
mp.CreatorId = param.OperaterId;
|
||||
list.Add(mp);
|
||||
}
|
||||
}
|
||||
await m_DbContext.Set<ManagerToPermission>().AddRangeAsync(list);
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
return Success(new EditManagerResponse().FromEntity(manager));
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<ApiResult> Put([FromBody] EditManagerRequest param)
|
||||
{
|
||||
param.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
var manager = await m_DbContext.Set<Manager>().FindByIdAsync(param.Id);
|
||||
await manager.Edit(param, m_DbContext.Set<Manager>().GetQueryable());
|
||||
|
||||
List<ManagerToPermission> list = new List<ManagerToPermission>();
|
||||
List<ManagerToPermission> listdel = new List<ManagerToPermission>();
|
||||
foreach (var item in param.Permissions)
|
||||
{
|
||||
if (item.AllowView == 1)
|
||||
{
|
||||
ManagerToPermission mp = new ManagerToPermission();
|
||||
mp.TenantId = param.TenantId;
|
||||
mp.ManagerId = manager.Id;
|
||||
mp.PermissionCode = item.PermissionCode;
|
||||
mp.AllowView = item.AllowView;
|
||||
mp.AllowAdd = item.AllowAdd;
|
||||
mp.AllowEdit = item.AllowEdit;
|
||||
mp.AllowDel = item.AllowDel;
|
||||
mp.CreateTime = DateTime.Now;
|
||||
mp.UpdateTime = DateTime.Now;
|
||||
mp.CreatorId = param.OperaterId;
|
||||
list.Add(mp);
|
||||
}
|
||||
}
|
||||
var search = m_DbContext.Set<ManagerToPermission>().GetQueryable().Where(p => p.DeleteTag == 0 && p.ManagerId == param.Id);
|
||||
foreach (var item in search)
|
||||
{
|
||||
listdel.Add(item);
|
||||
}
|
||||
m_DbContext.Set<ManagerToPermission>().RemoveRange(listdel);
|
||||
await m_DbContext.Set<ManagerToPermission>().AddRangeAsync(list);
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
return Success(new EditManagerResponse().FromEntity(manager));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除管理员
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Delete([FromBody] DelManagerRequest param)
|
||||
{
|
||||
var manager = await m_DbContext.Set<Manager>().FindByIdAsync(param.Id);
|
||||
manager.Delete(param.OperaterId);
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
return Success(manager);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个管理员
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
|
||||
public async Task<ApiResult> GetOne([FromQuery] QueryByIdRequest param)
|
||||
{
|
||||
param.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
return Success(await QueryItemManagerResponse.Query(
|
||||
m_DbContext.Set<Manager>().GetQueryable()
|
||||
, m_DbContext.Set<ManagerToPermission>().GetQueryable()
|
||||
, m_DbContext.Set<AuthorityManagerDataDomain>().GetQueryable()
|
||||
, param)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个管理员,门禁调用
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet,AllowAnonymous]
|
||||
|
||||
public async Task<ApiResult> GetOneManage([FromQuery] QueryByIdRequest param)
|
||||
{
|
||||
return Success(await m_DbContext.Set<Manager>().GetOneAsync(p=>p.Id==param.Id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表数据
|
||||
/// </summary>
|
||||
/// <param name="request">请求参数对象</param>
|
||||
/// <returns>响应结果对象</returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult<List<QueryListManagerResponse>>> Get([FromQuery]QueryListManagerRequest request)
|
||||
{
|
||||
request.TenantId = this.Request.GetManageUserInfo().TenantId;
|
||||
request.OperaterId = this.Request.GetManageUserInfo().OperaterId;
|
||||
(int total, List<QueryListManagerResponse> list) res = await _managerService.Get(request);
|
||||
return SuccessPaged(res.total, res.list, "成功");
|
||||
}
|
||||
/// <summary>
|
||||
/// 超级管理员移交管理员权限
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost,AllowAnonymous]
|
||||
public async Task<ApiResult> TransferPrivilege([FromBody] RequestBase<TransferPrivilegeDTO> param)
|
||||
{
|
||||
#region 需要后台判断短信验证码防非法操作
|
||||
if (!param.Data.Key.Has() || !param.Data.Code.Has()) return Error("短信验证码错误");
|
||||
var tmp = RedisHelper.Get<SmsValidDTO>(param.Data.Key);
|
||||
if (tmp==null) return Error("短信验证码过期");
|
||||
if (!string.Equals(tmp.Code, param.Data.Code)) return Error("短信验证码错误");
|
||||
#endregion
|
||||
|
||||
//管理员表操作
|
||||
var manager = await m_DbContext.Set<Manager>().FindByIdAsync(param.OperaterId);
|
||||
manager.IsRoot = false;
|
||||
manager.DeleteTag = 1;
|
||||
m_DbContext.Set<Manager>().Update(manager);
|
||||
|
||||
|
||||
var managernew = await m_DbContext.Set<Manager>().FindByIdAsync(param.Data.Id);
|
||||
managernew.IsRoot = true;
|
||||
m_DbContext.Set<Manager>().Update(managernew);
|
||||
|
||||
|
||||
|
||||
///管理员权限表操作
|
||||
var search = m_DbContext.Set<ManagerToPermission>().GetQueryable().Where(p => p.DeleteTag == 0 && p.ManagerId == param.OperaterId && p.TenantId == param.TenantId);
|
||||
foreach (var item in search)
|
||||
{
|
||||
ManagerToPermission mp = new ManagerToPermission();
|
||||
mp.TenantId = param.TenantId;
|
||||
mp.ManagerId = param.Data.Id;
|
||||
mp.PermissionCode = item.PermissionCode;
|
||||
mp.AllowView = item.AllowView;
|
||||
mp.AllowAdd = item.AllowAdd;
|
||||
mp.AllowEdit = item.AllowEdit;
|
||||
mp.AllowDel = item.AllowDel;
|
||||
mp.CreateTime = DateTime.Now;
|
||||
mp.UpdateTime = DateTime.Now;
|
||||
mp.CreatorId = param.OperaterId;
|
||||
m_DbContext.Set<ManagerToPermission>().Add(mp);
|
||||
}
|
||||
var del = m_DbContext.Set<ManagerToPermission>().GetQueryable().Where(p => p.DeleteTag == 0 && p.ManagerId == param.Data.Id && p.TenantId == param.TenantId).ToList();
|
||||
m_DbContext.Set<ManagerToPermission>().RemoveRange(del);
|
||||
|
||||
|
||||
|
||||
//被转移人项目
|
||||
var recipientProject = m_DbContext.Set<AuthorityManagerDataDomain>().GetQueryable().Where(p => p.DeleteTag == 0 && p.ManagerId == param.Data.Id && p.TenantId == param.TenantId);
|
||||
//我的项目
|
||||
var myProject = m_DbContext.Set<AuthorityManagerDataDomain>().GetQueryable().Where(p => p.DeleteTag == 0 && p.ManagerId == param.OperaterId && p.TenantId == param.TenantId);
|
||||
foreach (var item in recipientProject)
|
||||
{
|
||||
item.DeleteTag = 1;
|
||||
m_DbContext.Set<AuthorityManagerDataDomain>().Update(item);
|
||||
}
|
||||
foreach (var item in myProject)
|
||||
{
|
||||
item.DeleteTag = 1;
|
||||
m_DbContext.Set<AuthorityManagerDataDomain>().Update(item);
|
||||
}
|
||||
|
||||
//物业总项目
|
||||
var ownerProject = m_DbContext.Set<etor_property_estate>().GetQueryable().Where(p => p.DeleteTag == 0 && p.owner_id == param.TenantId);
|
||||
foreach (var item in ownerProject)
|
||||
{
|
||||
AuthorityManagerDataDomain mp = new AuthorityManagerDataDomain();
|
||||
mp.TenantId = item.owner_id;
|
||||
mp.ProjectCode = item.projectcode;
|
||||
mp.DeleteTag = 0;
|
||||
mp.ManagerId = param.Data.Id;
|
||||
mp.UpdateTime = DateTime.Now;
|
||||
mp.UpdatorId = param.OperaterId;
|
||||
m_DbContext.Set<AuthorityManagerDataDomain>().Add(mp);
|
||||
}
|
||||
|
||||
var mymanager = await m_DbContext.Set<Manager>().FindByIdAsync(param.OperaterId);
|
||||
mymanager.IsRoot = false;
|
||||
manager.DeleteTag = 1;
|
||||
m_DbContext.Set<Manager>().Update(mymanager);
|
||||
|
||||
await m_DbContext.SaveChangesAsync();
|
||||
|
||||
return Success(param.Data.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据管理员获取管理员小区权限
|
||||
/// </summary>
|
||||
/// <param name="managerId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet,AllowAnonymous]
|
||||
public async Task<ApiResult> GetByManageId([FromQuery] int ManagerId)
|
||||
{
|
||||
var result = await QueryPermissionByManagerIdResponse.GetByManageId(m_DbContext.Set<AuthorityManagerDataDomain>().GetQueryable(), m_DbContext.Set<etor_property_estate>().GetQueryable(), m_DbContext.Set<Manager>().GetQueryable(), ManagerId);
|
||||
return Success(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据当前登录人,查询本物业下边超级管理员手机号
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> GetAdminPhoneByManageId([FromQuery] QueryByIdRequest param)
|
||||
{
|
||||
var result = m_DbContext.Set<Manager>().GetQueryable().Where(p => p.TenantId == param.TenantId && p.IsRoot == true).ToList();
|
||||
|
||||
if (result != null && result.Count() > 0) return Success<string>(result[0].Phone);
|
||||
return Success<string>("");
|
||||
}
|
||||
}
|
||||
}
|
||||
124
Services/Hncore.Pass.Manage/Controllers/ManagerTagController.cs
Normal file
124
Services/Hncore.Pass.Manage/Controllers/ManagerTagController.cs
Normal file
@@ -0,0 +1,124 @@
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Repository;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Pass.Manage.Response;
|
||||
using Hncore.Pass.Manage.Service;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
|
||||
public class ManagerTagController : ManageControllerBase
|
||||
{
|
||||
EfDbContext m_DbContext { get; set; }
|
||||
|
||||
private ManagerTagService _managerTagService;
|
||||
|
||||
|
||||
public ManagerTagController(EfDbContext _DbContext,
|
||||
ManagerTagService managerTagService,
|
||||
IHttpContextAccessor hca) : base(hca)
|
||||
|
||||
{
|
||||
m_DbContext = _DbContext;
|
||||
_managerTagService = managerTagService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取列表数据
|
||||
/// </summary>
|
||||
/// <param name="request">请求参数对象</param>
|
||||
/// <returns>响应结果对象</returns>
|
||||
[HttpGet]
|
||||
|
||||
public async Task<ApiResult<List<ManagerTagResponse>>> GetList([FromQuery]ManagerTagRequest request)
|
||||
{
|
||||
(int total, List<ManagerTagResponse> list) res = await _managerTagService.GetTagList(request);
|
||||
return SuccessPaged(res.total, res.list, "成功");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据管理员标签获取管理员权限
|
||||
/// </summary>
|
||||
/// <param name="request">请求参数对象</param>
|
||||
/// <returns>响应结果对象</returns>
|
||||
[HttpGet]
|
||||
|
||||
public async Task<ApiResult<List<ManagerTagToPermissionResponse>>> GetTagToPerssionList ([FromQuery]ManagerTagToPerRequest request)
|
||||
{
|
||||
(int total, List<ManagerTagToPermissionResponse> list) res = await _managerTagService.GetTagToPerssionList(request);
|
||||
return SuccessPaged(res.total, res.list, "成功");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建管理员标签
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Post([FromBody] RequestBase<EditManagerTagRequest> param)
|
||||
{
|
||||
|
||||
var managerTag = await Domain.ManagerTag.Create(param, m_DbContext.Set<ManagerTag>().GetQueryable());
|
||||
m_DbContext.Set<ManagerTag>().Add(managerTag);
|
||||
var res = UofCommit(() => new CreateOrEditManagerTagResponse().FromEntity(managerTag));
|
||||
|
||||
List< ManagerTagToPermission> list =new List<ManagerTagToPermission>();
|
||||
foreach (var item in param.Data.Permissions)
|
||||
{
|
||||
ManagerTagToPermission mp =new ManagerTagToPermission();
|
||||
mp.OwnerId = param.TenantId;
|
||||
mp.ManagerTagId = managerTag.Id;
|
||||
mp.PermissionCode = item.PermissionCode;
|
||||
mp.AllowView = item.AllowView;
|
||||
mp.AllowAdd = item.AllowAdd;
|
||||
mp.AllowEdit = item.AllowEdit;
|
||||
mp.AllowDel = item.AllowDel;
|
||||
mp.CreateTime = DateTime.Now;
|
||||
mp.UpdateTime = DateTime.Now;
|
||||
mp.CreatorId = param.OperaterId;
|
||||
list.Add(mp);
|
||||
}
|
||||
await m_DbContext.Set<ManagerTagToPermission>().AddRangeAsync(list);
|
||||
return await UofCommitAsync(() => new CreateOrEditManagerTagResponse().FromEntity(managerTag));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑管理员标签
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Put([FromBody] RequestBase<EditManagerTagRequest> param)
|
||||
{
|
||||
var managerTag = await m_DbContext.Set<ManagerTag>().FindByIdAsync(param.Data.Id);
|
||||
await managerTag.Edit(param, m_DbContext.Set<ManagerTag>().GetQueryable());
|
||||
return await UofCommitAsync(() => new CreateOrEditManagerTagResponse().FromEntity(managerTag));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除管理员标签
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Delete([FromBody] QueryByIdRequest param)
|
||||
{
|
||||
var managerTag = await m_DbContext.Set<ManagerTag>().FindByIdAsync(param.Id);
|
||||
managerTag.Delete(param.OperaterId);
|
||||
return await UofCommitAsync(() => managerTag);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Pass.Manage.Response;
|
||||
using Hncore.Pass.Manage.Service;
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Repository;
|
||||
using Hncore.Infrastructure.EF;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
|
||||
public class ManagerToPermissionController : ManageControllerBase
|
||||
{
|
||||
|
||||
EfDbContext m_DbContext { get; set; }
|
||||
|
||||
private ManagerPermissionService _managerPermissionService ;
|
||||
|
||||
public ManagerToPermissionController(EfDbContext _DbContext,
|
||||
ManagerPermissionService managerPermissionService,
|
||||
IHttpContextAccessor hca) : base(hca)
|
||||
{
|
||||
m_DbContext = _DbContext;
|
||||
_managerPermissionService = managerPermissionService;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建管理员权限
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Post([FromBody] RequestBase<EditManagerToPermissionRequest> param)
|
||||
{
|
||||
var managerToPermission = await Domain.ManagerToPermission.Create(param, m_DbContext.Set<ManagerToPermission>().GetQueryable());
|
||||
await m_DbContext.Set<ManagerToPermission>().AddAsync(managerToPermission);
|
||||
return await UofCommitAsync(() => new CreateOrEditManagerToResponse().FromEntity(managerToPermission));
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑管理员权限
|
||||
/// </summary>
|
||||
/// <param name="param"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
|
||||
public async Task<ApiResult> Put([FromBody] RequestBase<EditManagerToPermissionRequest> param)
|
||||
{
|
||||
var managerToPermission = await m_DbContext.Set<ManagerToPermission>().FindByIdAsync(param.Data.Id);
|
||||
|
||||
await managerToPermission.Edit(param, m_DbContext.Set<ManagerToPermission>().GetQueryable());
|
||||
|
||||
return await UofCommitAsync(() => new CreateOrEditManagerToResponse().FromEntity(managerToPermission));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据操作人获取权限
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> GetByOperator([FromQuery]QueryByIdRequest request)
|
||||
{
|
||||
List<QueryPermissionResponse> list = await _managerPermissionService.GetByOperator(request,true);
|
||||
return Success(list, "成功");
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据登录人的权限权限
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<ApiResult> GetPermissions()
|
||||
{
|
||||
QueryByIdRequest request = new QueryByIdRequest() { Id = this.Request.GetManageUserInfo().OperaterId };
|
||||
List<QueryPermissionResponse> list = await _managerPermissionService.GetByOperator(request, false);
|
||||
return Success(list, "成功");
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Services/Hncore.Pass.Manage/Controllers/TestController.cs
Normal file
19
Services/Hncore.Pass.Manage/Controllers/TestController.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Hncore.Pass.Manage.Controllers
|
||||
{
|
||||
[ApiVersion("1.0")]
|
||||
[Route("api/manage/v{version:apiVersion}/test/[action]")]
|
||||
public class TestController: HncoreControllerBase
|
||||
{
|
||||
[HttpGet,AllowAnonymous]
|
||||
public string Name()
|
||||
{
|
||||
|
||||
|
||||
return "Manage";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体模型类
|
||||
/// </summary>
|
||||
///
|
||||
public class AuthorityManagerDataDomain : AggregateRoot<int>, ITenant
|
||||
{
|
||||
/// <summary>
|
||||
/// 楼宇ID
|
||||
/// <summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员数据库ID
|
||||
/// </summary>
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目编码
|
||||
/// </summary>
|
||||
public int ProjectCode { get; set; }
|
||||
}
|
||||
}
|
||||
190
Services/Hncore.Pass.Manage/Domain/Manager.cs
Normal file
190
Services/Hncore.Pass.Manage/Domain/Manager.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using Hncore.Infrastructure.Common;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
/// <summary>
|
||||
/// 物业管理员表
|
||||
/// </summary>
|
||||
public partial class Manager : EntityWithTime<int>, ITenant
|
||||
{
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名[16
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员角色
|
||||
/// </summary>
|
||||
public int RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址[30
|
||||
/// </summary>
|
||||
public string PhotoUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信openid[50]
|
||||
/// </summary>
|
||||
public string WxOpenid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string WxNickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string WxImage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public int Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// 账号code
|
||||
/// </summary>
|
||||
public string ManagerCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主管理员权限
|
||||
/// </summary>
|
||||
public bool IsRoot { get; set; }
|
||||
|
||||
public int SystemId { get; set; }
|
||||
|
||||
private static async Task EditCheckAsync(IQueryable<Manager> queryable, EditManagerRequest request, int id = 0)
|
||||
{
|
||||
|
||||
Expression<Func<Manager, bool>> condition = t => t.LoginCode == request.LoginCode || t.Phone== request.Phone;
|
||||
|
||||
if (id > 0)
|
||||
{
|
||||
condition = condition.And(t => t.Id != id);
|
||||
}
|
||||
|
||||
if (await queryable.AnyAsync(condition))
|
||||
{
|
||||
BusinessException.Throw("管理员手机号或登陆名重复");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建管理员
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<Manager> Create(EditManagerRequest request,
|
||||
IQueryable<Manager> queryable)
|
||||
{
|
||||
await EditCheckAsync(queryable, request, 0);
|
||||
|
||||
var Manager = new Manager()
|
||||
{
|
||||
TenantId = request.TenantId,
|
||||
CreatorId = request.OperaterId,
|
||||
UpdatorId = request.OperaterId,
|
||||
CreateTime = DateTime.Now,
|
||||
UpdateTime = DateTime.Now,
|
||||
LoginCode = request.LoginCode,
|
||||
Password = SecurityHelper.HashPassword(request.Password),
|
||||
PhotoUrl = request.photourl,
|
||||
RealName = request.RealName,
|
||||
|
||||
State = 1,
|
||||
Phone = request.Phone,
|
||||
RoleId = -100, ///新规则的权限用-100标识
|
||||
SystemId = 100,
|
||||
|
||||
};
|
||||
|
||||
return Manager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑管理员
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<Manager> Edit(EditManagerRequest request, IQueryable<Manager> queryable)
|
||||
{
|
||||
|
||||
await EditCheckAsync(queryable, request, request.Id);
|
||||
TenantId = request.TenantId;
|
||||
UpdatorId = request.OperaterId;
|
||||
UpdateTime = DateTime.Now;
|
||||
LoginCode = request.LoginCode;
|
||||
if (!string.IsNullOrEmpty(request.Password))
|
||||
{ Password = SecurityHelper.HashPassword(request.Password); }
|
||||
PhotoUrl = request.photourl;
|
||||
RealName = request.RealName;
|
||||
Phone = request.Phone;
|
||||
RoleId = request.roleid;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 删除管理员
|
||||
/// </summary>
|
||||
/// <param name="updatorId"></param>
|
||||
/// <returns></returns>
|
||||
public Manager Delete(int updatorId)
|
||||
{
|
||||
|
||||
DeleteTag = 1;
|
||||
UpdatorId = updatorId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
156
Services/Hncore.Pass.Manage/Domain/ManagerTag.cs
Normal file
156
Services/Hncore.Pass.Manage/Domain/ManagerTag.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Extension;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
public class ManagerTag : AggregateRoot<int>
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签
|
||||
/// <summary>
|
||||
public string Tag { get; set; }
|
||||
/// <summary>
|
||||
/// 管理员标签类型
|
||||
/// <summary>
|
||||
public int TagType { get; set; }
|
||||
|
||||
private static async Task EditCheckAsync(IQueryable<ManagerTag> queryable, string tag ,int managerId, int id=0 )
|
||||
{
|
||||
|
||||
if(string.IsNullOrWhiteSpace(tag))
|
||||
{
|
||||
BusinessException.Throw("管理员类型名称不能为空");
|
||||
}
|
||||
Expression<Func<ManagerTag, bool>> condition = t => t.Tag == tag && t.ManagerId== managerId;
|
||||
if (id > 0)
|
||||
{
|
||||
condition = condition.And(t => t.Id != id);
|
||||
}
|
||||
if (await queryable.AnyAsync(condition))
|
||||
{
|
||||
BusinessException.Throw("管理员类型重名");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建管理员标签
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<ManagerTag> Create(RequestBase<EditManagerTagRequest> request,
|
||||
IQueryable<ManagerTag> queryable)
|
||||
{
|
||||
await EditCheckAsync(queryable, request.Data.Tag, request.Data.ManagerId);
|
||||
|
||||
await CheckCountAsync(queryable, request.Data.ManagerId);
|
||||
|
||||
var ManagerTag = new ManagerTag()
|
||||
{
|
||||
Tag = request.Data.Tag,
|
||||
ManagerId=request.Data.ManagerId,
|
||||
OwnerId = request.TenantId,
|
||||
CreatorId = request.OperaterId,
|
||||
UpdatorId = request.OperaterId,
|
||||
CreateTime = DateTime.Now,
|
||||
UpdateTime = DateTime.Now
|
||||
};
|
||||
|
||||
return ManagerTag ;
|
||||
}
|
||||
|
||||
private static async Task CheckCountAsync(IQueryable<ManagerTag> queryable, int ManagerId )
|
||||
{
|
||||
|
||||
Expression<Func<ManagerTag, bool>> condition = t => t.ManagerId == ManagerId;
|
||||
int totalcount= queryable.Count(condition);
|
||||
if (totalcount >= 5)
|
||||
{
|
||||
BusinessException.Throw("管理员最多可添加5个类型");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑管理员标签
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ManagerTag> Edit(RequestBase<EditManagerTagRequest> request, IQueryable<ManagerTag> queryable)
|
||||
{
|
||||
await EditCheckAsync(queryable, request.Data.Tag, request.Data.Id);
|
||||
|
||||
Tag = request.Data.Tag;
|
||||
UpdatorId = request.OperaterId;
|
||||
UpdateTime = DateTime.Now;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除管理员标签
|
||||
/// </summary>
|
||||
/// <param name="updatorId"></param>
|
||||
/// <returns></returns>
|
||||
public ManagerTag Delete(int updatorId)
|
||||
{
|
||||
|
||||
DeleteTag = 1;
|
||||
UpdatorId = updatorId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
92
Services/Hncore.Pass.Manage/Domain/ManagerTagToPermission.cs
Normal file
92
Services/Hncore.Pass.Manage/Domain/ManagerTagToPermission.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
public class ManagerTagToPermission : AggregateRoot<int>
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签id
|
||||
/// <summary>
|
||||
public int ManagerTagId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// <summary>
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
public int AllowView { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否添加
|
||||
/// </summary>
|
||||
public int AllowAdd { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否修改
|
||||
/// </summary>
|
||||
public int AllowEdit { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public int AllowDel { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
138
Services/Hncore.Pass.Manage/Domain/ManagerToPermission.cs
Normal file
138
Services/Hncore.Pass.Manage/Domain/ManagerToPermission.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
public class ManagerToPermission : AggregateRoot<int>, ITenant
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int TenantId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// <summary>
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
public int AllowView { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否添加
|
||||
/// </summary>
|
||||
public int AllowAdd { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否修改
|
||||
/// </summary>
|
||||
public int AllowEdit { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public int AllowDel { get; set; }
|
||||
|
||||
public DateTime? ExpiredTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建管理员权限关系
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<ManagerToPermission> Create(RequestBase<EditManagerToPermissionRequest> request,
|
||||
IQueryable<ManagerToPermission> queryable)
|
||||
{
|
||||
|
||||
var ManagerToPermission = new ManagerToPermission()
|
||||
{
|
||||
ManagerId = request.Data.ManagerId,
|
||||
PermissionCode = request.Data.PermissionCode,
|
||||
AllowView = request.Data.AllowView,
|
||||
AllowAdd = request.Data.AllowAdd,
|
||||
AllowEdit = request.Data.AllowEdit,
|
||||
AllowDel = request.Data.AllowDel,
|
||||
|
||||
TenantId = request.TenantId,
|
||||
CreatorId = request.OperaterId,
|
||||
UpdatorId = request.OperaterId,
|
||||
CreateTime = DateTime.Now,
|
||||
UpdateTime = DateTime.Now
|
||||
};
|
||||
|
||||
return ManagerToPermission;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑管理员权限关系
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ManagerToPermission> Edit(RequestBase<EditManagerToPermissionRequest> request, IQueryable<ManagerToPermission> queryable)
|
||||
{
|
||||
|
||||
PermissionCode = request.Data.PermissionCode;
|
||||
UpdatorId = request.OperaterId;
|
||||
UpdateTime = DateTime.Now;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
123
Services/Hncore.Pass.Manage/Domain/Permission.cs
Normal file
123
Services/Hncore.Pass.Manage/Domain/Permission.cs
Normal file
@@ -0,0 +1,123 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
public class Permission : AggregateRoot<int>
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public override int Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// <summary>
|
||||
public string Permissioncode { get; set; }
|
||||
|
||||
|
||||
public string Parentcode { get; set; }
|
||||
|
||||
public string Permissionlabel { get; set; }
|
||||
|
||||
public string Permissionurl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标[50]
|
||||
/// </summary>
|
||||
public string Icon { get; set; }
|
||||
/// <summary>
|
||||
/// 激活图标
|
||||
/// </summary>
|
||||
public string Iconactivate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
public int AllowView { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否添加
|
||||
/// </summary>
|
||||
public int AllowAdd { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否修改
|
||||
/// </summary>
|
||||
public int AllowEdit { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public int AllowDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示排序
|
||||
/// </summary>
|
||||
public int Sortorder { get; set; }
|
||||
/// <summary>
|
||||
/// 是否收费
|
||||
/// </summary>
|
||||
public bool Ischarge { get; set; }
|
||||
/// <summary>
|
||||
/// 模块编码
|
||||
/// </summary>
|
||||
public string Nodecode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否新功能
|
||||
/// </summary>
|
||||
public bool isnew { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统标识
|
||||
/// </summary>
|
||||
public int Systemid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// app权限编码
|
||||
/// </summary>
|
||||
public string Appcodes { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
157
Services/Hncore.Pass.Manage/Domain/etor_property_estate.cs
Normal file
157
Services/Hncore.Pass.Manage/Domain/etor_property_estate.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Infrastructure.EntitiesExtension;
|
||||
using Hncore.Infrastructure.Common;
|
||||
|
||||
namespace Hncore.Pass.Manage.Domain
|
||||
{
|
||||
public partial class etor_property_estate : AggregateRoot<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// 写字楼/小区id
|
||||
/// <summary>
|
||||
public int ID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int owner_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小区/写字楼编码
|
||||
/// </summary>
|
||||
public int projectcode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 写字楼/小区名称
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 首字母
|
||||
/// </summary>
|
||||
public string firstword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
public string location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string bak { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区分小区/写字楼/公寓
|
||||
/// </summary>
|
||||
public int type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 省份
|
||||
/// </summary>
|
||||
public int province { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 市
|
||||
/// </summary>
|
||||
public int city { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 区
|
||||
/// </summary>
|
||||
public int area { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客服电话
|
||||
/// </summary>
|
||||
public string servicetel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
/// </summary>
|
||||
public string director { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 负责人电话
|
||||
/// </summary>
|
||||
public string directortel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小区图标
|
||||
/// </summary>
|
||||
public string logoimg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 占地面积
|
||||
/// </summary>
|
||||
public float? locationarea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 建筑面积
|
||||
/// </summary>
|
||||
public float? buildingarea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公共场所面积
|
||||
/// </summary>
|
||||
public float? publicarea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车位面积
|
||||
/// </summary>
|
||||
public float? parkinglotarea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车库面积
|
||||
/// </summary>
|
||||
public float? parkinghousearea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 车位数
|
||||
/// </summary>
|
||||
public int? parkinglotcount { get; set; }
|
||||
|
||||
|
||||
public int creatorid { get; set; }
|
||||
|
||||
public int updatorid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// pos账号
|
||||
/// </summary>
|
||||
public string posLoginAccount { get; set; }
|
||||
/// <summary>
|
||||
/// 支付商户号
|
||||
/// </summary>
|
||||
public string pay_mch_id { get; set; }
|
||||
/// <summary>
|
||||
/// 支付密钥
|
||||
/// </summary>
|
||||
public string pay_key { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// 全局异常过滤器(主要是发生异常后写日志)
|
||||
/// </summary>
|
||||
///
|
||||
public class HttpGlobalExceptionFilter : IExceptionFilter
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志工厂对象
|
||||
/// </summary>
|
||||
readonly ILoggerFactory _loggerFactory;
|
||||
/// <summary>
|
||||
/// 主机环境对象
|
||||
/// </summary>
|
||||
readonly IHostingEnvironment _env;
|
||||
|
||||
public HttpGlobalExceptionFilter(ILoggerFactory loggerFactory, IHostingEnvironment env)
|
||||
{
|
||||
_loggerFactory = loggerFactory;
|
||||
_env = env;
|
||||
}
|
||||
|
||||
public void OnException(ExceptionContext context)
|
||||
{
|
||||
throw context.Exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
49
Services/Hncore.Pass.Manage/Hncore.Pass.Manage.csproj
Normal file
49
Services/Hncore.Pass.Manage/Hncore.Pass.Manage.csproj
Normal file
@@ -0,0 +1,49 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<ServerGarbageCollection>false</ServerGarbageCollection>
|
||||
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Domain\BaseSetting\**" />
|
||||
<Compile Remove="Models\**" />
|
||||
<Content Remove="Domain\BaseSetting\**" />
|
||||
<Content Remove="Models\**" />
|
||||
<EmbeddedResource Remove="Domain\BaseSetting\**" />
|
||||
<EmbeddedResource Remove="Models\**" />
|
||||
<None Remove="Domain\BaseSetting\**" />
|
||||
<None Remove="Models\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Service\ManageService.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="8.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Repository\Map\BaseSetting\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Infrastructure\Hncore.Infrastructure\Hncore.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ProjectExtensions><VisualStudio><UserProperties appsettings_1Development_1json__JSONSchema="" /></VisualStudio></ProjectExtensions>
|
||||
|
||||
</Project>
|
||||
24
Services/Hncore.Pass.Manage/Program.cs
Normal file
24
Services/Hncore.Pass.Manage/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Hncore.Pass.Manage
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateWebHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
|
||||
WebHost.CreateDefaultBuilder(args)
|
||||
.UseStartup<Startup>();
|
||||
}
|
||||
}
|
||||
27
Services/Hncore.Pass.Manage/Properties/launchSettings.json
Normal file
27
Services/Hncore.Pass.Manage/Properties/launchSettings.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:58643",
|
||||
"sslPort": 44388
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"Hncore.Pass.Manage": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5007"
|
||||
}
|
||||
}
|
||||
}
|
||||
38
Services/Hncore.Pass.Manage/Repository/EfDbContext.cs
Normal file
38
Services/Hncore.Pass.Manage/Repository/EfDbContext.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// EF数据库上下文类
|
||||
/// </summary>
|
||||
///
|
||||
public class EfDbContext : DbContextBase
|
||||
{
|
||||
public DbContext DbContext => this;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="options">上下文实体</param>
|
||||
/// <param name="httpContextAccessor">http请求上下文</param>
|
||||
public EfDbContext(DbContextOptions<EfDbContext> options, IHttpContextAccessor httpContextAccessor) :
|
||||
base(options, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建映射
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.AutoMap(typeof(EfDbContext));
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class AuthorityManagerDataDomainMap : EntityMapBase<AuthorityManagerDataDomain>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<AuthorityManagerDataDomain> builder)
|
||||
{
|
||||
builder.ToTable("etor_authority_managerdatadomain");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
|
||||
builder.Property(t => t.TenantId).HasColumnName("owner_id");//所属物业ID
|
||||
builder.Property(t => t.CreateTime).HasColumnName("createtime");//创建时间
|
||||
builder.Property(t => t.UpdateTime).HasColumnName("updatetime");//更新时间
|
||||
builder.Property(t => t.CreatorId).HasColumnName("creatorid");//创建人ID
|
||||
builder.Property(t => t.UpdatorId).HasColumnName("updatorid");//更新人ID
|
||||
builder.Property(t => t.DeleteTag).HasColumnName("deletetag");//软删除标记
|
||||
builder.Property(t => t.ManagerId).HasColumnName("managerid");//管理员数据库ID
|
||||
builder.Property(t => t.ProjectCode).HasColumnName("projectcode");//项目编码
|
||||
}
|
||||
}
|
||||
}
|
||||
32
Services/Hncore.Pass.Manage/Repository/Map/ManagerMap.cs
Normal file
32
Services/Hncore.Pass.Manage/Repository/Map/ManagerMap.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class ManagerMap : EntityMapBase<Manager>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<Manager> builder)
|
||||
{
|
||||
builder.ToTable("manager");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
}
|
||||
}
|
||||
}
|
||||
45
Services/Hncore.Pass.Manage/Repository/Map/ManagerTagMap.cs
Normal file
45
Services/Hncore.Pass.Manage/Repository/Map/ManagerTagMap.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class ManagerTagMap : EntityMapBase<ManagerTag>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<ManagerTag> builder)
|
||||
{
|
||||
builder.ToTable("etor_authority_managertag");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
|
||||
builder.Property(t => t.OwnerId).HasColumnName("owner_id");//所属物业ID
|
||||
builder.Property(t => t.CreateTime).HasColumnName("createtime");//创建时间
|
||||
builder.Property(t => t.UpdateTime).HasColumnName("updatetime");//更新时间
|
||||
builder.Property(t => t.CreatorId).HasColumnName("creatorid");//创建人ID
|
||||
builder.Property(t => t.UpdatorId).HasColumnName("updatorid");//更新人ID
|
||||
builder.Property(t => t.DeleteTag).HasColumnName("deletetag");//软删除标记
|
||||
|
||||
builder.Property(t => t.ManagerId).HasColumnName("managerid");//管理员id
|
||||
builder.Property(t => t.Tag).HasColumnName("tag");//管理员标签
|
||||
builder.Property(t => t.TagType).HasColumnName("tagtype");//管理员标签
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class ManagerTagToPermissionMap : EntityMapBase<ManagerTagToPermission>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<ManagerTagToPermission> builder)
|
||||
{
|
||||
builder.ToTable("etor_authority_managertagtopermission");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
|
||||
builder.Property(t => t.OwnerId).HasColumnName("owner_id");//所属物业ID
|
||||
builder.Property(t => t.CreateTime).HasColumnName("createtime");//创建时间
|
||||
builder.Property(t => t.UpdateTime).HasColumnName("updatetime");//更新时间
|
||||
builder.Property(t => t.CreatorId).HasColumnName("creatorid");//创建人ID
|
||||
builder.Property(t => t.UpdatorId).HasColumnName("updatorid");//更新人ID
|
||||
builder.Property(t => t.DeleteTag).HasColumnName("deletetag");//软删除标记
|
||||
|
||||
builder.Property(t => t.ManagerTagId).HasColumnName("managertagid");//管理员id
|
||||
builder.Property(t => t.PermissionCode).HasColumnName("permissioncode");//权限编码
|
||||
builder.Property(t => t.AllowView).HasColumnName("allowview");//是否查看
|
||||
builder.Property(t => t.AllowAdd).HasColumnName("allowadd");//是否添加
|
||||
builder.Property(t => t.AllowEdit).HasColumnName("allowedit");//是否编辑
|
||||
builder.Property(t => t.AllowDel).HasColumnName("allowdel");//是否删除
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class ManagerToPermissionMap : EntityMapBase<Domain.ManagerToPermission>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<Domain.ManagerToPermission> builder)
|
||||
{
|
||||
builder.ToTable("manager_permission_map");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
33
Services/Hncore.Pass.Manage/Repository/Map/PermissionMap.cs
Normal file
33
Services/Hncore.Pass.Manage/Repository/Map/PermissionMap.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员项目映射实体表映射类
|
||||
/// </summary>
|
||||
///
|
||||
public class PermissionMap : EntityMapBase<Domain.Permission>
|
||||
{
|
||||
/// <summary>
|
||||
/// 映射方法
|
||||
/// </summary>
|
||||
/// <param name="builder">实体模型构建器</param>
|
||||
///
|
||||
public override void Map(EntityTypeBuilder<Domain.Permission> builder)
|
||||
{
|
||||
builder.ToTable("manager_permission");//指定表名
|
||||
|
||||
builder.HasKey(t => t.Id); //指定主键
|
||||
builder.Property(t => t.Id).HasColumnName("Id").ValueGeneratedOnAdd(); //指定主键在创建的时候自动生成
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Hncore.Infrastructure.EF;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Repository.Map
|
||||
{
|
||||
|
||||
public class etor_property_estateMap : EntityMapBase<etor_property_estate>
|
||||
{
|
||||
public override void Map(EntityTypeBuilder<etor_property_estate> builder)
|
||||
{
|
||||
builder.ToTable("etor_property_estate");
|
||||
|
||||
builder.HasKey(t => t.Id);
|
||||
|
||||
builder.Property(t => t.Id).ValueGeneratedOnAdd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.ManageDataDomain.Request
|
||||
{
|
||||
public class BindDataDomainRequest
|
||||
{
|
||||
public System.Int32 Managerid { get; set; }
|
||||
public System.Int32[] Projectcodes { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class DelManagerRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库id
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class EditManagerRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关联的内部人员id
|
||||
/// </summary>
|
||||
public int workerid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 管理员角色
|
||||
/// </summary>
|
||||
public int roleid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int state { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址[30
|
||||
/// </summary>
|
||||
public string photourl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信openid[50]
|
||||
/// </summary>
|
||||
public string wxopenid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信昵称
|
||||
/// </summary>
|
||||
public string wxnickname { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信头像
|
||||
/// </summary>
|
||||
public string wximage { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册来源
|
||||
/// </summary>
|
||||
public int source { get; set; }
|
||||
/// <summary>
|
||||
/// 系统ID
|
||||
/// </summary>
|
||||
public int systemid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账号code
|
||||
/// </summary>
|
||||
public string managercode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目关联
|
||||
/// </summary>
|
||||
public string ProjectContact { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 权限集合
|
||||
/// </summary>
|
||||
public List<ManagerToPermission> Permissions;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
29
Services/Hncore.Pass.Manage/Request/Manager/LoginRequest.cs
Normal file
29
Services/Hncore.Pass.Manage/Request/Manager/LoginRequest.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class LoginRequest
|
||||
{
|
||||
public LoginRequestData Data { get; set; }
|
||||
}
|
||||
public class LoginRequestData
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录名
|
||||
/// </summary>
|
||||
public System.String Logincode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public System.String Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 验证码key
|
||||
/// </summary>
|
||||
public string CodeKey { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class QueryListManagerRequest :PageRequestBase
|
||||
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询关键字
|
||||
/// </summary>
|
||||
public string KeyWord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IsRoot 查询字管理员列表
|
||||
/// <summary>
|
||||
public int IsRoot { get; set; }
|
||||
}
|
||||
public class TransferPrivilegeDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 短信Key
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 短信Code
|
||||
/// <summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
}
|
||||
public class SmsValidDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信验证码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// <summary>
|
||||
public string TimeStamp { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class QueryManagerRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
[FromQuery(Name = "Data.Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.LoginCode")]
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.Phone")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.RealName")]
|
||||
public string RealName { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 权限集合
|
||||
/// </summary>
|
||||
public List<ManagerToPermission> Permissions;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class EditManagerTagRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 流水id
|
||||
/// </summary>
|
||||
[JsonProperty("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonProperty("Tag")]
|
||||
public string Tag { get; set; }
|
||||
|
||||
[JsonProperty("ManagerId")]
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限集合
|
||||
/// </summary>
|
||||
public List<ManagerTagToPermission> Permissions;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class ManagerTagRequest : RequestBase
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
[FromQuery(Name = "Data.Id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.Tag")]
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.ManagerId")]
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.TagType")]
|
||||
public int TagType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签关联权限对象
|
||||
/// </summary>
|
||||
public class ManagerTagToPerRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
[FromQuery(Name = "Data.Id")]
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 管理员标签id
|
||||
/// </summary>
|
||||
[FromQuery(Name = "Data.ManagerTagId")]
|
||||
public int ManagerTagId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class CreateManagerToPermissionRequest : RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新人ID
|
||||
/// <summary>
|
||||
public int UpdatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人ID
|
||||
/// <summary>
|
||||
public int CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码[20]
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关联的内部人员id
|
||||
/// </summary>
|
||||
public int workerid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 管理员角色
|
||||
/// </summary>
|
||||
public int roleid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int state { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 权限集合
|
||||
/// </summary>
|
||||
public List<ManagerToPermission> Permissions ;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class EditManagerToPermissionRequest : RequestBase
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
[JsonProperty("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// </summary>
|
||||
[JsonProperty("ManagerId")]
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// </summary>
|
||||
[JsonProperty("PermissionCode")]
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
[JsonProperty("AllowView")]
|
||||
public int AllowView { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否添加
|
||||
/// </summary>
|
||||
[JsonProperty("AllowAdd")]
|
||||
public int AllowAdd { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否修改
|
||||
/// </summary>
|
||||
|
||||
[JsonProperty("AllowEdit")]
|
||||
public int AllowEdit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
[JsonProperty("AllowDel")]
|
||||
public int AllowDel { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Request
|
||||
{
|
||||
public class ManagerToPermissionRequest :RequestBase
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
[JsonProperty("Id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签
|
||||
/// </summary>
|
||||
[JsonProperty("Tag")]
|
||||
public string Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// </summary>
|
||||
[JsonProperty("ManagerId")]
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// </summary>
|
||||
[JsonProperty("PermissionCode")]
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class CreateOrEditManagerTagResponse
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签
|
||||
/// </summary>
|
||||
public string Tag { get; set; }
|
||||
|
||||
public CreateOrEditManagerTagResponse FromEntity(Domain.ManagerTag managerTag)
|
||||
{
|
||||
|
||||
Id = managerTag.Id;
|
||||
Tag = managerTag.Tag;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class CreateOrEditManagerToResponse
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 管理员标签
|
||||
/// </summary>
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
public CreateOrEditManagerToResponse FromEntity(Domain.ManagerToPermission managerToPermission)
|
||||
{
|
||||
|
||||
PermissionCode = managerToPermission.PermissionCode;
|
||||
Id = managerToPermission.Id;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class DomainResponse
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户关系Domain数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 项目编码
|
||||
/// </summary>
|
||||
public int ProjectCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class EditManagerResponse
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员登录名
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
public EditManagerResponse FromEntity(Domain.Manager manager)
|
||||
{
|
||||
|
||||
Id = manager.Id;
|
||||
LoginCode = manager.LoginCode ;
|
||||
Phone = manager.Phone;
|
||||
OwnerId = manager.TenantId;
|
||||
CreateTime = manager.CreateTime;
|
||||
UpdateTime = manager.UpdateTime;
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class ManagerResponse
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class PermissionResponse
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 软删除标记,0.代表正常,1.代表已删除
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员id
|
||||
/// <summary>
|
||||
public int ManagerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限编码
|
||||
/// <summary>
|
||||
public string PermissionCode { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否查看
|
||||
/// </summary>
|
||||
public int AllowView { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否添加
|
||||
/// </summary>
|
||||
public int AllowAdd { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否修改
|
||||
/// </summary>
|
||||
public int AllowEdit { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否删除
|
||||
/// </summary>
|
||||
public int AllowDel { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class QuertManagerProjectResponse
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using Hncore.Infrastructure.Data;
|
||||
using Hncore.Infrastructure.DDD;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Hncore.Infrastructure.WebApi;
|
||||
using Hncore.Pass.Manage.Request;
|
||||
using Hncore.Pass.Manage.Domain;
|
||||
|
||||
namespace Hncore.Pass.Manage.Response
|
||||
{
|
||||
public class QueryItemManagerResponse
|
||||
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户数据库ID
|
||||
/// <summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属物业ID
|
||||
/// <summary>
|
||||
public int OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// <summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// <summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标记
|
||||
/// <summary>
|
||||
public int DeleteTag { get; set; }
|
||||
/// <summary>
|
||||
/// 管理员登录名
|
||||
/// </summary>
|
||||
public string LoginCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员手机号
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像地址
|
||||
/// </summary>
|
||||
public string Photourl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目关联
|
||||
/// </summary>
|
||||
public string ProjectContact { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员姓名
|
||||
/// </summary>
|
||||
public string RealName { get; set; }
|
||||
|
||||
public int Isroot { get; set; }
|
||||
|
||||
public int RoleCode { get; set; }
|
||||
|
||||
|
||||
public List<PermissionResponse> Permission =new List<PermissionResponse>();
|
||||
public List<DomainResponse> Domain = new List<DomainResponse>();
|
||||
|
||||
public static async Task<QueryItemManagerResponse> Query(
|
||||
IQueryable<Domain.Manager> ManagerQueryable
|
||||
, IQueryable<Domain.ManagerToPermission> ManagerToPermissionQueryable
|
||||
, IQueryable<Domain.AuthorityManagerDataDomain> DomainQueryable
|
||||
|
||||
, QueryByIdRequest param
|
||||
)
|
||||
{
|
||||
var search = from dw in ManagerQueryable.Where(p => p.DeleteTag == 0 && p.Id == param.Id && p.TenantId == param.TenantId)
|
||||
join mtp in ManagerToPermissionQueryable.Where(p => p.DeleteTag == 0)
|
||||
on dw.Id equals mtp.ManagerId into Permissions
|
||||
select new { dw, Permissions };
|
||||
var list = search.ToList();
|
||||
|
||||
QueryItemManagerResponse pm = new QueryItemManagerResponse();
|
||||
foreach (var item in list)
|
||||
{
|
||||
pm.Id = item.dw.Id;
|
||||
pm.CreateTime = item.dw.CreateTime;
|
||||
pm.UpdateTime = item.dw.UpdateTime;
|
||||
pm.DeleteTag = item.dw.DeleteTag;
|
||||
pm.OwnerId = item.dw.TenantId;
|
||||
pm.LoginCode = item.dw.LoginCode;
|
||||
pm.RealName = item.dw.RealName;
|
||||
pm.Phone = item.dw.Phone;
|
||||
pm.Photourl = item.dw.PhotoUrl;
|
||||
pm.RoleCode = item.dw.RoleId;
|
||||
// pm.ProjectContact = item.dw.ProjectContact;
|
||||
|
||||
foreach (var itemper in item.Permissions)
|
||||
{
|
||||
PermissionResponse mtp =new PermissionResponse() ;
|
||||
mtp.ManagerId = itemper.ManagerId;
|
||||
mtp.Id = itemper.Id;
|
||||
mtp.AllowAdd = itemper.AllowAdd;
|
||||
mtp.AllowDel = itemper.AllowDel;
|
||||
mtp.AllowEdit = itemper.AllowEdit;
|
||||
mtp.AllowView = itemper.AllowView;
|
||||
mtp.PermissionCode = itemper.PermissionCode;
|
||||
mtp.OwnerId = item.dw.TenantId;
|
||||
pm.Permission.Add(mtp);
|
||||
}
|
||||
}
|
||||
|
||||
//var projectList= DomainQueryable.Where(p => p.DeleteTag == 0 && p.ManagerId == param.Id && p.TenantId == param.TenantId);
|
||||
//foreach(var project in projectList)
|
||||
//{
|
||||
// pm.Domain.Add(new DomainResponse() {
|
||||
// Id= project.Id,
|
||||
// ProjectCode= project.ProjectCode
|
||||
// });
|
||||
//}
|
||||
|
||||
return pm;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user