diff --git a/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs b/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs deleted file mode 100644 index 76d8f05..0000000 --- a/20220330_Vote/Ewide.Core/Cache/CacheOptions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Furion.ConfigurableOptions; - -namespace Ewide.Core -{ - /// - /// 缓存配置 - /// - public class CacheOptions : IConfigurableOptions - { - /// - /// 缓存类型 - /// - public CacheType CacheType { get; set; } - - /// - /// Redis配置 - /// - public string RedisConnectionString { get; set; } - } - - public enum CacheType - { - /// - /// 内存缓存 - /// - MemoryCache, - - /// - /// Redis缓存 - /// - RedisCache - } -} diff --git a/20220330_Vote/Ewide.Core/Cache/ICache.cs b/20220330_Vote/Ewide.Core/Cache/ICache.cs index 2122c3e..eb5c133 100644 --- a/20220330_Vote/Ewide.Core/Cache/ICache.cs +++ b/20220330_Vote/Ewide.Core/Cache/ICache.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading.Tasks; namespace Ewide.Core @@ -103,5 +104,10 @@ namespace Ewide.Core /// 有效期 /// Task SetAsync(string key, object value, TimeSpan expire); + /// + /// 获取所有缓存 + /// + /// + List GetAllKeys(); } } diff --git a/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs b/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs index 5e9c623..acfcaeb 100644 --- a/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs +++ b/20220330_Vote/Ewide.Core/Cache/MemoryCache.cs @@ -107,7 +107,7 @@ namespace Ewide.Core return Task.FromResult(true); } - private List GetAllKeys() + public List GetAllKeys() { const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic; var entries = _memoryCache.GetType().GetField("_entries", flags).GetValue(_memoryCache); @@ -121,5 +121,6 @@ namespace Ewide.Core //} //return keys; } + } } \ No newline at end of file diff --git a/20220330_Vote/Ewide.Core/Cache/RedisCache.cs b/20220330_Vote/Ewide.Core/Cache/RedisCache.cs index 0803ff9..d87efdf 100644 --- a/20220330_Vote/Ewide.Core/Cache/RedisCache.cs +++ b/20220330_Vote/Ewide.Core/Cache/RedisCache.cs @@ -1,6 +1,7 @@ using Furion.DependencyInjection; using Microsoft.Extensions.Options; using System; +using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -62,6 +63,11 @@ namespace Ewide.Core return RedisHelper.Get(key); } + public List GetAllKeys() + { + throw new NotImplementedException(); + } + public Task GetAsync(string key) { return RedisHelper.GetAsync(key); diff --git a/20220330_Vote/Ewide.Core/Cache/SqlSugarCache.cs b/20220330_Vote/Ewide.Core/Cache/SqlSugarCache.cs new file mode 100644 index 0000000..91f9107 --- /dev/null +++ b/20220330_Vote/Ewide.Core/Cache/SqlSugarCache.cs @@ -0,0 +1,63 @@ +using Furion; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Core.Cache +{ + + public class SqlSugarCache : ICacheService + { + private static ICache _cache = App.GetOptions().CacheType == CacheType.MemoryCache ? App.RootServices.GetService(typeof(MemoryCache)) as ICache : App.RootServices.GetService(typeof(RedisCache)) as ICache; + + public void Add(string key, TV value) + { + _cache.Set(key, value); + } + + public void Add(string key, TV value, int cacheDurationInSeconds) + { + _cache.Set(key, value, TimeSpan.FromSeconds(cacheDurationInSeconds)); + } + + public bool ContainsKey(string key) + { + return _cache.Exists(key); + } + + public TV Get(string key) + { + return _cache.Get(key); + } + + public IEnumerable GetAllKey() + { + + return _cache.GetAllKeys(); + } + + public TV GetOrCreate(string cacheKey, Func create, int cacheDurationInSeconds = int.MaxValue) + { + if (this.ContainsKey(cacheKey)) + { + return this.Get(cacheKey); + } + else + { + var result = create(); + this.Add(cacheKey, result, cacheDurationInSeconds); + return result; + } + } + + public void Remove(string key) + { + _cache.Del(key); + } + } + + +} diff --git a/20220330_Vote/Ewide.Core/ConfigOption/ConfigOptions.cs b/20220330_Vote/Ewide.Core/ConfigOption/ConfigOptions.cs new file mode 100644 index 0000000..e00a78a --- /dev/null +++ b/20220330_Vote/Ewide.Core/ConfigOption/ConfigOptions.cs @@ -0,0 +1,235 @@ +using Furion.ConfigurableOptions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Core +{ + + /// + /// 缓存配置 + /// + public class CacheOptions : IConfigurableOptions + { + /// + /// 缓存类型 + /// + public CacheType CacheType { get; set; } + + /// + /// Redis配置 + /// + public string RedisConnectionString { get; set; } + } + public enum CacheType + { + /// + /// 内存缓存 + /// + MemoryCache, + + /// + /// Redis缓存 + /// + RedisCache + } + /// + /// 系统配置 + /// + public class SystemSettingsOptions : IConfigurableOptions + { + /// + /// 超管是否可以查看所有租户的数据 + /// + public bool SuperAdminViewAllData { get; set; } + + /// + /// 是否开启全局请求日志 + /// + public bool IsGlobalRequestLog { get; set; } + } + /// + /// 雪花Id配置 + /// + public class SnowIdOptions : IConfigurableOptions + { + /// + /// 取值范围0~63,默认1 + /// + public string WorkerId { get; set; } = "1"; + } + /// + /// 第三方配置 + /// + public class OAuthOptions : IConfigurableOptions + { + /// + ///微信 + /// + public ThirdParty Wechat { get; set; } + } + /// + /// 上传文件 + /// + public class UploadFileOptions : IConfigurableOptions + { + /// + /// 阿里云 + /// + public FileDescription Aliyun { get; set; } + /// + /// 头像 + /// + public FileDescription Avatar { get; set; } + /// + /// 文档 + /// + public FileDescription Document { get; set; } + /// + /// 商店 + /// + public FileDescription Shop { get; set; } + /// + /// 编辑器 + /// + public FileDescription Editor { get; set; } + /// + /// 默认 + /// + public FileDescription Default { get; set; } + } + /// + /// 数据库配置 + /// + public class ConnectionStringsOptions : IConfigurableOptions + { + /// + /// 默认数据库编号 + /// + public string DefaultDbNumber { get; set; } + /// + /// 默认数据库类型 + /// + public string DefaultDbType { get; set; } + /// + /// 默认数据库连接字符串 + /// + + public string DefaultDbString { get; set; } + /// + /// 业务库集合 + /// + public List DbConfigs { get; set; } + } + /// + /// JWT配置 + /// + public class JWTSettingsOptions : IConfigurableOptions + { + /// + /// 是否验证密钥 + /// + public bool ValidateIssuerSigningKey { get; set; } + /// + /// 密钥 + /// + public string IssuerSigningKey { get; set; } + /// + /// 是否验证签发方 + /// + public bool ValidateIssuer { get; set; } + /// + /// 签发方 + /// + public string ValidIssuer { get; set; } + /// + /// 是否验证签收方 + /// + public bool ValidateAudience { get; set; } + /// + /// 签收方 + /// + public string ValidAudience { get; set; } + /// + /// 是否验证过期时间 + /// + public bool ValidateLifetime { get; set; } + /// + /// 过期时间 + /// + public long ExpiredTime { get; set; } + /// + /// 过期时间容错值 + /// + public long ClockSkew { get; set; } + } + /// + /// 数据库参数 + /// + public class DbConfig + { + /// + /// 数据库编号 + /// + public string DbNumber { get; set; } + /// + /// 数据库类型 + /// + public string DbType { get; set; } + /// + /// 数据库连接字符串 + /// + + public string DbString { get; set; } + } + /// + /// 文件参数 + /// + public class FileDescription + { + /// + /// 路径 + /// + public string path { get; set; } + /// + /// 大小 + /// + public long maxSize { get; set; } + /// + /// 类型 + /// + public string[] contentType { get; set; } + } + /// + /// 第三方参数 + /// + public class ThirdParty + { + /// + /// id + /// + public string app_id { get; set; } + /// + /// key + /// + public string app_key { get; set; } + /// + /// 回调地址 + /// + public string redirect_uri { get; set; } + /// + /// scope + /// + public string scope { get; set; } + + } + public class FileOption + { + public string Path { get; set; } + public int MaxSize { get; set; } + public string[] ContentType { get; set; } + } + +} diff --git a/20220330_Vote/Ewide.Core/Ewide.Core.xml b/20220330_Vote/Ewide.Core/Ewide.Core.xml index a368faa..1016818 100644 --- a/20220330_Vote/Ewide.Core/Ewide.Core.xml +++ b/20220330_Vote/Ewide.Core/Ewide.Core.xml @@ -4,31 +4,6 @@ Ewide.Core - - - 缓存配置 - - - - - 缓存类型 - - - - - Redis配置 - - - - - 内存缓存 - - - - - Redis缓存 - - 缓存接口 @@ -130,6 +105,12 @@ 有效期 + + + 获取所有缓存 + + + 内存缓存 @@ -253,6 +234,241 @@ Token + + + 缓存配置 + + + + + 缓存类型 + + + + + Redis配置 + + + + + 内存缓存 + + + + + Redis缓存 + + + + + 系统配置 + + + + + 超管是否可以查看所有租户的数据 + + + + + 是否开启全局请求日志 + + + + + 雪花Id配置 + + + + + 取值范围0~63,默认1 + + + + + 第三方配置 + + + + + 微信 + + + + + 上传文件 + + + + + 阿里云 + + + + + 头像 + + + + + 文档 + + + + + 商店 + + + + + 编辑器 + + + + + 默认 + + + + + 数据库配置 + + + + + 默认数据库编号 + + + + + 默认数据库类型 + + + + + 默认数据库连接字符串 + + + + + 业务库集合 + + + + + JWT配置 + + + + + 是否验证密钥 + + + + + 密钥 + + + + + 是否验证签发方 + + + + + 签发方 + + + + + 是否验证签收方 + + + + + 签收方 + + + + + 是否验证过期时间 + + + + + 过期时间 + + + + + 过期时间容错值 + + + + + 数据库参数 + + + + + 数据库编号 + + + + + 数据库类型 + + + + + 数据库连接字符串 + + + + + 文件参数 + + + + + 路径 + + + + + 大小 + + + + + 类型 + + + + + 第三方参数 + + + + + id + + + + + key + + + + + 回调地址 + + + + + scope + + 用户Id @@ -4695,6 +4911,20 @@ + + + 上传文件 + + + + + + + 批量上传文件 + + + + 下载文件 @@ -6810,6 +7040,470 @@ + + + SqlSugar 仓储实现类 + + + + + + 初始化 SqlSugar 客户端 + + + + + 数据库上下文 + + + + + 独立数据库上下文 + + + + + 构造函数 + + + + + + 实体集合 + + + + + 原生 Ado 对象 + + + + + 获取总数 + + + + + + + 获取总数 + + + + + + + 检查是否存在 + + + + + + + 检查是否存在 + + + + + + + 通过主键获取实体 + + + + + + + 获取一个实体 + + + + + + + 获取一个实体 + + + + + + + 获取一个实体 + + + + + + + 获取一个实体 + + + + + + + 获取列表 + + + + + + 获取列表 + + + + + + + 获取列表 + + + + + + + + + 获取列表 + + + + + + 获取列表 + + + + + + + 获取列表 + + + + + + + + + 新增一条记录 + + + + + + + 新增多条记录 + + + + + + + 新增多条记录 + + + + + + + 新增一条记录返回自增Id + + + + + + + 新增一条记录返回雪花Id + + + + + + + 新增一条记录返回实体 + + + + + + + 新增一条记录 + + + + + + + 新增多条记录 + + + + + + + 新增多条记录 + + + + + + + 新增一条记录返回自增Id + + + + + + + 新增一条记录返回雪花Id + + + + + + + 新增一条记录返回实体 + + + + + + + 更新一条记录 + + + + + + + 更新多条记录 + + + + + + + 更新多条记录 + + + + + + + 更新一条记录忽略所有Null值 + + + + + + + 更新一条记录 + + + + + + + 更新记录 + + 更新的条件 + 更新的内容 + + + + + 更新记录 + + 更新的条件 + 更新的内容 + + + + + 更新多条记录 + + + + + + + 更新多条记录 + + + + + + + 删除一条记录 + + + + + + + 删除一条记录 + + + + + + + 删除多条记录 + + + + + + + 自定义条件删除记录 + + + + + + + 删除一条记录 + + + + + + + 删除一条记录 + + + + + + + 删除多条记录 + + + + + + + 自定义条件删除记录 + + + + + + + 根据表达式查询多条记录 + + + + + + + 根据表达式查询多条记录 + + + + + + + + 构建查询分析器 + + + + + + 构建查询分析器 + + + + + + + 直接返回数据库结果 + + + + + + 直接返回数据库结果 + + + + + + + 直接返回数据库结果 + + + + + + 直接返回数据库结果 + + + + + + + 切换仓储(注意使用环境) + + 实体类型 + 仓储 + + + + 当前db + + + + + 当前db + + + + + 当前db + + + + + 所有db + + + + + 所有db + + + + + 所有db + + + + + 判断是不是超级管理员 + + + + + + 添加 SqlSugar 拓展 + + + + + + + + + 添加 SqlSugar 拓展 + + + + + + 发送验证码间隔时间(秒) diff --git a/20220330_Vote/Ewide.Core/SqlSugar/SqlSugarRepository.cs b/20220330_Vote/Ewide.Core/SqlSugar/SqlSugarRepository.cs new file mode 100644 index 0000000..ff63549 --- /dev/null +++ b/20220330_Vote/Ewide.Core/SqlSugar/SqlSugarRepository.cs @@ -0,0 +1,678 @@ +using Furion; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Core +{ + + /// + /// SqlSugar 仓储实现类 + /// + /// + public partial class SqlSugarRepository + where TEntity : class, new() + { + private readonly string[] UpdateIgnoreColumns = new string[] { "CreatedTime", "CreatedUserId", "CreatedUserName" }; + + #region 属性 + /// + /// 初始化 SqlSugar 客户端 + /// + private readonly SqlSugarScope _db; + + /// + /// 数据库上下文 + /// + public virtual SqlSugarScope Context { get; } + /// + /// 独立数据库上下文 + /// + public virtual SqlSugarProvider EntityContext { get; } + /// + /// 构造函数 + /// + /// + public SqlSugarRepository(ISqlSugarClient db) + { + Context = _db = (SqlSugarScope)db; + EntityContext = _db.GetConnectionWithAttr(); + Ado = EntityContext.Ado; + } + /// + /// 实体集合 + /// + public virtual ISugarQueryable Entities => EntityContext.Queryable(); + + /// + /// 原生 Ado 对象 + /// + public virtual IAdo Ado { get; } + #endregion + + #region 查询 + /// + /// 获取总数 + /// + /// + /// + public int Count(Expression> whereExpression) + { + return Entities.Count(whereExpression); + } + + /// + /// 获取总数 + /// + /// + /// + public Task CountAsync(Expression> whereExpression) + { + return Entities.CountAsync(whereExpression); + } + + /// + /// 检查是否存在 + /// + /// + /// + public bool Any(Expression> whereExpression) + { + return Entities.Any(whereExpression); + } + + /// + /// 检查是否存在 + /// + /// + /// + public async Task AnyAsync(Expression> whereExpression) + { + return await Entities.AnyAsync(whereExpression); + } + + /// + /// 通过主键获取实体 + /// + /// + /// + public TEntity Single(dynamic Id) + { + return Entities.InSingle(Id); + } + + /// + /// 获取一个实体 + /// + /// + /// + public TEntity Single(Expression> whereExpression) + { + return Entities.Single(whereExpression); + } + + /// + /// 获取一个实体 + /// + /// + /// + public Task SingleAsync(Expression> whereExpression) + { + return Entities.SingleAsync(whereExpression); + } + + /// + /// 获取一个实体 + /// + /// + /// + public TEntity FirstOrDefault(Expression> whereExpression) + { + return Entities.First(whereExpression); + } + + /// + /// 获取一个实体 + /// + /// + /// + public async Task FirstOrDefaultAsync(Expression> whereExpression) + { + return await Entities.FirstAsync(whereExpression); + } + + /// + /// 获取列表 + /// + /// + public List ToList() + { + return Entities.ToList(); + } + + /// + /// 获取列表 + /// + /// + /// + public List ToList(Expression> whereExpression) + { + return Entities.Where(whereExpression).ToList(); + } + + /// + /// 获取列表 + /// + /// + /// + /// + /// + public List ToList(Expression> whereExpression, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) + { + return Entities.OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(whereExpression).ToList(); + } + + /// + /// 获取列表 + /// + /// + public Task> ToListAsync() + { + return Entities.ToListAsync(); + } + + /// + /// 获取列表 + /// + /// + /// + public Task> ToListAsync(Expression> whereExpression) + { + return Entities.Where(whereExpression).ToListAsync(); + } + + /// + /// 获取列表 + /// + /// + /// + /// + /// + public Task> ToListAsync(Expression> whereExpression, Expression> orderByExpression = null, OrderByType orderByType = OrderByType.Asc) + { + return Entities.OrderByIF(orderByExpression != null, orderByExpression, orderByType).Where(whereExpression).ToListAsync(); + } + #endregion + + #region 新增 + public virtual IInsertable AsInsertable(TEntity entity) + { + return EntityContext.Insertable(entity); + } + + public virtual IInsertable AsInsertable(params TEntity[] entities) + { + return EntityContext.Insertable(entities); + } + + /// + /// 新增一条记录 + /// + /// + /// + public virtual int Insert(TEntity entity) + { + return EntityContext.Insertable(entity).ExecuteCommand(); + } + + /// + /// 新增多条记录 + /// + /// + /// + public virtual int Insert(params TEntity[] entities) + { + return EntityContext.Insertable(entities).ExecuteCommand(); + } + + /// + /// 新增多条记录 + /// + /// + /// + public virtual int Insert(IEnumerable entities) + { + return EntityContext.Insertable(entities.ToArray()).ExecuteCommand(); + } + + /// + /// 新增一条记录返回自增Id + /// + /// + /// + public virtual int InsertReturnIdentity(TEntity insertObj) + { + return EntityContext.Insertable(insertObj).ExecuteReturnIdentity(); + } + + /// + /// 新增一条记录返回雪花Id + /// + /// + /// + public virtual long InsertReturnSnowflakeId(TEntity entity) + { + return EntityContext.Insertable(entity).ExecuteReturnSnowflakeId(); + } + + /// + /// 新增一条记录返回实体 + /// + /// + /// + public virtual TEntity InsertReturnEntity(TEntity entity) + { + return EntityContext.Insertable(entity).ExecuteReturnEntity(); + } + + + + /// + /// 新增一条记录 + /// + /// + /// + public virtual Task InsertAsync(TEntity entity) + { + return EntityContext.Insertable(entity).ExecuteCommandAsync(); + } + + /// + /// 新增多条记录 + /// + /// + /// + public virtual Task InsertAsync(params TEntity[] entities) + { + return EntityContext.Insertable(entities).ExecuteCommandAsync(); + } + + /// + /// 新增多条记录 + /// + /// + /// + public virtual Task InsertAsync(IEnumerable entities) + { + if (entities != null && entities.Any()) + { + return EntityContext.Insertable(entities.ToArray()).ExecuteCommandAsync(); + } + return Task.FromResult(0); + } + + /// + /// 新增一条记录返回自增Id + /// + /// + /// + public virtual async Task InsertReturnIdentityAsync(TEntity entity) + { + return await EntityContext.Insertable(entity).ExecuteReturnBigIdentityAsync(); + } + + /// + /// 新增一条记录返回雪花Id + /// + /// + /// + public virtual async Task InsertReturnSnowflakeIdAsync(TEntity entity) + { + return await EntityContext.Insertable(entity).ExecuteReturnSnowflakeIdAsync(); + } + + /// + /// 新增一条记录返回实体 + /// + /// + /// + public virtual async Task InsertReturnEntityAsync(TEntity entity) + { + return await EntityContext.Insertable(entity).ExecuteReturnEntityAsync(); + } + #endregion + + #region 更新 + + /// + /// 更新一条记录 + /// + /// + /// + public virtual int Update(TEntity entity) + { + return EntityContext.Updateable(entity).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommand(); + } + + /// + /// 更新多条记录 + /// + /// + /// + public virtual int Update(params TEntity[] entities) + { + return EntityContext.Updateable(entities).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommand(); + } + /// + /// 更新多条记录 + /// + /// + /// + public virtual int Update(IEnumerable entities) + { + return EntityContext.Updateable(entities.ToArray()).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommand(); + } + /// + /// 更新一条记录忽略所有Null值 + /// + /// + /// + public virtual async Task UpdateIgnoreNullAsync(TEntity entity) + { + return await EntityContext.Updateable(entity).IgnoreColumns(true).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommandAsync(); + } + /// + /// 更新一条记录 + /// + /// + /// + public virtual async Task UpdateAsync(TEntity entity) + { + return await EntityContext.Updateable(entity).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommandAsync(); + } + /// + /// 更新记录 + /// + /// 更新的条件 + /// 更新的内容 + /// + public virtual int Update(Expression> predicate, Expression> content) + { + return EntityContext.Updateable(content).Where(predicate).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommand(); + } + + /// + /// 更新记录 + /// + /// 更新的条件 + /// 更新的内容 + /// + public virtual async Task UpdateAsync(Expression> predicate, Expression> content) + { + return await EntityContext.Updateable(content).Where(predicate).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommandAsync(); + } + + /// + /// 更新多条记录 + /// + /// + /// + public virtual Task UpdateAsync(params TEntity[] entities) + { + return EntityContext.Updateable(entities).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommandAsync(); + } + + /// + /// 更新多条记录 + /// + /// + /// + public virtual Task UpdateAsync(IEnumerable entities) + { + return EntityContext.Updateable(entities.ToArray()).IgnoreColumns(UpdateIgnoreColumns).ExecuteCommandAsync(); + } + + public virtual IUpdateable AsUpdateable(TEntity entity) + { + return EntityContext.Updateable(entity).IgnoreColumns(UpdateIgnoreColumns); + } + + public virtual IUpdateable AsUpdateable(IEnumerable entities) + { + return EntityContext.Updateable(entities).IgnoreColumns(UpdateIgnoreColumns); + } + #endregion + + #region 删除 + /// + /// 删除一条记录 + /// + /// + /// + public virtual int Delete(TEntity entity) + { + return EntityContext.Deleteable(entity).ExecuteCommand(); + } + + /// + /// 删除一条记录 + /// + /// + /// + public virtual int Delete(object key) + { + return EntityContext.Deleteable().In(key).ExecuteCommand(); + } + + /// + /// 删除多条记录 + /// + /// + /// + public virtual int Delete(params object[] keys) + { + return EntityContext.Deleteable().In(keys).ExecuteCommand(); + } + + /// + /// 自定义条件删除记录 + /// + /// + /// + public int Delete(Expression> whereExpression) + { + return EntityContext.Deleteable().Where(whereExpression).ExecuteCommand(); + } + + /// + /// 删除一条记录 + /// + /// + /// + public virtual Task DeleteAsync(TEntity entity) + { + return EntityContext.Deleteable(entity).ExecuteCommandAsync(); + } + + /// + /// 删除一条记录 + /// + /// + /// + public virtual Task DeleteAsync(object key) + { + return EntityContext.Deleteable().In(key).ExecuteCommandAsync(); + } + + /// + /// 删除多条记录 + /// + /// + /// + public virtual Task DeleteAsync(params object[] keys) + { + return EntityContext.Deleteable().In(keys).ExecuteCommandAsync(); + } + + /// + /// 自定义条件删除记录 + /// + /// + /// + public async Task DeleteAsync(Expression> whereExpression) + { + return await EntityContext.Deleteable().Where(whereExpression).ExecuteCommandAsync(); + } + #endregion + + #region 其他 + /// + /// 根据表达式查询多条记录 + /// + /// + /// + public virtual ISugarQueryable Where(Expression> predicate) + { + return AsQueryable(predicate); + } + + /// + /// 根据表达式查询多条记录 + /// + /// + /// + /// + public virtual ISugarQueryable Where(bool condition, Expression> predicate) + { + return AsQueryable().WhereIF(condition, predicate); + } + + /// + /// 构建查询分析器 + /// + /// + public virtual ISugarQueryable AsQueryable() + { + return Entities; + } + + /// + /// 构建查询分析器 + /// + /// + /// + public virtual ISugarQueryable AsQueryable(Expression> predicate) + { + return Entities.Where(predicate); + } + + /// + /// 直接返回数据库结果 + /// + /// + public virtual List AsEnumerable() + { + return AsQueryable().ToList(); + } + + /// + /// 直接返回数据库结果 + /// + /// + /// + public virtual List AsEnumerable(Expression> predicate) + { + return AsQueryable(predicate).ToList(); + } + + /// + /// 直接返回数据库结果 + /// + /// + public virtual Task> AsAsyncEnumerable() + { + return AsQueryable().ToListAsync(); + } + + /// + /// 直接返回数据库结果 + /// + /// + /// + public virtual Task> AsAsyncEnumerable(Expression> predicate) + { + return AsQueryable(predicate).ToListAsync(); + } + + public virtual bool IsExists(Expression> whereExpression) + { + return Entities.Any(whereExpression); + } + + public virtual Task IsExistsAsync(Expression> whereExpression) + { + return Entities.AnyAsync(whereExpression); + } + #endregion + + #region 仓储事务 + /// + /// 切换仓储(注意使用环境) + /// + /// 实体类型 + /// 仓储 + public virtual SqlSugarRepository Change() + where T : class, new() + { + return App.GetService>(); + } + /// + /// 当前db + /// + public void CurrentBeginTran() + { + Ado.BeginTran(); + } + /// + /// 当前db + /// + public void CurrentCommitTran() + { + Ado.CommitTran(); + } + /// + /// 当前db + /// + public void CurrentRollbackTran() + { + Ado.RollbackTran(); + } + /// + /// 所有db + /// + public void BeginTran() + { + Context.BeginTran(); + } + /// + /// 所有db + /// + public void CommitTran() + { + Context.CommitTran(); + } + /// + /// 所有db + /// + public void RollbackTran() + { + Context.RollbackTran(); + } + #endregion + } + +} diff --git a/20220330_Vote/Ewide.Core/SqlSugar/SqlsugarSetup.cs b/20220330_Vote/Ewide.Core/SqlSugar/SqlsugarSetup.cs new file mode 100644 index 0000000..a4c47fb --- /dev/null +++ b/20220330_Vote/Ewide.Core/SqlSugar/SqlsugarSetup.cs @@ -0,0 +1,283 @@ +using Ewide.Core; +using Ewide.Core.Cache; +using Furion; +using Furion.Logging.Extensions; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Core +{ + public static class SqlsugarSetup + { + public static void AddSqlsugarSetup(this IServiceCollection services) + { + var connList = App.GetConfig>("ConnectionStrings")?.Where(p => p.Enabled).ToList(); + + List connectConfigList = new(); + connList.ForEach(conn => + { + connectConfigList.Add(new ConnectionConfig + { + ConfigId = conn.Id, + ConnectionString = conn.ConnectionString, + DbType = conn.DbType, + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute, + MoreSettings = new ConnMoreSettings() + { + IsAutoRemoveDataCache = true//自动清理缓存 + + }, + ConfigureExternalServices = new ConfigureExternalServices() + { + DataInfoCacheService = new SqlSugarCache(), + EntityNameService = (type, entity) => + { + var attributes = type.GetCustomAttributes(true); + if (attributes.Any(it => it is TableAttribute)) + { + entity.DbTableName = (attributes.First(it => it is TableAttribute) as TableAttribute).Name; + } + }, + EntityService = (type, column) => + { + var attributes = type.GetCustomAttributes(true); + if (attributes.Any(it => it is KeyAttribute))// by attribute set primarykey + { + column.IsPrimarykey = true; //有哪些特性可以看 1.2 特性明细 + } + if (attributes.Any(it => it is ColumnAttribute)) + { + column.DbColumnName = (attributes.First(it => it is ColumnAttribute) as ColumnAttribute).Name; + } + } + } + }); + }); + services.AddSqlSugar(connectConfigList.ToArray(), db => + { + //处理日志事务 + db.Aop.OnLogExecuting = (sql, pars) => + { + Debugger.Log(1, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log started ===================\r\n"); + Debugger.Log(2, "语句:", sql); + Debugger.Log(3, "参数:", string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value))); + Debugger.Log(4, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log end ===================\r\n"); + //App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); + }; + }); + + + List types = App.EffectiveTypes.Where(a => !a.IsAbstract && a.IsClass && a.GetCustomAttributes(typeof(SugarTable), true)?.FirstOrDefault() != null).ToList(); + + SqlSugarScope sqlSugarScope = new SqlSugarScope(connectConfigList, + //全局上下文生效 + db => + { + /* + * 默认只会配置到第一个数据库,这里按照官方文档进行多数据库/多租户文档的说明进行循环配置 + */ + foreach (var c in connectConfigList) + { + var dbProvider = db.GetConnectionScope((string)c.ConfigId); + //执行超时时间 + dbProvider.Ado.CommandTimeOut = 30; + + dbProvider.Aop.OnLogExecuting = (sql, pars) => + { + if (sql.StartsWith("SELECT")) + { + Console.ForegroundColor = ConsoleColor.Green; + } + if (sql.StartsWith("UPDATE") || sql.StartsWith("INSERT")) + { + Console.ForegroundColor = ConsoleColor.White; + } + if (sql.StartsWith("DELETE")) + { + Console.ForegroundColor = ConsoleColor.Blue; + } + //Console.WriteLine("Sql:" + "\r\n\r\n" + UtilMethods.GetSqlString(c.DbType, sql, pars)); + App.PrintToMiniProfiler("SqlSugar", "Info", UtilMethods.GetSqlString(c.DbType, sql, pars)); + $"DB:{c.ConfigId}, Sql:\r\n\r\n {UtilMethods.GetSqlString(c.DbType, sql, pars)}".LogInformation(); + + + }; + + dbProvider.Aop.DataExecuting = (oldValue, entityInfo) => + { + //// 新增操作 + //if (entityInfo.OperationType == DataFilterType.InsertByObject) + //{ + // // 主键(long)-赋值雪花Id + // if (entityInfo.EntityColumnInfo.IsPrimarykey && entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long)) + // { + // var id = ((dynamic)entityInfo.EntityValue).Id; + // if (id == null || id == 0) + // entityInfo.SetValue(Yitter.IdGenerator.YitIdHelper.NextId()); + // } + + + // if (entityInfo.PropertyName == "CreatedTime") + // entityInfo.SetValue(DateTime.Now); + // if (App.User != null) + // { + // if (entityInfo.PropertyName == "TenantId") + // { + // var tenantId = ((dynamic)entityInfo.EntityValue).TenantId; + // if (tenantId == null || tenantId == 0) + // entityInfo.SetValue(App.User.FindFirst(ClaimConst.TENANT_ID)?.Value); + // } + // if (entityInfo.PropertyName == "CreatedUserId") + // { + // var createUserId = ((dynamic)entityInfo.EntityValue).CreatedUserId; + // if (createUserId == null || createUserId == 0) + // entityInfo.SetValue(App.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value); + // } + + // if (entityInfo.PropertyName == "CreatedUserName") + // entityInfo.SetValue(App.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value); + // } + //} + //// 更新操作 + //if (entityInfo.OperationType == DataFilterType.UpdateByObject) + //{ + // if (entityInfo.PropertyName == "UpdatedTime") + // entityInfo.SetValue(DateTime.Now); + // if (entityInfo.PropertyName == "UpdatedUserId") + // entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value); + // if (entityInfo.PropertyName == "UpdatedUserName") + // entityInfo.SetValue(App.User?.FindFirst(ClaimConst.CLAINM_NAME)?.Value); + + //} + }; + + /* + * 使用 SqlSugarScope 循环配置此项的时候会覆盖整个 ConfigureExternalServices, + * 移动到 New ConnectionConfig中配置 + */ + //db.CurrentConnectionConfig.ConfigureExternalServices = new ConfigureExternalServices() + //{ + // DataInfoCacheService = new SqlSugarCache()//配置我们创建的缓存类 + //}; + + ////全局过滤器 + //var superAdminViewAllData = Convert.ToBoolean(App.GetOptions().SuperAdminViewAllData); + //foreach (var entityType in types) + //{ + // // 配置多租户全局过滤器 + // //if (!entityType.GetProperty(ClaimConst.TENANT_ID).IsEmpty()) + // //{ //判断实体类中包含TenantId属性 + // // //构建动态Lambda + // // var lambda = DynamicExpressionParser.ParseLambda + // // (new[] { Expression.Parameter(entityType, "it") }, + // // typeof(bool), $"{nameof(DBEntityTenant.TenantId)} == @0 or (@1 and @2)", + // // GetTenantId(), IsSuperAdmin(), superAdminViewAllData); + // // dbProvider.QueryFilter.Add(new TableFilterItem(entityType, lambda)); //将Lambda传入过滤器 + // //} + // // 配置加删除全局过滤器 + // if (!entityType.GetProperty(CommonConst.DELETE_FIELD).IsEmpty()) + // { //判断实体类中包含IsDeleted属性 + // //构建动态Lambda + // var lambda = DynamicExpressionParser.ParseLambda + // (new[] { Expression.Parameter(entityType, "it") }, + // typeof(bool), $"{nameof(DEntityBase.IsDeleted)} == @0", + // false); + // dbProvider.QueryFilter.Add(new TableFilterItem(entityType, lambda) + // { + // IsJoinQuery = true + // }); //将Lambda传入过滤器 + // } + //} + + } + }); + services.AddSingleton(sqlSugarScope); + // 注册 SqlSugar 仓储 + services.AddScoped(typeof(SqlSugarRepository<>)); + + ////如果多个数数据库传 List + //var configConnection = new ConnectionConfig() + //{ + // DbType = SqlSugar.DbType.MySql, + // ConnectionString = configuration.GetConnectionString(dbName), + // IsAutoCloseConnection = true, + //}; + + //SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, + // db => + // { + // //单例参数配置,所有上下文生效 + // db.Aop.OnLogExecuting = (sql, pars) => + // { + // //Console.WriteLine(sql);//输出sql + // }; + // }); + + //services.AddSingleton(sqlSugar);//这边是SqlSugarScope用AddSingleton + } + + + /// + /// 判断是不是超级管理员 + /// + /// + private static bool IsSuperAdmin() + { + if (App.User == null) return false; + return App.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == AdminType.SuperAdmin.GetHashCode().ToString(); + } + /// + /// 添加 SqlSugar 拓展 + /// + /// + /// + /// + /// + public static IServiceCollection AddSqlSugar(this IServiceCollection services, ConnectionConfig config, Action buildAction = default) + { + var list = new List(); + list.Add(config); + return services.AddSqlSugar(list, buildAction); + } + + /// + /// 添加 SqlSugar 拓展 + /// + /// + /// + /// + /// + public static IServiceCollection AddSqlSugar(this IServiceCollection services, List configs, Action buildAction = default) + { + // 注册 SqlSugar 客户端 + services.AddScoped(u => + { + var db = new SqlSugarClient(configs); + buildAction?.Invoke(db); + return db; + }); + + // 注册 SqlSugar 仓储 + services.AddScoped(typeof(SqlSugarRepository<>)); + return services; + } + } + + public class MutiDBConnectionString + { + public string Id { get; set; } + public string ConnectionString { get; set; } + public DbType DbType { get; set; } + public bool Enabled { get; set; } + public string ProviderName { get; set; } + } +} diff --git a/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs b/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs index c3e916a..d767f55 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs +++ b/20220330_Vote/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs @@ -1,7 +1,6 @@ using Ewide.Core; using Ewide.Core.Service; using Ewide.Core.Util; -using Ewide.EntityFramework.Core.SqlSugar; using Furion; using Furion.DatabaseAccessor; using Furion.FriendlyException; diff --git a/20220330_Vote/Ewide.EntityFramework.Core/SqlSugar/SqlsugarSetup.cs b/20220330_Vote/Ewide.EntityFramework.Core/SqlSugar/SqlsugarSetup.cs deleted file mode 100644 index 5274586..0000000 --- a/20220330_Vote/Ewide.EntityFramework.Core/SqlSugar/SqlsugarSetup.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Furion; -using Microsoft.Extensions.DependencyInjection; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Ewide.EntityFramework.Core.SqlSugar -{ - public static class SqlsugarSetup - { - public static void AddSqlsugarSetup(this IServiceCollection services) - { - var connList = App.GetConfig>("ConnectionStrings")?.Where(p => p.Enabled).ToList(); - - List connectConfigList = new(); - connList.ForEach(conn => - { - connectConfigList.Add(new ConnectionConfig - { - ConfigId = conn.Id, - ConnectionString = conn.ConnectionString, - DbType = conn.DbType, - IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute - }); - }); - services.AddSqlSugar(connectConfigList.ToArray(), db => - { - //处理日志事务 - db.Aop.OnLogExecuting = (sql, pars) => - { - Debugger.Log(1, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log started ===================\r\n"); - Debugger.Log(2, "语句:", sql); - Debugger.Log(3, "参数:", string.Join(",", pars?.Select(it => it.ParameterName + ":" + it.Value))); - Debugger.Log(4, "", $"===================CurrentConfigId:{db.CurrentConnectionConfig.ConfigId} SqlSugar log end ===================\r\n"); - //App.PrintToMiniProfiler("SqlSugar", "Info", sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value))); - }; - }); - - - - ////如果多个数数据库传 List - //var configConnection = new ConnectionConfig() - //{ - // DbType = SqlSugar.DbType.MySql, - // ConnectionString = configuration.GetConnectionString(dbName), - // IsAutoCloseConnection = true, - //}; - - //SqlSugarScope sqlSugar = new SqlSugarScope(configConnection, - // db => - // { - // //单例参数配置,所有上下文生效 - // db.Aop.OnLogExecuting = (sql, pars) => - // { - // //Console.WriteLine(sql);//输出sql - // }; - // }); - - //services.AddSingleton(sqlSugar);//这边是SqlSugarScope用AddSingleton - } - } - - public class MutiDBConnectionString - { - public string Id { get; set; } - public string ConnectionString { get; set; } - public DbType DbType { get; set; } - public bool Enabled { get; set; } - public string ProviderName { get; set; } - } -} diff --git a/20220330_Vote/Ewide.EntityFramework.Core/Startup.cs b/20220330_Vote/Ewide.EntityFramework.Core/Startup.cs index 25b25ac..029b642 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/Startup.cs +++ b/20220330_Vote/Ewide.EntityFramework.Core/Startup.cs @@ -1,5 +1,5 @@ using Dapper; -using Ewide.EntityFramework.Core.SqlSugar; +using Ewide.Core; using Furion; using Furion.DatabaseAccessor; using Microsoft.Extensions.DependencyInjection; diff --git a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json index 5fcf835..ba95e5c 100644 --- a/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json +++ b/20220330_Vote/Ewide.EntityFramework.Core/dbsettings.Development.json @@ -11,18 +11,18 @@ Dm = 5, Kdbndp = 6 */ - { - "Id": 1, // 连接id,可以配置到数据库 - "DBType": 2, // db类型,枚举,具体的看上边 - "Enabled": false, // 是否开启当前数据库db - "Connection": "WMBlog.db" // 连接字符串 - }, { //目前使用的数据库 Ewide. "Id": "118_3310_ewide", "DBType": 0, "Enabled": true, - "ConnectionString": ";" + "ConnectionString": "Data Source=118.178.224.202;Port=3310;Database=yongjiangbei_vote;User ID=root;Password=root.Ewide;pooling=true;sslmode=none;CharSet=utf8;" + }, + { + "Id": 1, // 连接id,可以配置到数据库 + "DBType": 2, // db类型,枚举,具体的看上边 + "Enabled": false, // 是否开启当前数据库db + "Connection": "WMBlog.db" // 连接字符串 }, { //不知道干什么用的 diff --git a/20220330_Vote/Ewide.Web.Core/Service/DBqueryService.cs b/20220330_Vote/Ewide.Web.Core/Service/DBqueryService.cs index e9aaa99..db89f8d 100644 --- a/20220330_Vote/Ewide.Web.Core/Service/DBqueryService.cs +++ b/20220330_Vote/Ewide.Web.Core/Service/DBqueryService.cs @@ -1,6 +1,5 @@ using Ewide.Core.Util; using Ewide.EntityFramework.Core; -using Ewide.EntityFramework.Core.SqlSugar; using Furion; using Furion.DatabaseAccessor; using Furion.DependencyInjection; diff --git a/20220330_Vote/Ewide.Web.Core/Startup.cs b/20220330_Vote/Ewide.Web.Core/Startup.cs index 60fe722..86ff191 100644 --- a/20220330_Vote/Ewide.Web.Core/Startup.cs +++ b/20220330_Vote/Ewide.Web.Core/Startup.cs @@ -1,5 +1,4 @@ using Ewide.Core; -using Ewide.EntityFramework.Core; using Furion; using Furion.DependencyInjection; using Microsoft.AspNetCore.Authentication.JwtBearer; @@ -42,6 +41,7 @@ namespace Ewide.Web.Core services.AddRemoteRequest(); services.AddConfigurableOptions(); + services.AddConfigurableOptions(); services.AddControllersWithViews() .AddMvcFilter() @@ -70,6 +70,7 @@ namespace Ewide.Web.Core //var workerId = ushort.Parse(App.Configuration["SnowId:WorkerId"] ?? "1"); //IDGenerator.SetIdGenerator(new IDGeneratorOptions { WorkerId = workerId }); services.AddOSSService("HuaweiCloud", "OSSProvider"); + } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs index 1092134..d3e62c7 100644 --- a/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs +++ b/20220330_Vote/Ewide.Web.Entry/Controllers/ManageController.cs @@ -17,7 +17,7 @@ namespace Ewide.Web.Entry.Controllers } public IActionResult Login() { - ViewBag.Title = "宁波市“甬江建设杯”选票"; + //ViewBag.Title = "宁波市“甬江建设杯”选票"; return View(); } public IActionResult Expert() diff --git a/20220330_Vote/Ewide.Web.Entry/Controllers/OutsideWallController.cs b/20220330_Vote/Ewide.Web.Entry/Controllers/OutsideWallController.cs index c65ae2e..fd37ab6 100644 --- a/20220330_Vote/Ewide.Web.Entry/Controllers/OutsideWallController.cs +++ b/20220330_Vote/Ewide.Web.Entry/Controllers/OutsideWallController.cs @@ -3,12 +3,16 @@ using Microsoft.AspNetCore.Mvc; namespace Ewide.Web.Entry.Controllers { + [AllowAnonymous] public class OutsideWallController : Controller { - [AllowAnonymous] public IActionResult Index() { return View(); } + public IActionResult Result() + { + return View(); + } } } diff --git a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml index b7e18f8..1100dbb 100644 --- a/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml +++ b/20220330_Vote/Ewide.Web.Entry/Views/Manage/Login.cshtml @@ -14,7 +14,7 @@ - + @@ -102,7 +102,8 @@ else { window.sessionStorage.setItem('__TOKEN', response.data.data.token); //location = '/gb/yjb/manage/VoteResult' - location = '/gb/yjb/manage/nbczResult' + //location = '/gb/yjb/manage/nbczResult' + location = '/gb/yjb/outsidewall/result' } } _this.loading = false; diff --git a/20220330_Vote/Ewide.Web.Entry/Views/OutsideWall/Index.cshtml b/20220330_Vote/Ewide.Web.Entry/Views/OutsideWall/Index.cshtml index 4be905d..4ef89ae 100644 --- a/20220330_Vote/Ewide.Web.Entry/Views/OutsideWall/Index.cshtml +++ b/20220330_Vote/Ewide.Web.Entry/Views/OutsideWall/Index.cshtml @@ -20,8 +20,11 @@

宁波既有建筑外墙脱落问卷调查

- - + + + + + @@ -39,8 +42,8 @@ *@ - - + @*:on-change="fileChange"*@ +
上传外墙照片
只能上传jpg/png文件,且不超过500kb
@@ -58,62 +61,62 @@
*@
- + - + - + - - + + 例如:漏水、开裂、脱落 - - + - - + @* + *@ - + - + - @* - - - - - - - - - - - - - - *@ - + 14.问题发生后是否请人修复了? - - - + + + - + 15.请提供修复单位的名称: - + - + 16.修复后的部位是否再次发生问题? - - - + + 有再发生 + 没有 20.若您愿意接受我们的现场调查,请惠赐您的联系方式。谢谢! - + - - + @* + - - - - + + + + *@ - 提交报名 + 提 交 我的报名
@@ -316,91 +304,16 @@ return { form: { communityName: '', - phone: '', + communityId: '', deliveryear: '', buildcount: '', totalfloorage: 0, address: '', date: '', - line: '', code: '', - token: '', - houses: [{ - id: '12987122', - BuildingName: '好滋好味鸡蛋仔', - Address: '江浙小吃、小吃零食', - LevelCount: '荷兰优质淡奶,奶香浓而不腻', - Households: '上海市普陀区真北路', - BuildingUnit: '王小虎夫妻店', - DesingerUnit: '10333', - curwallproblems: [], - wallproblemsfirst: '', - firstproblemdate: '', - problemfrequency: '', - problemseason: [], - wallproblemtoward: [], - curwallproblems_other: '', - problemfanwei: '', - problemheight: [], - diaoluowu: [], - }, { - id: '12987123', - BuildingName: '好滋好味鸡蛋仔', - Address: '江浙小吃、小吃零食', - LevelCount: '荷兰优质淡奶,奶香浓而不腻', - Households: '上海市普陀区真北路', - BuildingUnit: '王小虎夫妻店', - DesingerUnit: '10333', - curwallproblems: [], - wallproblemsfirst: '', - firstproblemdate: '', - problemfrequency: '', - problemseason: [], - wallproblemtoward: [], - curwallproblems_other: '', - problemfanwei: '', - problemheight: [], - diaoluowu: [], - }, { - id: '12987124', - BuildingName: '好滋好味鸡蛋仔', - Address: '江浙小吃、小吃零食', - LevelCount: '荷兰优质淡奶,奶香浓而不腻', - Households: '上海市普陀区真北路', - BuildingUnit: '王小虎夫妻店', - DesingerUnit: '10333', - curwallproblems: [], - wallproblemsfirst: '', - firstproblemdate: '', - problemfrequency: '', - problemseason: [], - wallproblemtoward: [], - curwallproblems_other: '', - problemfanwei: '', - problemheight: [], - diaoluowu: [], - }, { - id: '12987125', - BuildingName: '好滋好味鸡蛋仔', - Address: '江浙小吃、小吃零食', - LevelCount: '荷兰优质淡奶,奶香浓而不腻', - Households: '上海市普陀区真北路', - BuildingUnit: '王小虎夫妻店', - DesingerUnit: '10333', - curwallproblems: [], - wallproblemsfirst: '', - firstproblemdate: '', - problemfrequency: '', - problemseason: [], - wallproblemtoward: [], - curwallproblems_other: '', - problemfanwei: '', - problemheight: [], - diaoluowu: [], - }] - //,remark: '' + fileList: [], }, rules: { - communityName: [{ required: true, trigger: 'blur', message: '请选择社区/小区' }], + communityId: [{ required: true, trigger: 'blur', message: '请选择社区/小区' }], phone: [{ validator: checkPhone, required: true, trigger: 'blur' }], code: [{ validator: checkCode, required: true, trigger: 'blur' }], deliveryear: [{ required: false, trigger: 'blur', message: '请输入交付年份' }], @@ -408,7 +321,7 @@ householdcount: [{ required: false, trigger: 'blur', message: '请输入住户总数' }], date: [{ required: true, trigger: 'blur', message: '请选择参加时间' }], line: [{ required: true, trigger: 'blur', message: '请选择线路' }], - totalfloorage: [{ required: true, trigger: 'blur', message: '请输入总建筑面积' }, { validator: checkNumber, message: '总建筑面积必须为数字值' }], + totalfloorage: [{ required: true, trigger: 'blur', message: '请输入总建筑面积' }],//, { validator: checkNumber, message: '总建筑面积必须为数字值' } isExistProblem: [{ required: true, trigger: 'blur', message: '请选择是否' }], curwallproblems: [{ required: true, trigger: ['change', 'blur'], message: '请选择墙体问题' }], firstproblemdate: [{ required: true, trigger: ['change', 'blur'], message: '请选择第一次出现墙体问题时间' }], @@ -424,15 +337,10 @@ disabled: false, datePersonNumber: '', go_disabled: false, - dates: [], pageline: '', lineTxt: '', isshowmyinfo: false, - fileList: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224' }], - childFileList1: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224' }], - childFileList2: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224' }], - childFileList3: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224' }], - childFileList4: [{ name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100' }, { name: 'food2.jpeg', url: 'https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224' }], + fileList: [], dialogImageUrl: '', dialogImageUrls: [], dialogVisible: false, @@ -449,6 +357,8 @@ }, // 要展开的行,数值的元素是row的key值 expands: [], + communitys: [], + childFileList: [] } }, created: function () { @@ -457,12 +367,66 @@ this.form.token = localStorage.getItem("_token"); if (this.getQueryString("valid") == "1" || this.form.token) this.showinfo(); - - //this.get_go_date(); - //this.getdates(); - this.get_line(); + this.GetCommunitys(''); }, methods: { + GetCommunitys(queryString) { + let _this = this; + axios({ + headers: { 'Content-Type': 'application/json;charset=UTF-8' }, + method: 'get', + url: '/gb/yjb/api/outsidewall/Communitys?searchkey=' + queryString, + responseType: "json", + }).then(async response => { + _this.communitys = response.data.data + _this.loading = false; + }).catch(async error => { + console.log(error) + _this.$message({ + type: 'error', + message: error.message + }) + _this.loading = false; + }) + }, + getLabel(arrays, id) { + let opt = {}; + opt = arrays.find((item) => { + return item.id === id; + }); + console.log(opt.name); + return opt.name; + }, + selectCommunity(v) { + this.form.communityName = this.getLabel(this.communitys, v); + + this.loading = true; + let _this = this; + axios({ + headers: { 'Content-Type': 'application/json;charset=UTF-8' }, + method: 'get', + url: '/gb/yjb/api/outsidewall/Community/' + v, + responseType: "json", + }).then(async response => { + _this.form.buildings = response.data.data + _this.form.buildcount = _this.form.buildings.length + _this.form.householdcount = _this.form.buildings.reduce((a, key) => { return a + key.houseHolds }, 0) + _this.form.totalfloorage = _this.form.buildings.reduce((a, key) => { return a + key.areaCount }, 0) + _this.childFileList = []; + //_this.form.buildings.forEach((a) => { _this.childFileList.push({ towards: [{ toward: '东', filelist: [] }, { toward: '西', filelist: [] }, { toward: '南', filelist: [] }, { toward: '北', filelist: [] }] }) }) + _this.form.buildings.forEach((a) => { + _this.childFileList.push({ filelist1: [], filelist2: [], filelist3: [], filelist4: [] }) + }); + _this.loading = false; + }).catch(async error => { + console.log(error) + _this.$message({ + type: 'error', + message: error.message + }) + _this.loading = false; + }) + }, handleValidates(formName) { const list = [] const validas = [] @@ -498,82 +462,177 @@ if (this.handleValidate('childForm')) { } - //this.curwallproblems.push(this.curwallproblems_other); - //if(this.curwallproblems_other.length>0) - //this.houses.find(a => a.id == row.id).curwallproblems = this.curwallproblems; }, clickRowHandle(row, column, event) { - debugger if (this.expands.includes(row.id)) { - return; + //return; this.expands = this.expands.filter(val => val !== row.id); } else { + this.expands = []; this.expands.push(row.id); } }, handleSelectionChange(val) { + debugger; this.multipleSelection = val; }, - fileChange(a, b) { - debugger - this.fileList = b; + fileChange(response, file, fileList, scope, flistidx, toward) { + debugger; + if (response.success == false) { + this.$message.error('上传失败,请稍候重试'); + return; + } + this.loading = true; + if (scope) { + eval("this.childFileList[scope.$index].filelist" + flistidx + "=fileList") + //if (this.childFileList[scope.$index].towards.filter(a => a.toward == toward).length == 0) + // this.childFileList[scope.$index].towards.push({ toward: toward, filelist: [] }); + //this.childFileList[scope.$index].towards.filter(a => a.toward == toward)[0].filelist.push(file) + if (file.response) + this.form.buildings.forEach(a => { + if (a.id == this.expands[0]) { + var _pf = { + file: file.response.data, + toward: toward + } + a.problemfiles.push(_pf) + } + }) + } else { + this.fileList = fileList; + if (file.response) + this.form.fileList.push(file.response.data); + } + this.loading = false; }, - fileChange1(a, b) { - debugger - this.childFileList1 = b; - }, - fileChange2(a, b) { - debugger - this.childFileList2 = b; - }, - fileChange3(a, b) { - debugger - this.childFileList3 = b; - }, - fileChange4(a, b) { - debugger - this.childFileList4 = b; - }, - handleRemove(file, fileList) { + //handleRemove1(file, fileList) { + // let _this = this; + // this.removeFile(file, fileList, function () { + // _this.childFileList1 = _this.childFileList1.filter((a) => { return a.uid != file.uid }) + // if (file.response) + // _this.form.buildings.forEach(a => { + // if (a.id == _this.expands[0]) { + // a.problemfiles = a.problemfiles.filter((x) => { return x.file != file.response.data }) + // } + // }) + // _this.loading = false; + // }, function () { }); + //}, + //handleRemove2(file, fileList) { + // let _this = this; + // this.removeFile(file, fileList, function () { + // _this.childFileList2 = _this.childFileList2.filter((a) => { return a.uid != file.uid }) + // if (file.response) + // _this.form.buildings.forEach(a => { + // if (a.id == _this.expands[0]) { + // a.problemfiles = a.problemfiles.filter((x) => { return x.file != file.response.data }) + // } + // }) + // _this.loading = false; + // }, function () { }); + //}, + //handleRemove3(file, fileList) { + // let _this = this; + // this.removeFile(file, fileList, function () { + // _this.childFileList3 = _this.childFileList3.filter((a) => { return a.uid != file.uid }) + // if (file.response) + // _this.form.buildings.forEach(a => { + // if (a.id == _this.expands[0]) { + // a.problemfiles = a.problemfiles.filter((x) => { return x.file != file.response.data }) + // } + // }) + // _this.loading = false; + // }, function () { }); + //}, + //handleRemove4(file, fileList) { + // let _this = this; + // this.removeFile(file, fileList, function () { + // _this.childFileList4 = _this.childFileList4.filter((a) => { return a.uid != file.uid }) + // if (file.response) + // _this.form.buildings.forEach(a => { + // if (a.id == _this.expands[0]) { + // a.problemfiles = a.problemfiles.filter((x) => { return x.file != file.response.data }) + // } + // }) + // _this.loading = false; + // }, function () { }); + //}, + //handleRemove(file, fileList, scope) { + // let _this = this; + // this.removeFile(file, fileList, function () { + // _this.fileList = _this.fileList.filter((a) => { return a.uid != file.uid }) + // if (file.response) + // _this.form.fileList = _this.form.fileList.filter((a) => { return a != file.response.data }) + // _this.loading = false; + // }, function () { }); + //}, + handleRemove(file, fileList, scope) { + let _this = this; + _this.loading = true; console.log(file, fileList); + axios({ + headers: { 'Content-Type': 'application/json;charset=UTF-8' }, + method: 'get', + url: '/gb/yjb/api/outsidewall/sysFileInfo/delete/' + file.response.data, + responseType: "json", + }).then(async response => { + if (scope) { + this.childFileList[scope.$index].towards = this.childFileList[scope.$index].towards.filter((a) => { return a.uid != file.uid }) + + if (file.response) + _this.form.buildings.forEach(a => { + if (a.id == _this.expands[0]) { + a.problemfiles = a.problemfiles.filter((x) => { return x.file != file.response.data }) + } + }) + } else { + _this.fileList = _this.fileList.filter((a) => { return a.uid != file.uid }) + if (file.response) + _this.form.fileList = _this.form.fileList.filter((a) => { return a != file.response.data }); + } + _this.loading = false; + }).catch(async error => { + console.log(error) + }) }, - handlePreview(file) { + filePreview(file, fileList) { debugger + this.loading = true; console.log(file); - this.dialogImageUrl = file.url; - this.dialogImageUrls = this.fileList.map(a => a.url); + this.dialogImageUrl = window.location.protocol + "//" + window.location.host + "/gb/yjb/api/outsidewall/sysFileInfo/preview/" + file.response.data; + this.dialogImageUrls = fileList.map(a => window.location.protocol + "//" + window.location.host + "/gb/yjb/api/outsidewall/sysFileInfo/preview/" + a.response.data); this.$refs.myImg.showViewer = true const m = (e) => { e.preventDefault() }; document.body.style.overflow = 'hidden'; document.addEventListener("touchmove", m, false); // 禁止页面滑动 + this.loading = false; }, - getQueryString(communityName) { - var reg = new RegExp("(^|&)" + communityName + "=([^&]*)(&|$)", "i"); + handlePreview(file, scope, toward) { + debugger + if (scope) { + eval("this.filePreview(file, this.childFileList[scope.$index].filelist" + toward + ")") + //this.filePreview(file, this.childFileList[scope.$index].towards.filter(a => a.toward == toward).filelist) + } + else + this.filePreview(file, this.fileList) + }, + handlePreview1(file, scope) { + this.filePreview(file, this.childFileList1) + }, + handlePreview2(file, scope) { + this.filePreview(file, this.childFileList2) + }, + handlePreview3(file, scope) { + this.filePreview(file, this.childFileList3) + }, + handlePreview4(file, scope) { + this.filePreview(file, this.childFileList4) + }, + getQueryString(communityId) { + var reg = new RegExp("(^|&)" + communityId + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }, - get_line() { - let _this = this; - var line = this.getQueryString("line") ?? "A" - if (line == "A" || line == "a") { - _this.lineTxt = '慈溪:“历史之路 文化之路 创新之路 共富之路”的慈溪南部沿山风情共富线。'; - _this.pageline = _this.form.line = '慈溪'; - } - else if (line == "B" || line == "b") { - _this.lineTxt = '奉化:“应梦明山入城,剡水桃源归野”的奉化明山剡水共富线。'; - _this.pageline = _this.form.line = '奉化'; - } - else if (line == "C" || line == "c") { - _this.lineTxt = '象山:“万象山海,逐梦亚运”象山扬帆亚运风情共富线三条体验游览线。'; - _this.pageline = _this.form.line = '象山'; - } - }, - get_go_date() { - //判断上车日期 - let _this = this; - _this.form.token = localStorage.getItem("_token"); - - }, getCode() { this.$refs['form'].validateField('phone', (err) => { if (err) { @@ -624,78 +683,89 @@ } }, 1000); }, - onSubmit(formName) { + onSubmit(formName, formNameChild) { console.log('submit!'); let _this = this; - this.$refs[formName].validate((valid) => { // 为表单绑定验证功能 + this.$refs[formName].validate((valid) => { if (valid) { - //this.$alert("成功", "提示") - axios({ - headers: { 'Content-Type': 'application/json;charset=UTF-8' }, - method: 'post', - url: '/gb/yjb/api/ningbozhichun/submit', - data: _this.form, - responseType: "json", - }).then(async response => { - if (response.data?.data?.success == true) { - let token = response.data.data.token; - localStorage.setItem("_token", token) - _this.$alert(`
提交成功
`, '成功', { - confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true - }).then(a => { }).catch(err => { console.log(err) }); - } else { - _this.$alert(`
` + response.data.message + `
`, '错误', { - confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true - }).then(a => { }).catch(err => { console.log(err) }); - } - _this.loading = false; - }).catch(async error => { - console.log(error) - _this.$message({ - type: 'error', - message: error.message - }) - _this.loading = false; - }) - + if (_this.form.isExistProblem == '0') { + _this.submit2(); + } else { + if (this.$refs[formNameChild]) + this.$refs[formNameChild].validate((valid) => { + if (valid) { + debugger + _this.submit2(); + } + }); + } } }); }, - go(formName) { - console.log('上车!'); + submit2() { + debugger; let _this = this; - this.$refs[formName].validate((valid) => { // 为表单绑定验证功能 - if (valid) { - axios({ - headers: { 'Content-Type': 'application/json;charset=UTF-8' }, - method: 'post', - url: '/gb/yjb/api/ningbozhichun/submit', - data: _this.form, - responseType: "json", - }).then(async response => { - if (response.data?.data?.success == true) { - let token = response.data.data.token; - localStorage.setItem("_token", token) - _this.$alert(`
提交成功
`, '成功', { - confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true - }).then(a => { }).catch(err => { console.log(err) }); - } else { - _this.$alert(`
` + response.data.message + `
`, '错误', { - confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true - }).then(a => { }).catch(err => { console.log(err) }); - } - _this.loading = false; - }).catch(async error => { - console.log(error) - _this.$message({ - type: 'error', - message: error.message - }) - _this.loading = false; - }) + //let config = { + // //formData 提交请求头有两种 multipart/form-data 和 application/x-www-form-urlencoded + // // multipart/form-data 用于type=file 的input提交 + // headers: { + // "Content-Type": "multipart/form-data" + // } + //}; + //const fd = new FormData() + //fd.append('appid', "123") + //fd.append('wall', _this.form) + //for (let _i in _this.fileList) { + // fd.append('file', _i) + //} + //axios.post('/gb/yjb/api/outsidewall/submit', fd, config).then(res => { + // debugger + //}).catch(error => { + // console.log(error); + //}); + + axios({ + headers: { 'Content-Type': 'multipart/form-data' }, + method: 'post', + url: '/gb/yjb/api/outsidewall/submit', + data: _this.form, + responseType: "json", + }).then(async response => { + if (response.data?.data?.success == true) { + let token = response.data.data.token; + localStorage.setItem("_token", token) + _this.$alert(`
提交成功
`, '成功', { + confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true + }).then(a => { }).catch(err => { console.log(err) }); + } else { + _this.$alert(`
` + response.data.message + `
`, '错误', { + confirmButtonText: '确定', dangerouslyUseHTMLString: true, center: true, closeOnClickModal: true + }).then(a => { }).catch(err => { console.log(err) }); } - }); + _this.loading = false; + }).catch(async error => { + console.log(error) + _this.$message({ + type: 'error', + message: error.message + }) + _this.loading = false; + }) + }, + getFormData(object) { + const formData = new FormData() + Object.keys(object).forEach(key => { + const value = object[key] + if (Array.isArray(value)) { + value.forEach((subValue, i) => + formData.append(key + `[${i}]`, subValue) + ) + } else { + formData.append(key, object[key]) + } + }) + return formData }, loading_false() { this.loading = false }, showinfo() { @@ -782,11 +852,6 @@ display: none; width: 100px; height: 100px; - /*.el-image__inner - { - visibility: hidden; - display:none; - } */ } + + \ No newline at end of file diff --git a/20220330_Vote/Ewide.Web.Entry/appsettings.json b/20220330_Vote/Ewide.Web.Entry/appsettings.json index 08cc113..4b7665c 100644 --- a/20220330_Vote/Ewide.Web.Entry/appsettings.json +++ b/20220330_Vote/Ewide.Web.Entry/appsettings.json @@ -50,6 +50,11 @@ "SmsAccount": "tempaccount0309", "SmsPwd": "Aabc!@#20KHL+@+124bjaT(6q", "TotalCount": 40 + }, + "OutsideWallSetting": { + "SanjuKey": "vPFu7zKB08Uaxuzsc5zozAAT6W0zr3qw", + "GetCommunitys": "http://sjk.test.ky.com/housesafety/statistics/GetCommunitys?searchName={0}", + "GetHouseInfoCitysByCommunity": "http://sjk.test.ky.com/housesafety/statistics/GetHouseInfoCitysByCommunity?communityID={0}" } } \ No newline at end of file diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/008820d1-8309-40a0-9212-9896da70f367.png b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/008820d1-8309-40a0-9212-9896da70f367.png new file mode 100644 index 0000000..cf739b4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/008820d1-8309-40a0-9212-9896da70f367.png differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/10734280-3aef-4045-95b5-c39d71978050.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/10734280-3aef-4045-95b5-c39d71978050.jpg new file mode 100644 index 0000000..89f7d9c Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/10734280-3aef-4045-95b5-c39d71978050.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1177d716-4b7e-4b81-b09b-d740fb95a8f5.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1177d716-4b7e-4b81-b09b-d740fb95a8f5.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1177d716-4b7e-4b81-b09b-d740fb95a8f5.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/15537aa6-9162-42b4-8b6e-8ac3319b1a2f.bmp b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/15537aa6-9162-42b4-8b6e-8ac3319b1a2f.bmp new file mode 100644 index 0000000..d83b51a Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/15537aa6-9162-42b4-8b6e-8ac3319b1a2f.bmp differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1e232021-2fd6-40ba-81ac-b2b7b02037a8.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1e232021-2fd6-40ba-81ac-b2b7b02037a8.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/1e232021-2fd6-40ba-81ac-b2b7b02037a8.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/2ddea634-213a-49ae-ad86-32b13965c4e4.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/2ddea634-213a-49ae-ad86-32b13965c4e4.jpg new file mode 100644 index 0000000..980b98f Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/2ddea634-213a-49ae-ad86-32b13965c4e4.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3009109f-d059-4da2-b200-7b96358f8f9d.png b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3009109f-d059-4da2-b200-7b96358f8f9d.png new file mode 100644 index 0000000..0e62d7c Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3009109f-d059-4da2-b200-7b96358f8f9d.png differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3214cdaa-411f-4b89-acd5-145e9ecf52e5.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3214cdaa-411f-4b89-acd5-145e9ecf52e5.jpg new file mode 100644 index 0000000..00d33de Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3214cdaa-411f-4b89-acd5-145e9ecf52e5.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3df729dd-3f00-4bf7-b42b-cfcd88d7e023.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3df729dd-3f00-4bf7-b42b-cfcd88d7e023.jpg new file mode 100644 index 0000000..980b98f Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/3df729dd-3f00-4bf7-b42b-cfcd88d7e023.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4e065ef8-715b-4b06-8aff-8dd61ca71e60.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4e065ef8-715b-4b06-8aff-8dd61ca71e60.jpg new file mode 100644 index 0000000..bf088c1 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4e065ef8-715b-4b06-8aff-8dd61ca71e60.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4f0b50e2-91e5-4d70-b914-a705b730c509.bmp b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4f0b50e2-91e5-4d70-b914-a705b730c509.bmp new file mode 100644 index 0000000..d83b51a Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/4f0b50e2-91e5-4d70-b914-a705b730c509.bmp differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/572e3889-c5c0-4dc3-9cd6-6040fa0d39b2.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/572e3889-c5c0-4dc3-9cd6-6040fa0d39b2.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/572e3889-c5c0-4dc3-9cd6-6040fa0d39b2.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/5bdfc4b6-e9b8-4798-8b67-334cf76a9f26.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/5bdfc4b6-e9b8-4798-8b67-334cf76a9f26.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/5bdfc4b6-e9b8-4798-8b67-334cf76a9f26.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/6a092a14-1057-4a98-a82a-e777af7ba1a3.png b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/6a092a14-1057-4a98-a82a-e777af7ba1a3.png new file mode 100644 index 0000000..cf739b4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/6a092a14-1057-4a98-a82a-e777af7ba1a3.png differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7109762e-b62e-4124-99fd-3d55e1d798ff.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7109762e-b62e-4124-99fd-3d55e1d798ff.jpg new file mode 100644 index 0000000..980b98f Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7109762e-b62e-4124-99fd-3d55e1d798ff.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/734a950d-40c8-41a1-9285-656183008af4.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/734a950d-40c8-41a1-9285-656183008af4.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/734a950d-40c8-41a1-9285-656183008af4.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/77ea93ab-3e86-4bfc-9212-6f7c0f240fa9.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/77ea93ab-3e86-4bfc-9212-6f7c0f240fa9.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/77ea93ab-3e86-4bfc-9212-6f7c0f240fa9.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7991927e-be04-4be2-9af7-b55ef6e525e5.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7991927e-be04-4be2-9af7-b55ef6e525e5.jpg new file mode 100644 index 0000000..e698f66 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/7991927e-be04-4be2-9af7-b55ef6e525e5.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/83ba8157-bb20-4291-a4bc-84943eacab8b.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/83ba8157-bb20-4291-a4bc-84943eacab8b.jpg new file mode 100644 index 0000000..980b98f Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/83ba8157-bb20-4291-a4bc-84943eacab8b.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9689267f-d9d9-40fe-b0d8-ef276236c6f1.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9689267f-d9d9-40fe-b0d8-ef276236c6f1.jpg new file mode 100644 index 0000000..86c0c20 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9689267f-d9d9-40fe-b0d8-ef276236c6f1.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9de9c879-096a-4372-bb58-77375ce28228.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9de9c879-096a-4372-bb58-77375ce28228.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/9de9c879-096a-4372-bb58-77375ce28228.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/a460d8d5-b3aa-431e-91f9-88636490aaee.bmp b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/a460d8d5-b3aa-431e-91f9-88636490aaee.bmp new file mode 100644 index 0000000..66225b5 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/a460d8d5-b3aa-431e-91f9-88636490aaee.bmp differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b2b4ae4a-7cc2-4058-940a-7b3bb39bfc80.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b2b4ae4a-7cc2-4058-940a-7b3bb39bfc80.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b2b4ae4a-7cc2-4058-940a-7b3bb39bfc80.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b9f45426-661c-4ac2-bf4e-d0fca87abf46.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b9f45426-661c-4ac2-bf4e-d0fca87abf46.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/b9f45426-661c-4ac2-bf4e-d0fca87abf46.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/bcb0f81a-abc6-4d26-87df-9ff6266211e4.gif b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/bcb0f81a-abc6-4d26-87df-9ff6266211e4.gif new file mode 100644 index 0000000..187bdce Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/bcb0f81a-abc6-4d26-87df-9ff6266211e4.gif differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c38d8788-156a-430b-9b62-2578e6cb6c4c.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c38d8788-156a-430b-9b62-2578e6cb6c4c.jpg new file mode 100644 index 0000000..0ad3893 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c38d8788-156a-430b-9b62-2578e6cb6c4c.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c891cb8b-6abc-4c75-b9ca-6057fc4a5bbc.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c891cb8b-6abc-4c75-b9ca-6057fc4a5bbc.jpg new file mode 100644 index 0000000..bf088c1 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/c891cb8b-6abc-4c75-b9ca-6057fc4a5bbc.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d8b0ee6e-d910-4bc5-83c6-ab8182f58ede.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d8b0ee6e-d910-4bc5-83c6-ab8182f58ede.jpg new file mode 100644 index 0000000..00d33de Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d8b0ee6e-d910-4bc5-83c6-ab8182f58ede.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d91bb251-fb92-4c4d-865f-ff32a5a3fffe.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d91bb251-fb92-4c4d-865f-ff32a5a3fffe.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d91bb251-fb92-4c4d-865f-ff32a5a3fffe.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d977d098-4ec2-416d-aaf0-f8d14a0421ac.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d977d098-4ec2-416d-aaf0-f8d14a0421ac.jpg new file mode 100644 index 0000000..9a37171 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/d977d098-4ec2-416d-aaf0-f8d14a0421ac.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/dd0598b1-e539-4df4-a62d-ac346c63269b.png b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/dd0598b1-e539-4df4-a62d-ac346c63269b.png new file mode 100644 index 0000000..cf739b4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/dd0598b1-e539-4df4-a62d-ac346c63269b.png differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ec871563-d43e-42c1-8ebf-df65799b0f48.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ec871563-d43e-42c1-8ebf-df65799b0f48.jpg new file mode 100644 index 0000000..82d69c4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ec871563-d43e-42c1-8ebf-df65799b0f48.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ef39d146-887e-4ed9-adf2-c849395efd33.jpg b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ef39d146-887e-4ed9-adf2-c849395efd33.jpg new file mode 100644 index 0000000..980b98f Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/ef39d146-887e-4ed9-adf2-c849395efd33.jpg differ diff --git a/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/fee56c0e-e3de-4697-a5a4-b71c861fcbcf.png b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/fee56c0e-e3de-4697-a5a4-b71c861fcbcf.png new file mode 100644 index 0000000..cf739b4 Binary files /dev/null and b/20220330_Vote/Ewide.Web.Entry/wwwroot/Upload/Default/fee56c0e-e3de-4697-a5a4-b71c861fcbcf.png differ diff --git a/20220330_Vote/Vote.Services/ApiController/OutsideWallService.cs b/20220330_Vote/Vote.Services/ApiController/OutsideWallService.cs index 8bec0a8..b3fb2e3 100644 --- a/20220330_Vote/Vote.Services/ApiController/OutsideWallService.cs +++ b/20220330_Vote/Vote.Services/ApiController/OutsideWallService.cs @@ -5,241 +5,322 @@ using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; +using System.Web; using Ewide.Core; -using Ewide.Core.Util; +using Ewide.Core.Service; using Furion; using Furion.ClayObject.Extensions; using Furion.DatabaseAccessor; +using Furion.DatabaseAccessor.Extensions; using Furion.DataEncryption; +using Furion.DataEncryption.Extensions; using Furion.DynamicApiController; using Furion.FriendlyException; using Furion.RemoteRequest.Extensions; +using Google.Protobuf.Reflection; +using Mapster; using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; +using Microsoft.Extensions.Options; using Newtonsoft.Json.Linq; +using NPOI.HPSF; using Vote.Services.Dto; using Vote.Services.Entities; namespace Vote.Services.ApiController { /// - /// 共赴宁波之春 + /// 外墙调查问卷 /// [ApiDescriptionSettings("outsidewall", Order = 0)] [Route("/gb/yjb/api/outsidewall")] public class OutsideWallService : IDynamicApiController { - private readonly IRepository repPerson; - private readonly IRepository repSmsCode; + private readonly SqlSugarRepository repoutside_wall; + private readonly SqlSugarRepository repoutside_wall_building; + private readonly SqlSugarRepository repoutside_wall_building_photo; + private readonly SqlSugarRepository repoutside_wall_photo; + private readonly SqlSugarRepository rep_SysFile; private readonly IMemoryCache _memoryCache; + readonly IOptions _options; /// /// /// - /// - public OutsideWallService(IRepository _repNingbo, IRepository _repSmsCode, IMemoryCache memoryCache) + /// + /// + /// + /// + /// + public OutsideWallService(SqlSugarRepository _repoutside_wall, SqlSugarRepository _repoutside_wall_building, SqlSugarRepository _repoutside_wall_building_photo, SqlSugarRepository _repoutside_wall_photo, IMemoryCache memoryCache, SqlSugarRepository _rep_SysFile, IOptions options) { - repPerson = _repNingbo; - this.repSmsCode = _repSmsCode; + repoutside_wall = _repoutside_wall; + repoutside_wall_building = _repoutside_wall_building; + repoutside_wall_building_photo = _repoutside_wall_building_photo; + repoutside_wall_photo = _repoutside_wall_photo; _memoryCache = memoryCache; + _options = options; + rep_SysFile = _rep_SysFile; } - /// - /// 提交 - /// - /// - [HttpPost] - [UnitOfWork] - [Microsoft.AspNetCore.Authorization.AllowAnonymous] - [Route("sendcode")] - public async Task SendCode(NbzcSendCodeInput args) + /// 获取三居系统中的社区 + /// + /// + [AllowAnonymous] + [HttpGet("query/{id}")] + public async Task Query(string id) { - //var data = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted && p.expire_time > DateTime.Now) - // .FirstOrDefaultAsync(); - //_ = (data != null) ? throw Oops.Oh("已存在此号码的有效发送记录,不可重复发送") : 1; - var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync(); - _ = lastSend != null && DateTime.Now <= lastSend.CreatedTime.Value.AddMinutes(1) ? throw Oops.Oh("发送过于频繁,请1分钟后再试") : 1; - - //_ = (await repPerson.DetachedEntities.Where(a => !a.IsDeleted && (a.phone == args.phone || a.cardno == args.cardno)).CountAsync() > 0) ? throw Oops.Oh("您已提交,无需再次获取验证码") : 1; - string _timeCacheKey = "sms_token_" + args.phone; - var code = new Random().Next(1001, 9999); - if (App.GetConfig("NingboZhiChun:OpenSms") == 1) + var entity = await repoutside_wall.AsQueryable().FirstAsync(a => a.communityId == id); + if (entity != null) { - var cacheTokenValue = _memoryCache.Get(_timeCacheKey); - if (string.IsNullOrEmpty(cacheTokenValue)) - { - var rslt = await App.GetConfig("NingboZhiChun:SmsTokenUrl").SetBody(new { username = App.GetConfig("NingboZhiChun:SmsAccount"), password = App.GetConfig("NingboZhiChun:SmsPwd") }, "application/json").SetHttpMethod(HttpMethod.Post).SendAsStringAsync(); - cacheTokenValue = Newtonsoft.Json.Linq.JObject.Parse(rslt)["data"]["token"].ToString(); - var cacheEntryOptions = new MemoryCacheEntryOptions() - .SetSlidingExpiration(TimeSpan.FromMinutes(100)); - _memoryCache.Set(_timeCacheKey, cacheTokenValue, cacheEntryOptions); - } - var sendrslt = await App.GetConfig("NingboZhiChun:SmsSendUrl") - .SetHttpMethod(HttpMethod.Post) - .SetHeaders(new Dictionary { { "Authorization", "Bearer " + cacheTokenValue } }) - .SetBody(new { phone_number = args.phone, sms_content = $"您的验证码是:{code},10分钟内有效。" }) - .SendAsStringAsync(); - if (!Newtonsoft.Json.Linq.JObject.Parse(sendrslt)["issuccess"].Value()) - throw Oops.Oh("验证码短信发送失败."); + var outside_wall_photos = await repoutside_wall_photo.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync(); + entity.outside_wall_photos = outside_wall_photos; + var outside_wall_buildings = await repoutside_wall_building.AsQueryable().Where(a => a.outsidewallId == entity.Id).ToListAsync(); + entity.outside_wall_buildings = outside_wall_buildings; + return entity; } - await new Entities.nbzc_sms_code - { - code = code.ToString(), - CreatedTime = DateTime.Now, - expire_time = DateTime.Now.AddMinutes(10), - IsDeleted = false, - phone = args.phone - }.InsertOrUpdate(); - return true; + return null; } /// - /// 提交 - /// - /// - [HttpPost] - [UnitOfWork] - [Microsoft.AspNetCore.Authorization.AllowAnonymous] - public async Task SubmitSubmit(NbzcSubmitInput args) + /// 获取三居系统中的社区 + /// + /// + [AllowAnonymous] + [HttpGet("communitys")] + public async Task> GetCommunitys(string searchkey) { - var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync(); - _ = (lastSend == null || lastSend.code != args.code || lastSend.expire_time < DateTime.Now) ? throw Oops.Oh("验证码错误或已失效") : 1; - var totalCount = await repPerson.DetachedEntities.Where(a => !a.IsDeleted && a.date == args.date).CountAsync(); - _ = totalCount >= App.GetConfig("NingboZhiChun:TotalCount") ? throw Oops.Oh("提交失败,名额已满。") : 1; - _ = (await repPerson.DetachedEntities.Where(a => !a.IsDeleted && (a.phone == args.phone || a.cardno == args.cardno)).CountAsync() > 0) ? throw Oops.Oh("您已提交,无需再次提交") : 1; - var now = DateTime.Now; - var model = new Entities.nbzc_person + var cacheKey = "cache_GetCommunitys"; + List Communitys = null; + Communitys = _memoryCache.Get>(cacheKey); + if (Communitys == null || Communitys.Count == 0) { - address = args.address, - phone = args.phone, - cardno = args.cardno, - CreatedTime = DateTime.Now, - date = args.date, - hangye = args.hangye, - IsDeleted = false, - line = args.line, - name = args.name, - weixin_number = args.weixin_number + //var aaaaaaaaaaaaaa = repoutside_wall.AsQueryable().ToList(); + var SanjuKey = App.GetConfig("OutsideWallSetting:SanjuKey"); + var timeStamp = GetTimeStamp(); + var sign = (SanjuKey + timeStamp).ToMD5Encrypt(); + var GetCommunitysUrl = App.GetConfig("OutsideWallSetting:GetCommunitys"); + var GetHouseInfoCitysByCommunityUrl = App.GetConfig("OutsideWallSetting:GetHouseInfoCitysByCommunity"); + Communitys = await string.Format(GetCommunitysUrl, "") + .SetHeaders(new Dictionary { { "sign", sign }, { "timeStamp", timeStamp } }) + .GetAsAsync>(); + _memoryCache.Set(cacheKey, Communitys, DateTime.Now.AddHours(1)); + } + if (!string.IsNullOrEmpty(searchkey)) + return Communitys.Where(a => a.Name.Contains(searchkey)).ToList(); + return Communitys; + } + /// + /// 获取三居系统中的社区 + /// + /// + [AllowAnonymous] + [HttpGet("community/{id}")] + public async Task GetCommunityInfo(string id) + { + var cacheKey = "cache_building_" + id; + List building = _memoryCache.Get>(cacheKey); + if (building == null) + { + var SanjuKey = App.GetConfig("OutsideWallSetting:SanjuKey"); + var timeStamp = GetTimeStamp(); + var sign = (SanjuKey + timeStamp).ToMD5Encrypt(); + var GetHouseInfoCitysByCommunityUrl = App.GetConfig("OutsideWallSetting:GetHouseInfoCitysByCommunity"); + building = await string.Format(GetHouseInfoCitysByCommunityUrl, id) + .SetHeaders(new Dictionary { { "sign", sign }, { "timeStamp", timeStamp } }) + .GetAsAsync>(); + _memoryCache.Set(cacheKey, building, DateTime.Now.AddHours(1)); + } + return building; + } + + /// + /// 获取时间戳 + /// + /// + private string GetTimeStamp() + { + TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); + return Convert.ToInt64(ts.TotalMilliseconds).ToString(); + } + /// + /// 上传文件 + /// + /// + /// + [AllowAnonymous] + [HttpPost("sysFileInfo/upload")] + public async Task UploadFileDefault(IFormFile file) + { + return await UploadFile(file, _options.Value.Default); + } + /// + /// 删除文件 + /// + /// + /// + [AllowAnonymous] + [HttpGet("sysFileInfo/delete/{id}")] + public async Task DeleteFile(string id) + { + var entity = await rep_SysFile.AsQueryable().FirstAsync(a => a.Id == id); + _ = entity == null ? throw Oops.Oh("参数异常") : ""; + var pathType = _options.Value.Default.path; + var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, pathType); + File.Delete(Path.Combine(filePath, entity.FileObjectName)); + await rep_SysFile.DeleteAsync(id); + } + /// + /// 预览文件 + /// + /// + /// + [AllowAnonymous] + [HttpGet("sysFileInfo/preview/{id}")] + public async Task PreviewFileInfo(string id) + { + var file = await rep_SysFile.AsQueryable().FirstAsync(a => a.Id == id); + _ = file == null ? throw Oops.Oh("参数异常") : ""; + var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, file.FileBucket, file.FileObjectName); + var fileName = HttpUtility.UrlEncode(file.FileOriginName?.Replace(" ", null).Replace("\"", null), Encoding.UTF8); + return new FileStreamResult(new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Ewide.Core.Util.MimeMapping.GetMimeMapping(filePath)) { FileDownloadName = fileName }; + //return await DownloadFileInfo(input); + } + /// + /// 上传文件 + /// + /// + /// + /// + private static async Task UploadFile(IFormFile file, FileDescription fileOption) + { + var pathType = fileOption.path; + var mimeType = Ewide.Core.Util.MimeMapping.GetMimeMapping(file.FileName); + if (!fileOption.contentType.Contains(mimeType)) + { + throw Oops.Oh("上传文件mimeType错误!"); + } + var fileId = Guid.NewGuid().ToString(); + var fileSizeKb = (long)(file.Length / 1024.0); // 文件大小KB + if (fileSizeKb > fileOption.maxSize) + { + throw Oops.Oh("文件大小超过最大限制!"); + } + var originalFilename = file.FileName; // 文件原始名称 + var fileSuffix = Path.GetExtension(file.FileName).ToLower(); // 文件后缀 + var finalName = fileId + fileSuffix; // 生成文件的最终名称 + var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, pathType); + if (!Directory.Exists(filePath)) + Directory.CreateDirectory(filePath); + + using (var stream = File.Create(Path.Combine(filePath, finalName))) + { + await file.CopyToAsync(stream); + } + + var sysFileInfo = new SysFile + { + Id = fileId, + FileLocation = (int)FileLocation.LOCAL, + FileBucket = pathType, + FileObjectName = finalName, + FileOriginName = originalFilename, + FileSuffix = fileSuffix.TrimStart('.'), + FileSizeKb = fileSizeKb }; - model = await model.InsertOrUpdate(); - lastSend.IsDeleted = true; - await repSmsCode.UpdateIncludeAsync(lastSend, new string[] { nameof(lastSend.IsDeleted) }); - var token = JWTEncryption.Encrypt(new Dictionary() // 加密 - { - { "UserId", model.Id }, - { "Account",model.phone } - }); - return new { success = true, token }; + //await rep_SysFile.InsertAsync(sysFileInfo); + await sysFileInfo.InsertAsync(); + + return fileId; } /// - /// 获取我的报名 + /// 提交 /// /// - [HttpPost] - [UnitOfWork] - [Microsoft.AspNetCore.Authorization.AllowAnonymous] - [Route("getmyinfo")] - public async Task GetMyInfo(NbzcGetMyInfoInput args) + [Consumes("application/json", "multipart/form-data")] + [HttpPost("submit")] + [AllowAnonymous] + public async Task Submit([FromForm] OutsideWallInput args) { - var newToken = args.token; - nbzc_person entity = null; - if (!string.IsNullOrEmpty(args.token)) + try { - var tokenData = JWTEncryption.ReadJwtToken(args.token); - //_ = (tokenData == null) ? throw Oops.Oh("您还没有提交过或者手机号码填写错误") : 1; - if (tokenData == null) + repoutside_wall.Ado.BeginTran(); + var wall = args.Adapt(); + wall.Id = Guid.NewGuid().ToString(); + wall.createtime = DateTime.Now; + wall.isdeleted = 0; + wall = await repoutside_wall.InsertReturnEntityAsync(wall); + if (args.fileList != null) { - newToken = null; - } - else - { - var userId = tokenData.Claims.Where(a => a.Type == "UserId").FirstOrDefault().Value; - entity = await repPerson.DetachedEntities.Where(a => a.Id == userId).FirstOrDefaultAsync(); - } - } - else - { - _ = (string.IsNullOrEmpty(args.code)) ? throw Oops.Oh("验证码错误或已失效") : 1; - var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync(); - _ = (lastSend == null || lastSend.code != args.code || lastSend.expire_time < DateTime.Now) ? throw Oops.Oh("验证码错误或已失效") : 1; - entity = await repPerson.DetachedEntities.Where(a => a.phone == args.phone && !a.IsDeleted).FirstOrDefaultAsync(); - if (entity != null) - newToken = JWTEncryption.Encrypt(new Dictionary() + foreach (var item in args.fileList) { - { "UserId", entity.Id }, - { "Account",entity.phone } - }); + await repoutside_wall_photo.InsertReturnEntityAsync(new outside_wall_photo + { + outsidewallId = wall.Id, + sysfileid = item + }); + } + } + foreach (var item in args.buildings) + { + var build = item.Adapt(); + build.Id = Guid.NewGuid().ToString(); + build.outsidewallId = wall.Id; + build.BuildingId = build.Id; + build.createtime = DateTime.Now; + build = await repoutside_wall_building.InsertReturnEntityAsync(build); + if (item.problemfiles != null) + { + foreach (var item1 in item.problemfiles) + { + await repoutside_wall_building_photo.InsertReturnEntityAsync(new outside_wall_building_photo + { + outsidewallBuildingId = build.Id, + sysfileid = item1.file, + toward = item1.Toward + }); + } + } + } + repoutside_wall.Ado.CommitTran(); + return "提交成功"; } - return new { success = true, entity, token = newToken }; - } - /// - /// 获取时间线路人数 - /// - /// - [HttpPost] - [UnitOfWork] - [Microsoft.AspNetCore.Authorization.AllowAnonymous] - [Route("getnumber")] - public async Task GetNumber(NbzcGetNumberInput args) - { - var n = await repPerson.DetachedEntities.Where(a => !a.IsDeleted && a.date == args.date).CountAsync(); - return new { success = true, n = App.GetConfig("NingboZhiChun:TotalCount") - n }; - } - /// - /// 获取清单 - /// - /// - [HttpPost] - [UnitOfWork] - [Route("GetPersonList")] - public async Task GetPersonList(NbzcGetListInput args) - { - var list = await repPerson.DetachedEntities.Where(a => !a.IsDeleted).OrderByDescending(a => a.CreatedTime).ToListAsync(); - return list; - } - - - - /// - /// 导出Excel - /// - /// - [HttpPost] - [UnitOfWork] - [Route("export_excel")] - public async Task ExportExcel(NbzcGetListInput args) - { - var list = await repPerson.DetachedEntities.Where(a => !a.IsDeleted).OrderByDescending(a => a.CreatedTime).ToListAsync(); - var filepath = Tools.ExcelHelper.WriteExcelNingBoZhiChun(list); - return new FileStreamResult(new FileStream(filepath, FileMode.Open), "application/octet-stream") { FileDownloadName = filepath }; - } - - /// - /// 查询 - /// - /// - [HttpPost] - [UnitOfWork] - [Route("query")] - public async Task Query(NbzcQueryInput args) - { - List result = null; - var iquery = repPerson.DetachedEntities.Where(a => !a.IsDeleted); - if (args == null) - result = await iquery.ToListAsync(); - else + catch (Exception ex) { - if (!string.IsNullOrEmpty(args.date)) - iquery = iquery.Where(a => a.date == args.date); - if (!string.IsNullOrEmpty(args.name)) - iquery = iquery.Where(a => a.name.Contains(args.name)); - if (!string.IsNullOrEmpty(args.phone)) - iquery = iquery.Where(a => a.phone.Contains(args.phone)); - if (!string.IsNullOrEmpty(args.line)) - iquery = iquery.Where(a => a.line == args.line); - result = await iquery.ToListAsync(); + repoutside_wall.Ado.RollbackTran(); + throw Oops.Oh(ex.Message + ex.StackTrace); } - return new { success = true, result }; + //var lastSend = await repSmsCode.DetachedEntities.Where(p => p.phone == args.phone && !p.IsDeleted).OrderByDescending(a => a.CreatedTime).FirstOrDefaultAsync(); + //_ = (lastSend == null || lastSend.code != args.code || lastSend.expire_time < DateTime.Now) ? throw Oops.Oh("验证码错误或已失效") : 1; + //var totalCount = await repPerson.DetachedEntities.Where(a => !a.IsDeleted && a.date == args.date).CountAsync(); + //_ = totalCount >= App.GetConfig("NingboZhiChun:TotalCount") ? throw Oops.Oh("提交失败,名额已满。") : 1; + //_ = (await repPerson.DetachedEntities.Where(a => !a.IsDeleted && (a.phone == args.phone || a.cardno == args.cardno)).CountAsync() > 0) ? throw Oops.Oh("您已提交,无需再次提交") : 1; + //var now = DateTime.Now; + //var model = new Entities.nbzc_person + //{ + // address = args.address, + // phone = args.phone, + // cardno = args.cardno, + // CreatedTime = DateTime.Now, + // date = args.date, + // hangye = args.hangye, + // IsDeleted = false, + // line = args.line, + // name = args.name, + // weixin_number = args.weixin_number + //}; + //model = await model.InsertOrUpdate(); + //lastSend.IsDeleted = true; + //await repSmsCode.UpdateIncludeAsync(lastSend, new string[] { nameof(lastSend.IsDeleted) }); + //var token = JWTEncryption.Encrypt(new Dictionary() // 加密 + //{ + // { "UserId", model.Id }, + // { "Account",model.phone } + //}); + //return new { success = true, token }; + return 1; } + } } diff --git a/20220330_Vote/Vote.Services/Dto/OutsideWallInput.cs b/20220330_Vote/Vote.Services/Dto/OutsideWallInput.cs new file mode 100644 index 0000000..069361e --- /dev/null +++ b/20220330_Vote/Vote.Services/Dto/OutsideWallInput.cs @@ -0,0 +1,96 @@ +using Furion.DatabaseAccessor; +using Mapster; +using Microsoft.AspNetCore.Http; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Vote.Services.Entities; + +namespace Vote.Services.Dto +{ + public class aaaaa + { + public string appid { get; set; } + public OutsideWallInput wall { get; set; } + public FormFileCollection file { get; set; } + } + /// + /// + /// + public class OutsideWallInput + { + public string communityId { get; set; } + /// + /// + /// + public string communityName { get; set; } + public string deliveryear { get; set; } + public List fileList { get; set; } + public decimal buildcount { get; set; } + public decimal householdcount { get; set; } + public decimal totalfloorage { get; set; } + public int isExistProblem { get; set; } + public int problemismodify { get; set; } + public string problemmodifyunitname { get; set; } + public string problemmodifyisagain { get; set; } + public string contract { get; set; } + public List buildings { get; set; } + } + public class SanjuCommunity + { + public string Name { get; set; } + public string ID { get; set; } + public string Code { get; set; } + } + public class SanjuBuilding + { + public string ID { get; set; } + public string AreaName { get; set; } + public string RoadName { get; set; } + public string CompletedDate { get; set; } + public string BuildingName { get; set; } + public string Address { get; set; } + public int LevelCount { get; set; } + public int HouseHolds { get; set; } + public string BuildingUnit { get; set; } + public string DesingerUnit { get; set; } + public string ConstructionUnit { get; set; } + public string MonitorUnit { get; set; } + public string WuYeUnit { get; set; } + public decimal AreaCount { get; set; } + public List curwallproblems { get; set; } = new List(); + public string curwallproblemother { get; set; } + public string wallproblemsfirst { get; set; } + public string firstproblemdate { get; set; } + public string problemfrequency { get; set; } + public List problemseason { get; set; } = new List(); + public List wallproblemtoward { get; set; } = new List(); + public List problemfiles { get; set; } = new List(); + //public List problemfiles2 { get; set; } + //public List problemfiles3 { get; set; } + //public List problemfiles4 { get; set; } + public string problemfanwei { get; set; } + public List problemheight { get; set; } = new List(); + public List diaoluowu { get; set; } = new List(); + } + public class ProblemToward + { + public string Toward { get; set; } + public string file { get; set; } + } + public class Mapper : IRegister + { + public void Register(TypeAdapterConfig config) + { + config.ForType() + .Map(dest => dest.curwallproblems, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.curwallproblems)) + .Map(dest => dest.problemseason, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.problemseason)) + .Map(dest => dest.wallproblemtoward, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.wallproblemtoward)) + //.Map(dest => dest.problemfiles, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.problemfiles)) + .Map(dest => dest.problemheight, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.problemheight)) + .Map(dest => dest.diaoluowu, src => Newtonsoft.Json.JsonConvert.SerializeObject(src.diaoluowu)); + } + } +} diff --git a/20220330_Vote/Vote.Services/Entities/outside_wall.cs b/20220330_Vote/Vote.Services/Entities/outside_wall.cs new file mode 100644 index 0000000..4d10568 --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/outside_wall.cs @@ -0,0 +1,106 @@ +using Furion.DatabaseAccessor; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace Vote.Services.Entities +{ + /// + /// + /// + [Serializable] + public class outside_wall + { + /// + /// Id主键 + /// + [DisplayName("Id主键")] + [SugarColumn(IsPrimaryKey = true)] + public string Id { get; set; } + + /// + /// 社区id,关联三居系统社区id + /// + [DisplayName("社区id,关联三居系统社区id")] + public string communityId { get; set; } + + /// + /// 社区/小区名称 + /// + [DisplayName("社区/小区名称")] + public string communityName { get; set; } + + /// + /// 交付年份 + /// + [DisplayName("交付年份")] + public string deliveryear { get; set; } + + /// + /// 楼栋数 + /// + [DisplayName("楼栋数")] + public decimal buildcount { get; set; } + + /// + /// 住户总数 + /// + [DisplayName("住户总数")] + public decimal? householdcount { get; set; } + + /// + /// 总建筑面积 + /// + [DisplayName("总建筑面积")] + public decimal? totalfloorage { get; set; } + + /// + /// 是否存在外墙问题 + /// + [DisplayName("是否存在外墙问题")] + public int? isExistProblem { get; set; } + + /// + /// 问题发生后是否请人修复了 + /// + [DisplayName("问题发生后是否请人修复了")] + public int? problemismodify { get; set; } + + /// + /// 请提供修复单位的名称 + /// + [DisplayName("请提供修复单位的名称")] + public string problemmodifyunitname { get; set; } + + /// + /// 修复后的部位是否再次发生问题 + /// + [DisplayName("修复后的部位是否再次发生问题")] + public int? problemmodifyisagain { get; set; } + + /// + /// 联系方式 + /// + [DisplayName("联系方式")] + public string contract { get; set; } + + /// + /// createtime + /// + [DisplayName("createtime")] + public DateTime? createtime { get; set; } + + /// + /// isdeleted + /// + [DisplayName("isdeleted")] + public int? isdeleted { get; set; } + [SugarColumn(IsIgnore = true)] + public List outside_wall_photos { get; set; } + [SugarColumn(IsIgnore = true)] + public List outside_wall_buildings { get; set; } + + } +} diff --git a/20220330_Vote/Vote.Services/Entities/outside_wall_building.cs b/20220330_Vote/Vote.Services/Entities/outside_wall_building.cs new file mode 100644 index 0000000..a33b3d7 --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/outside_wall_building.cs @@ -0,0 +1,159 @@ +using Furion.DatabaseAccessor; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Vote.Services.Entities +{ + /// + /// + /// + [Serializable] + public class outside_wall_building + { + /// + /// Id主键 + /// + [DisplayName("Id主键")] + [SugarColumn(IsPrimaryKey = true)] + public string Id { get; set; } + + /// + /// 外墙id + /// + [DisplayName("外墙id")] + public string outsidewallId { get; set; } + + /// + /// 幢Id 关联三居幢id + /// + [DisplayName("幢Id 关联三居幢id")] + public string BuildingId { get; set; } + + /// + /// 幢名称 + /// + [DisplayName("幢名称")] + public string BuildingName { get; set; } + + /// + /// 地址 + /// + [DisplayName("地址")] + public string Address { get; set; } + + /// + /// 层数 + /// + [DisplayName("层数")] + public int? LevelCount { get; set; } + + /// + /// 总户数 + /// + [DisplayName("总户数")] + public int? Households { get; set; } + + /// + /// 建设单位 + /// + [DisplayName("建设单位")] + public string BuildingUnit { get; set; } + + /// + /// 设计单位 + /// + [DisplayName("设计单位")] + public string DesingerUnit { get; set; } + + /// + /// 施工单位 + /// + [DisplayName("施工单位")] + public string ConstructionUnit { get; set; } + + /// + /// 监理单位 + /// + [DisplayName("监理单位")] + public string MonitorUnit { get; set; } + + /// + /// 物业单位 + /// + [DisplayName("物业单位")] + public string WuYeUnit { get; set; } + + /// + /// 墙体问题的类型是 + /// + [DisplayName("墙体问题的类型是")] + public string curwallproblems { get; set; } + /// + /// 墙体问题的类型-其他 + /// + [DisplayName("墙体问题的类型-其他")] + public string curwallproblemother { get; set; } + /// + /// 哪个问题最先开始出现 + /// + [DisplayName("哪个问题最先开始出现")] + public string wallproblemsfirst { get; set; } + + /// + /// 第一次出现墙体问题是建成后____年 + /// + [DisplayName("第一次出现墙体问题是建成后____年")] + public string firstproblemdate { get; set; } + + /// + /// 墙体脱落发生频率如何 + /// + [DisplayName("墙体脱落发生频率如何")] + public string problemfrequency { get; set; } + + /// + /// 问题多发生在哪个季节 + /// + [DisplayName("问题多发生在哪个季节")] + public string problemseason { get; set; } + + /// + /// 墙体问题发生的朝向是哪面 + /// + [DisplayName("墙体问题发生的朝向是哪面")] + public string wallproblemtoward { get; set; } + + /// + /// 发生外墙问题的范围有多大 + /// + [DisplayName("发生外墙问题的范围有多大")] + public string problemfanwei { get; set; } + + /// + /// 外墙问题发生在哪个高度 + /// + [DisplayName("外墙问题发生在哪个高度")] + public string problemheight { get; set; } + + /// + /// 掉落物是什么 + /// + [DisplayName("掉落物是什么")] + public string diaoluowu { get; set; } + + /// + /// createtime + /// + [DisplayName("createtime")] + public DateTime? createtime { get; set; } + [SugarColumn(IsIgnore = true)] + public List outside_wall_building_photos { get; set; } + + } +} diff --git a/20220330_Vote/Vote.Services/Entities/outside_wall_building_photo.cs b/20220330_Vote/Vote.Services/Entities/outside_wall_building_photo.cs new file mode 100644 index 0000000..e0bc5a2 --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/outside_wall_building_photo.cs @@ -0,0 +1,43 @@ +using Ewide.Core; +using Furion.DatabaseAccessor; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Vote.Services.Entities +{ + /// + /// + /// + [Serializable] + public class outside_wall_building_photo + { + /// + /// 朝向 + /// + [DisplayName("朝向")] + public string toward { get; set; } + + /// + /// outsidewallBuildingId + /// + [DisplayName("outsidewallBuildingId")] + [SugarColumn(IsPrimaryKey = true)] + public string outsidewallBuildingId { get; set; } + + /// + /// sysfileid + /// + [DisplayName("sysfileid")] + [SugarColumn(IsPrimaryKey = true)] + public string sysfileid { get; set; } + } + +} diff --git a/20220330_Vote/Vote.Services/Entities/outside_wall_photo.cs b/20220330_Vote/Vote.Services/Entities/outside_wall_photo.cs new file mode 100644 index 0000000..f5c4ed2 --- /dev/null +++ b/20220330_Vote/Vote.Services/Entities/outside_wall_photo.cs @@ -0,0 +1,36 @@ +using Furion.DatabaseAccessor; +using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Vote.Services.Entities +{ + /// + /// + /// + [Serializable] + public class outside_wall_photo + { + /// + /// outsidewallId + /// + [DisplayName("outsidewallId")] + [SugarColumn(IsPrimaryKey = true)] + public string outsidewallId { get; set; } + + /// + /// sysfileid + /// + [DisplayName("sysfileid")] + [SugarColumn(IsPrimaryKey = true)] + public string sysfileid { get; set; } + + } +} diff --git a/20220330_Vote/Vote.Services/Vote.Services.xml b/20220330_Vote/Vote.Services/Vote.Services.xml index ef9c10d..acd53e8 100644 --- a/20220330_Vote/Vote.Services/Vote.Services.xml +++ b/20220330_Vote/Vote.Services/Vote.Services.xml @@ -98,6 +98,80 @@ + + + 外墙调查问卷 + + + + + + + + + + + + + + + 获取三居系统中的社区 + + + + + + 获取三居系统中的社区 + + + + + + 获取三居系统中的社区 + + + + + + 获取时间戳 + + + + + + 上传文件 + + + + + + + 删除文件 + + + + + + + 预览文件 + + + + + + + 上传文件 + + + + + + + + 提交 + + + 项目 @@ -315,6 +389,16 @@ 希望上传到的目录和文件名 , 如果为空则上传到根目录 ,大小写敏感! ,斜杠必须使用/ , eg: files/COC/202011/11/2020KDFJ0075.pdf + + + + + + + + + + 项目类型 @@ -520,6 +604,236 @@ 过期时间 + + + + + + + + Id主键 + + + + + 社区id,关联三居系统社区id + + + + + 社区/小区名称 + + + + + 交付年份 + + + + + 楼栋数 + + + + + 住户总数 + + + + + 总建筑面积 + + + + + 是否存在外墙问题 + + + + + 问题发生后是否请人修复了 + + + + + 请提供修复单位的名称 + + + + + 修复后的部位是否再次发生问题 + + + + + 联系方式 + + + + + createtime + + + + + isdeleted + + + + + + + + + + Id主键 + + + + + 外墙id + + + + + 幢Id 关联三居幢id + + + + + 幢名称 + + + + + 地址 + + + + + 层数 + + + + + 总户数 + + + + + 建设单位 + + + + + 设计单位 + + + + + 施工单位 + + + + + 监理单位 + + + + + 物业单位 + + + + + 墙体问题的类型是 + + + + + 墙体问题的类型-其他 + + + + + 哪个问题最先开始出现 + + + + + 第一次出现墙体问题是建成后____年 + + + + + 墙体脱落发生频率如何 + + + + + 问题多发生在哪个季节 + + + + + 墙体问题发生的朝向是哪面 + + + + + 发生外墙问题的范围有多大 + + + + + 外墙问题发生在哪个高度 + + + + + 掉落物是什么 + + + + + createtime + + + + + + + + + + 朝向 + + + + + outsidewallBuildingId + + + + + sysfileid + + + + + + + + + + outsidewallId + + + + + sysfileid + + 项目表