update
任务表新增字段 IsEnbaled 是否有效 提交审核、审核新增房屋流转日志步骤 选房逻辑调整
This commit is contained in:
@@ -19,7 +19,7 @@ namespace Ewide.Application
|
||||
public string CommName { get; set; }
|
||||
public string ZoneName { get; set; }
|
||||
public string ProjectNote { get; set; }
|
||||
public string ProjectFullName { get; set; }
|
||||
public string FullProjName { get; set; }
|
||||
public string HouseCode { get; set; }
|
||||
public int No { get; set; }
|
||||
public string Lng { get; set; }
|
||||
|
||||
@@ -50,11 +50,7 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
[AllowAnonymous]
|
||||
public async Task Save([FromBody] HouseInfoInputSave input)
|
||||
{
|
||||
//根据任务审核记录判断是否是审核操作,从而确定 DataStatus
|
||||
//审核操作,则为 input.TaskCheckRecord.PassOrBackDataStatus
|
||||
//非审核操作,则为 DataStatus.Saved
|
||||
var isCheckAction = input.TaskCheckRecord != null;
|
||||
await InputDataProcess(input, isCheckAction ? input.TaskCheckRecord.PassOrBackDataStatus : DataStatus.Saved);
|
||||
await InputDataProcess(input, DataStatus.Saved);
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/submitToCheck")]
|
||||
@@ -65,6 +61,13 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo
|
||||
await InputDataProcess(input,DataStatus.Submited);
|
||||
}
|
||||
|
||||
[HttpPost("/houseInfo/check")]
|
||||
[UnitOfWork]
|
||||
public async Task Check([FromBody] HouseInfoInputSave input)
|
||||
{
|
||||
await InputDataProcess(input, input.TaskCheckRecord.PassOrBackDataStatus );
|
||||
}
|
||||
|
||||
[HttpGet("/houseInfo/getByTaskId")]
|
||||
[UnitOfWork]
|
||||
public async Task<HouseInfoOutputForDetailPage> GetByTaskId([Required] string taskId)
|
||||
@@ -158,12 +161,31 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId }
|
||||
await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true);
|
||||
}
|
||||
|
||||
|
||||
if(dataStatus == DataStatus.Submited)
|
||||
{
|
||||
await _houseLogService.Done(input.houseCode.Id);
|
||||
|
||||
var org = await _userManager.GetUserOrgInfo();
|
||||
|
||||
var _sysUserRep = Db.GetRepository<SysUser>();
|
||||
var _sysEmpRep = Db.GetRepository<SysEmp>();
|
||||
var _sysUserRoleRep = Db.GetRepository<SysUserRole>();
|
||||
var _sysRoleRep = Db.GetRepository<SysRole>();
|
||||
var zoneManagerList = await (from u in _sysUserRep.DetachedEntities
|
||||
join e in _sysEmpRep.DetachedEntities on u.Id equals e.Id
|
||||
join ur in _sysUserRoleRep.DetachedEntities on u.Id equals ur.SysUserId
|
||||
join r in _sysRoleRep.DetachedEntities on ur.SysRoleId equals r.Id
|
||||
where e.OrgId == org.Id && r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()
|
||||
select u).ToListAsync();
|
||||
|
||||
await _houseLogService.AddThenDone(input.houseCode.Id, zoneManagerList, HouseLogType.Check);
|
||||
}
|
||||
//审核操作则新增一条审核记录
|
||||
if (dataStatus == DataStatus.Back || dataStatus == DataStatus.Passed)
|
||||
{
|
||||
var checkRecord = input.TaskCheckRecord.Adapt<BsHouseTaskCheckRecord>();
|
||||
await checkRecord.InsertAsync();
|
||||
await _houseLogService.AddThenDone(input.houseCode.Id, _userManager.User, dataStatus == DataStatus.Passed ? HouseLogType.Agree : HouseLogType.Disagree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,10 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Application.Service
|
||||
{
|
||||
[ApiDescriptionSettings(Name = "HouseLog", Order = 180)]
|
||||
/// <summary>
|
||||
/// 房屋流转日志
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "HouseLog", Order = 210)]
|
||||
public class HouseLogService : IHouseLogService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly IDapperRepository _dapperRep;
|
||||
@@ -27,12 +30,14 @@ namespace Ewide.Application.Service
|
||||
_bsHouseLogRep = bsHouseLogRep;
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Add(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await Add(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Add(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
@@ -46,6 +51,7 @@ namespace Ewide.Application.Service
|
||||
}.InsertAsync();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Read(string houseCodeId)
|
||||
{
|
||||
@@ -60,6 +66,7 @@ namespace Ewide.Application.Service
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task Done(string houseCodeId)
|
||||
{
|
||||
@@ -74,12 +81,14 @@ namespace Ewide.Application.Service
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await AddThenRead(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenRead(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
@@ -93,12 +102,14 @@ namespace Ewide.Application.Service
|
||||
}.InsertAsync();
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type)
|
||||
{
|
||||
await AddThenDone(houseCodeId, new List<SysUser> { targetUser }, type);
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
[UnitOfWork]
|
||||
public async Task AddThenDone(string houseCodeId, List<SysUser> targetUsers, HouseLogType type)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using Furion.DatabaseAccessor.Extensions;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DynamicApiController;
|
||||
using Furion.FriendlyException;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
@@ -154,14 +155,8 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM
|
||||
// 选定房屋
|
||||
house.ForEach(async p =>
|
||||
{
|
||||
new BsHouseMemberRelation
|
||||
{
|
||||
SysUserId = selectedUser.Id,
|
||||
HouseCodeId = p
|
||||
}.Insert();
|
||||
|
||||
var initTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t =>t.HouseCodeId == p && t.TaskType == 0);
|
||||
if (initTask == null)
|
||||
var originalTask = _bsHouseTaskRep.DetachedEntities.FirstOrDefault(t =>t.HouseCodeId == p && t.TaskType == 0);
|
||||
if (originalTask == null)
|
||||
{
|
||||
new BsHouseTask
|
||||
{
|
||||
@@ -174,16 +169,36 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM
|
||||
}.Insert();
|
||||
|
||||
await _houseLogService.Done(p);
|
||||
await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
initTask.UserID = input.UserId;
|
||||
initTask.Update();
|
||||
|
||||
await _houseLogService.AddThenDone(p, _userManager.User, HouseLogType.SelectMember);
|
||||
if (originalTask.Status != 6)//建档未完成,生成新建档任务分配给新的人员;原建档任务数据保留,有效性设置为false,取消巡查关系
|
||||
{
|
||||
var newTask = originalTask.Adapt<BsHouseTask>();
|
||||
newTask.Id = System.Guid.NewGuid().ToString();
|
||||
newTask.UserID = input.UserId;
|
||||
newTask.EndTime = System.DateTime.Now.AddMonths(1);
|
||||
newTask.Insert();
|
||||
|
||||
originalTask.IsEnabled = false;
|
||||
originalTask.Update();
|
||||
|
||||
await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
|
||||
}//已建档完成,不再分配建档任务,仅更换巡查关系
|
||||
else
|
||||
{
|
||||
var originalRelation = _bsHouseMemberRelationRep.DetachedEntities.FirstOrDefault(r => r.HouseCodeId == p && r.SysUserId == originalTask.UserID);
|
||||
originalRelation.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo);
|
||||
new BsHouseMemberRelation
|
||||
{
|
||||
SysUserId = selectedUser.Id,
|
||||
HouseCodeId = p
|
||||
}.Insert();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -154,5 +154,20 @@ namespace Ewide.Application
|
||||
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; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user