init commit
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
using Ewide.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "巡查日期不能为空")]
|
||||
public DateTime PatrolDate { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "巡查人员/单位不能为空")]
|
||||
public string PatrolUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜
|
||||
/// </summary>
|
||||
public string SettlementTilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜附件
|
||||
/// </summary>
|
||||
public string SettlementTiltFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况
|
||||
/// </summary>
|
||||
public string OtherInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况附件
|
||||
/// </summary>
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
//[Required(ErrorMessage = "巡查初始等级不能为空")]
|
||||
public int InitGrade { get; set; }
|
||||
//[Required(ErrorMessage = "巡查损坏等级不能为空")]
|
||||
public int DamageGrade { get; set; }
|
||||
//[Required(ErrorMessage = "巡查综合等级不能为空")]
|
||||
public int ComprehensiveGrade { get; set; }
|
||||
#region 调查情况investigation
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
public string OtherContents { get; set; }
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 主要安全隐患综述
|
||||
/// </summary>
|
||||
public string MainSafety { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见
|
||||
/// </summary>
|
||||
public int? HandlingOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见备注
|
||||
/// </summary>
|
||||
public string HandlingOpinionRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况
|
||||
/// </summary>
|
||||
public int? RectifyAndReform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况备注
|
||||
/// </summary>
|
||||
public string RectifyAndReformRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
//[Required(ErrorMessage = "巡查结果不能为空")]
|
||||
public int PatrolResult { get; set; }
|
||||
|
||||
public string PatrolResultRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道
|
||||
/// </summary>
|
||||
public int? ReportRoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道时间
|
||||
/// </summary>
|
||||
public DateTime? ReportRoadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建
|
||||
/// </summary>
|
||||
public int? ReportArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建时间
|
||||
/// </summary>
|
||||
public DateTime? ReportAreaTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报备注
|
||||
/// </summary>
|
||||
public string ReportRemark { get; set; }
|
||||
}
|
||||
|
||||
public class AddHouseTaskInput : HouseTaskInput
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class EditHouseTaskInput : HouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "任务Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class SubmitHouseTaskInput
|
||||
{
|
||||
[Required(ErrorMessage = "任务Id不能为空")]
|
||||
public string TaskId { get; set; }
|
||||
}
|
||||
|
||||
public class QueryHouseTaskInput : PageInputBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application
|
||||
{
|
||||
public class HouseTaskOutput
|
||||
{
|
||||
public DateTime? PatrolDate { get; set; }
|
||||
public string PatrolUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜
|
||||
/// </summary>
|
||||
public string SettlementTilt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 沉降倾斜附件
|
||||
/// </summary>
|
||||
public string SettlementTiltFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况
|
||||
/// </summary>
|
||||
public string OtherInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他情况附件
|
||||
/// </summary>
|
||||
public string OtherInfoFiles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 初始等级
|
||||
/// </summary>
|
||||
public int? InitGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 损坏等级
|
||||
/// </summary>
|
||||
public int? DamageGrade { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 综合等级
|
||||
/// </summary>
|
||||
public int? ComprehensiveGrade { get; set; }
|
||||
|
||||
#region 调查情况investigation
|
||||
/// <summary>
|
||||
/// 房屋场地
|
||||
/// </summary>
|
||||
public string HouseSite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 相邻施工
|
||||
/// </summary>
|
||||
public string AdjacentConstruction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 化学侵蚀
|
||||
/// </summary>
|
||||
public string ChemicalErosion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结构拆改
|
||||
/// </summary>
|
||||
public int? StructuralDismantling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 加层改造
|
||||
/// </summary>
|
||||
public int? AddingLayer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修缮加固
|
||||
/// </summary>
|
||||
public string RepairAndReinforce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 历史灾害
|
||||
/// </summary>
|
||||
public string HistoricalCalamity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用功能变更
|
||||
/// </summary>
|
||||
public string FunctionalChange { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 其他调查内容
|
||||
/// </summary>
|
||||
public string OtherContents { get; set; }
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 主要安全隐患综述
|
||||
/// </summary>
|
||||
public string MainSafety { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见
|
||||
/// </summary>
|
||||
public int? HandlingOpinion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 处理意见备注
|
||||
/// </summary>
|
||||
public string HandlingOpinionRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况
|
||||
/// </summary>
|
||||
public int? RectifyAndReform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 整改情况备注
|
||||
/// </summary>
|
||||
public string RectifyAndReformRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查结果:1正常,-1异常
|
||||
/// </summary>
|
||||
public int? PatrolResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 巡查异常描述
|
||||
/// </summary>
|
||||
public string PatrolResultRemark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道
|
||||
/// </summary>
|
||||
public int? ReportRoad { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报街道时间
|
||||
/// </summary>
|
||||
public DateTime? ReportRoadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建
|
||||
/// </summary>
|
||||
public int? ReportArea { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报区住建时间
|
||||
/// </summary>
|
||||
public DateTime? ReportAreaTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上报备注
|
||||
/// </summary>
|
||||
public string ReportRemark { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 提交时间
|
||||
/// </summary>
|
||||
public DateTime? SubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后提交时间
|
||||
/// </summary>
|
||||
public DateTime? LastSubmitTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
public bool IsEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using Dapper;
|
||||
using Ewide.Core;
|
||||
using Ewide.Core.Extension;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 房屋任务(巡查任务/建档任务)
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseTask", Order = 190)]
|
||||
public class HouseTaskService : IHouseTaskService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IRepository<BsHouseTask> _houseTaskRep;
|
||||
private readonly IRepository<BsHouseInfo> _houseInfoRep;
|
||||
private readonly IDapperRepository _dapperRepository;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
private readonly IHouseLogService _houseLogService;
|
||||
|
||||
public HouseTaskService(IRepository<BsHouseTask> HouseTaskRep, IRepository<BsHouseInfo> HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService)
|
||||
{
|
||||
_houseTaskRep = HouseTaskRep;
|
||||
_houseInfoRep = HouseInfoRep;
|
||||
_dapperRepository = dapperRepository;
|
||||
_userManager = userManager;
|
||||
|
||||
_houseLogService = houseLogService;
|
||||
}
|
||||
|
||||
[HttpPost("/houseTask/page")]
|
||||
public async Task<dynamic> QueryPage([FromBody] QueryHouseTaskInput input)
|
||||
{
|
||||
var sql = @"SELECT T.Id,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,Proj.Name,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,HC.HouseCode,HC.Address,T.EndTime,HC.Type,HC.Industry,HC.No,T.Status,IFNULL(HI.State,0) State FROM `bs_house_task` T
|
||||
LEFT JOIN bs_house_code HC ON T.HouseCodeId = HC.Id
|
||||
LEFT JOIN bs_house_info HI ON HI.HouseCodeId = T.HouseCodeId
|
||||
LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId
|
||||
LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode
|
||||
LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9)
|
||||
LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6)
|
||||
WHERE T.IsEnabled = 1 {0}";
|
||||
var user = await _userManager.CheckUserAsync();
|
||||
if (user == null) throw Oops.Oh("登录信息丢失");
|
||||
|
||||
var userRoles = await _userManager.GetUserRoleList();
|
||||
var userOrg = await _userManager.GetUserOrgInfo();
|
||||
var param = new DynamicParameters();
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Any())
|
||||
{
|
||||
sql = String.Format(sql, " AND T.UserID=@UserID ");
|
||||
param.Add("UserID", user.Id);
|
||||
}
|
||||
|
||||
if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Any())
|
||||
{
|
||||
sql = String.Format(sql, " AND (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId ");
|
||||
param.Add("ZoneId", userOrg.Id);
|
||||
}
|
||||
|
||||
return await _dapperRepository.QueryPageDataDynamic(sql, input, param, filterFields: new string[] { "Type", "Address", "HouseCode", "Status","State" });
|
||||
}
|
||||
|
||||
[HttpPost("/houseTask/submit")]
|
||||
[UnitOfWork]
|
||||
[AllowAnonymous]
|
||||
public async Task Submit([FromBody] SubmitHouseTaskInput input)
|
||||
{
|
||||
//获取任务实体
|
||||
var houseTask = await _houseTaskRep.DetachedEntities.FirstOrDefaultAsync(t => t.Id == input.TaskId);
|
||||
if (houseTask == null) throw Oops.Oh("任务不存在");
|
||||
houseTask.Status = 2;
|
||||
houseTask.LastSubmitTime = DateTime.Now;
|
||||
if (!houseTask.SubmitTime.HasValue) houseTask.SubmitTime = houseTask.LastSubmitTime;
|
||||
await houseTask.UpdateExcludeAsync(new string[] { nameof(BsHouseTask.TaskType) }, ignoreNullValues: true);
|
||||
|
||||
if(houseTask.TaskType == 0)
|
||||
{
|
||||
var houseInfo = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == houseTask.HouseCodeId);
|
||||
if (houseInfo == null) throw Oops.Oh("提交审核失败:请先保存后再提交");
|
||||
|
||||
houseInfo.State = 5;
|
||||
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
|
||||
}
|
||||
|
||||
// 提交时流转日志
|
||||
await _houseLogService.Done(houseTask.HouseCodeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
public interface IHouseTaskService
|
||||
{
|
||||
Task<dynamic> QueryPage(QueryHouseTaskInput input);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user