From 59fb976434b41bdc29fe4976d9248ba2b372df4a Mon Sep 17 00:00:00 2001
From: ky_yusj <2655568377@qq.com>
Date: Wed, 7 Jul 2021 17:30:25 +0800
Subject: [PATCH] =?UTF-8?q?update=20=E4=BB=BB=E5=8A=A1=E8=A1=A8=E6=96=B0?=
=?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5=20IsEnbaled=20=20=E6=98=AF=E5=90=A6?=
=?UTF-8?q?=E6=9C=89=E6=95=88=20=E6=8F=90=E4=BA=A4=E5=AE=A1=E6=A0=B8?=
=?UTF-8?q?=E3=80=81=E5=AE=A1=E6=A0=B8=E6=96=B0=E5=A2=9E=E6=88=BF=E5=B1=8B?=
=?UTF-8?q?=E6=B5=81=E8=BD=AC=E6=97=A5=E5=BF=97=E6=AD=A5=E9=AA=A4=20?=
=?UTF-8?q?=E9=80=89=E6=88=BF=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Api/Ewide.Application/Entity/BsHouseTask.cs | 5 ++
Api/Ewide.Application/Enum/HouseLog.cs | 8 +-
Api/Ewide.Application/Ewide.Application.xml | 5 ++
.../HouseCode/Dto/HouseCodeOutput.cs | 2 +-
.../HouseSafety/HouseInfo/HouseInfoService.cs | 34 +++++++--
.../HouseSafety/HouseLog/HouseLogService.cs | 13 +++-
.../HouseSelector/HouseSelectorService.cs | 39 +++++++---
.../HouseTask/Dto/HouseTaskOutput.cs | 15 ++++
.../business/houseSafety/houseInfo.js | 1 +
.../pages/business/house/info/form/index.jsx | 76 ++++++++++---------
.../pages/business/house/task/check/index.jsx | 2 +-
11 files changed, 140 insertions(+), 60 deletions(-)
diff --git a/Api/Ewide.Application/Entity/BsHouseTask.cs b/Api/Ewide.Application/Entity/BsHouseTask.cs
index ba20803..e0ecb1e 100644
--- a/Api/Ewide.Application/Entity/BsHouseTask.cs
+++ b/Api/Ewide.Application/Entity/BsHouseTask.cs
@@ -257,5 +257,10 @@ namespace Ewide.Application
[Comment("最后提交时间")]
public DateTime? LastSubmitTime { get; set; }
+ ///
+ /// 是否有效
+ ///
+ [Comment("是否有效")]
+ public bool IsEnabled { get; set; }
}
}
diff --git a/Api/Ewide.Application/Enum/HouseLog.cs b/Api/Ewide.Application/Enum/HouseLog.cs
index 6906205..29d707f 100644
--- a/Api/Ewide.Application/Enum/HouseLog.cs
+++ b/Api/Ewide.Application/Enum/HouseLog.cs
@@ -18,11 +18,15 @@ namespace Ewide.Application
[Description("房屋建档")]
CreateInfo = 3,
+ [Description("审核")]
+ Check = 4,
+
[Description("审核通过")]
- Agree = 4,
+ Agree = 5,
[Description("审核退回")]
- Disagree = 5
+ Disagree = 6
+
}
public enum HouseLogStatus
diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml
index fb7a3f4..0519e69 100644
--- a/Api/Ewide.Application/Ewide.Application.xml
+++ b/Api/Ewide.Application/Ewide.Application.xml
@@ -616,6 +616,11 @@
住宅查询
+
+
+ 房屋流转日志
+
+
分页查询用户
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
index de2cda4..bb691f8 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseCode/Dto/HouseCodeOutput.cs
@@ -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; }
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
index 9c92135..2a42a56 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs
@@ -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 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();
+ var _sysEmpRep = Db.GetRepository();
+ var _sysUserRoleRep = Db.GetRepository();
+ var _sysRoleRep = Db.GetRepository();
+ 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();
await checkRecord.InsertAsync();
+ await _houseLogService.AddThenDone(input.houseCode.Id, _userManager.User, dataStatus == DataStatus.Passed ? HouseLogType.Agree : HouseLogType.Disagree);
}
}
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs
index 22dd992..a64796e 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs
@@ -14,7 +14,10 @@ using System.Threading.Tasks;
namespace Ewide.Application.Service
{
- [ApiDescriptionSettings(Name = "HouseLog", Order = 180)]
+ ///
+ /// 房屋流转日志
+ ///
+ [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 { targetUser }, type);
}
+ [NonAction]
[UnitOfWork]
public async Task Add(string houseCodeId, List 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 { targetUser }, type);
}
+ [NonAction]
[UnitOfWork]
public async Task AddThenRead(string houseCodeId, List 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 { targetUser }, type);
}
+ [NonAction]
[UnitOfWork]
public async Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type)
{
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs
index 1207282..1da270b 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs
@@ -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();
+ 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();
});
}
diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
index d824a23..b5f1df0 100644
--- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
+++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/Dto/HouseTaskOutput.cs
@@ -154,5 +154,20 @@ namespace Ewide.Application
public string ReportRemark { get; set; }
public int Status { get; set; }
+
+ ///
+ /// 提交时间
+ ///
+ public DateTime? SubmitTime { get; set; }
+
+ ///
+ /// 最后提交时间
+ ///
+ public DateTime? LastSubmitTime { get; set; }
+
+ ///
+ /// 是否有效
+ ///
+ public bool IsEnabled { get; set; }
}
}
diff --git a/web-react/src/common/api/requests/business/houseSafety/houseInfo.js b/web-react/src/common/api/requests/business/houseSafety/houseInfo.js
index 0177ae8..8e51acd 100644
--- a/web-react/src/common/api/requests/business/houseSafety/houseInfo.js
+++ b/web-react/src/common/api/requests/business/houseSafety/houseInfo.js
@@ -1,6 +1,7 @@
const urls = {
houseInfoGetByTaskId: ['/houseInfo/getByTaskId', 'get'],
houseInfoSave: ['houseInfo/save', 'post'],
+ houseInfoCheck: ['houseInfo/check', 'post'],
houseInfoSubmitToCheck: ['/houseInfo/submitToCheck', 'post']
}
diff --git a/web-react/src/pages/business/house/info/form/index.jsx b/web-react/src/pages/business/house/info/form/index.jsx
index bfae1a8..5670d97 100644
--- a/web-react/src/pages/business/house/info/form/index.jsx
+++ b/web-react/src/pages/business/house/info/form/index.jsx
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import { Form, Button, Input, Descriptions, message as Message, Modal, Spin, Tabs } from 'antd'
import { merge, isEqual, pickBy } from 'lodash'
-import { AntIcon, ComponentDynamic, Container } from 'components'
+import { AntIcon, ComponentDynamic, Container, Auth } from 'components'
import { api } from 'common/api'
const tabs = [
@@ -58,7 +58,7 @@ const actions = {
after: 'close',
},
check: {
- action: 'houseInfoSave',
+ action: 'houseInfoCheck',
remark: '审核',
after: 'close',
},
@@ -222,41 +222,43 @@ export default class index extends Component {
- {this.state.taskStatus == 3 && (
-
-
-
-
-
-
-
-
- )}
+
+
+
+
+
+
+
+ )}
+
{this.state.taskStatus >= -1 && this.state.taskStatus < 3 && (
@@ -302,7 +304,7 @@ export default class index extends Component {
`${record.houseCode.areaName}-${
record.houseCode.roadName
}-${record.houseCode.commName}-${
- record.houseCode.projectFullName
+ record.houseCode.fullProjName
}-${record.houseCode.no.toString().padStart(3, '0')}`}
diff --git a/web-react/src/pages/business/house/task/check/index.jsx b/web-react/src/pages/business/house/task/check/index.jsx
index aef209a..c68b440 100644
--- a/web-react/src/pages/business/house/task/check/index.jsx
+++ b/web-react/src/pages/business/house/task/check/index.jsx
@@ -56,7 +56,7 @@ export default class index extends Component {
render: (text, record) => (
<>
{`${record.areaName}-${record.roadName}-${record.commName}-${
- record.note
+ record.fullProjName
}-${record.no.toString().padStart(3, '0')}`}
{text}