From f9fa168331b678bc619dfe4fb78d986d67a995cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Tue, 6 Jul 2021 13:48:36 +0800 Subject: [PATCH 01/12] add weather --- web-react/src/util/global/index.js | 5 ++ .../src/views/main/_layout/header/index.jsx | 2 + .../src/views/main/_layout/header/weather.jsx | 51 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 web-react/src/views/main/_layout/header/weather.jsx diff --git a/web-react/src/util/global/index.js b/web-react/src/util/global/index.js index 374ca42..2584c5e 100644 --- a/web-react/src/util/global/index.js +++ b/web-react/src/util/global/index.js @@ -38,6 +38,11 @@ export const RSA_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQU */ export const CITY = '黄石市' +/** + * + */ +export const AMAP_WEBAPI_KEY = 'ca01719fe09757131a1249c273619a17' + /** * 响应式响应宽度 */ diff --git a/web-react/src/views/main/_layout/header/index.jsx b/web-react/src/views/main/_layout/header/index.jsx index 0cdf6c8..b3f6dea 100644 --- a/web-react/src/views/main/_layout/header/index.jsx +++ b/web-react/src/views/main/_layout/header/index.jsx @@ -6,6 +6,7 @@ import { api } from 'common/api' import Logo from '../logo' import Search from './search' +import Weather from './weather' import Notice from './notice' import User from './user' @@ -53,6 +54,7 @@ export default class index extends Component {
+ + + + {temperature}℃ + {weather} + + + ) + } +} From 78ac91bbdd2f7d17d1f9e089137f9d0789c235b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Tue, 6 Jul 2021 14:01:35 +0800 Subject: [PATCH 02/12] =?UTF-8?q?fix=20=E5=A4=B4=E9=83=A8=E6=96=87?= =?UTF-8?q?=E5=AD=97=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-react/src/assets/style/dark/main.less | 5 +++++ web-react/src/assets/style/default/main.less | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/web-react/src/assets/style/dark/main.less b/web-react/src/assets/style/dark/main.less index d264d6b..6e9fb0b 100644 --- a/web-react/src/assets/style/dark/main.less +++ b/web-react/src/assets/style/dark/main.less @@ -547,10 +547,13 @@ line-height: @layout-header-height - 16px; height: @layout-header-height - 20px; + + color: fade(@black, 35%); .anticon { color: fade(@black, 35%); } &:hover { + color: @icon-color-hover; background-color: fade(@black, 5%); .anticon { color: @icon-color-hover; @@ -596,10 +599,12 @@ } .header-actions { .header-action { + color: fade(@white, 60%); .anticon { color: fade(@white, 60%); } &:hover { + color: @white; background-color: fade(@white, 20%); .anticon { color: @white; diff --git a/web-react/src/assets/style/default/main.less b/web-react/src/assets/style/default/main.less index 112f21b..f4b6848 100644 --- a/web-react/src/assets/style/default/main.less +++ b/web-react/src/assets/style/default/main.less @@ -541,10 +541,13 @@ line-height: @layout-header-height - 16px; height: @layout-header-height - 20px; + + color: fade(@black, 35%); .anticon { color: fade(@black, 35%); } &:hover { + color: @icon-color-hover; background-color: fade(@black, 5%); .anticon { color: @icon-color-hover; @@ -590,10 +593,12 @@ } .header-actions { .header-action { + color: fade(@white, 60%); .anticon { color: fade(@white, 60%); } &:hover { + color: @white; background-color: fade(@white, 20%); .anticon { color: @white; From 23e2b79cfe6d2b1a73928c6b40c41ffbeea38fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Tue, 6 Jul 2021 17:22:18 +0800 Subject: [PATCH 03/12] =?UTF-8?q?add=20=E6=B5=81=E8=BD=AC=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Application/Entity/BsHouseLog.cs | 29 +++++ Api/Ewide.Application/Enum/HouseLog.cs | 39 +++++++ .../HouseSafety/HouseCode/HouseCodeService.cs | 22 +++- .../HouseSafety/HouseInfo/HouseInfoService.cs | 18 ++- .../HouseSafety/HouseLog/HouseLogService.cs | 109 ++++++++++++++++++ .../HouseSafety/HouseLog/IHouseLogService.cs | 21 ++++ .../HouseMember/HouseMemberService.cs | 9 -- .../HouseSelector/HouseSelectorService.cs | 35 ++++-- .../HouseSafety/HouseTask/HouseTaskService.cs | 11 +- .../src/pages/business/house/code/index.jsx | 6 +- .../house/member/selector/selected-list.jsx | 6 +- .../house/member/selector/selector-list.jsx | 6 +- .../src/pages/business/house/task/index.jsx | 4 +- 13 files changed, 280 insertions(+), 35 deletions(-) create mode 100644 Api/Ewide.Application/Entity/BsHouseLog.cs create mode 100644 Api/Ewide.Application/Enum/HouseLog.cs create mode 100644 Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs create mode 100644 Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs diff --git a/Api/Ewide.Application/Entity/BsHouseLog.cs b/Api/Ewide.Application/Entity/BsHouseLog.cs new file mode 100644 index 0000000..594af95 --- /dev/null +++ b/Api/Ewide.Application/Entity/BsHouseLog.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Application +{ + [Table("bs_house_log")] + [Comment("房屋流转日志")] + public class BsHouseLog : Core.DEntityBase + { + [Comment("房屋编码Id")] + [MaxLength(36)] + public string HouseCodeId { get; set; } + + [Comment("目标处理人Id,可多个")] + public string TargetUserIds { get; set; } + + [Comment("步骤类型")] + public HouseLogType Type { get; set; } + + [Comment("状态")] + public HouseLogStatus Status { get; set; } + } +} diff --git a/Api/Ewide.Application/Enum/HouseLog.cs b/Api/Ewide.Application/Enum/HouseLog.cs new file mode 100644 index 0000000..6906205 --- /dev/null +++ b/Api/Ewide.Application/Enum/HouseLog.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Application +{ + public enum HouseLogType + { + [Description("创建房屋编码")] + CreateCode = 1, + + [Description("人员选房")] + SelectMember = 2, + + [Description("房屋建档")] + CreateInfo = 3, + + [Description("审核通过")] + Agree = 4, + + [Description("审核退回")] + Disagree = 5 + } + + public enum HouseLogStatus + { + [Description("待处理")] + Handle = 0, + + [Description("正在处理")] + Handling = 1, + + [Description("已处理")] + Handled = 2, + } +} diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs index ff662e9..fa32082 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseCode/HouseCodeService.cs @@ -13,6 +13,7 @@ using Dapper; using Ewide.Core.Extension; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Collections.Generic; namespace Ewide.Application.Service.HouseCode { @@ -25,13 +26,20 @@ namespace Ewide.Application.Service.HouseCode private readonly IRepository _houseCodeRep; private readonly IDapperRepository _dapperRepository; - public HouseCodeService(IRepository HouseCodeRep, IDapperRepository dapperRepository) + private readonly IUserManager _userManager; + private readonly IHouseLogService _houseLogService; + + public HouseCodeService(IRepository HouseCodeRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService) { _houseCodeRep = HouseCodeRep; _dapperRepository = dapperRepository; + + _userManager = userManager; + _houseLogService = houseLogService; } [HttpPost("/houseCode/add")] + [UnitOfWork] public async Task AddHouseCode(AddHouseCodeInput input) { var houseProjectInfoRep = Db.GetRepository(); @@ -42,10 +50,16 @@ namespace Ewide.Application.Service.HouseCode var areaCode = await areaCodeRep.DetachedEntities.FirstOrDefaultAsync(a => a.Code == input.AreaCode && a.LevelType == 4); if(areaCode == null) throw Oops.Oh("区域编码有误,添加失败"); input.HouseCode = areaCode.AdCode + houseProject.Sort.ToString().PadLeft(3, '0') + input.No.ToString().PadLeft(3, '0'); + var id = System.Guid.NewGuid().ToString().ToLower(); var houseCode = input.Adapt(); + houseCode.Id = id; var isExist = await _houseCodeRep.AnyAsync(p => p.HouseCode == houseCode.HouseCode); if (isExist) throw Oops.Oh("房屋编码已存在,不可重复添加"); - await _houseCodeRep.InsertAsync(houseCode); + await houseCode.InsertAsync(); + + // 添加到流转日志 + await _houseLogService.AddThenDone(id, _userManager.User, HouseLogType.CreateCode); + await _houseLogService.Add(id, _userManager.User, HouseLogType.SelectMember); } [HttpPost("/houseCode/edit")] @@ -65,7 +79,9 @@ namespace Ewide.Application.Service.HouseCode [HttpPost("/houseCode/page")] public async Task QueryPage([FromBody] QueryHouseCodeInput input) { - var sql = @"SELECT HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.Name,'(',Proj.Note,')') FullProjName FROM bs_house_code HC + var sql = @"SELECT +HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName +FROM bs_house_code HC 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) diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs index a162309..9c92135 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs @@ -31,14 +31,18 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo private readonly IUserManager _userManager; private readonly IDapperRepository _dapperRepository; + private readonly IHouseLogService _houseLogService; - public HouseInfoService(IRepository HouseCodeRep,IRepository HouseInfoRep, IRepository HouseTaskRep, IUserManager userManager, IDapperRepository dapperRepository) + + public HouseInfoService(IRepository HouseCodeRep,IRepository HouseInfoRep, IRepository HouseTaskRep, IUserManager userManager, IDapperRepository dapperRepository, IHouseLogService houseLogService) { _houseCodeRep = HouseCodeRep; _houseInfoRep = HouseInfoRep; _houseTaskRep = HouseTaskRep; _userManager = userManager; _dapperRepository = dapperRepository; + + _houseLogService = houseLogService; } [HttpPost("/houseInfo/save")] @@ -62,7 +66,7 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo } [HttpGet("/houseInfo/getByTaskId")] - [AllowAnonymous] + [UnitOfWork] public async Task GetByTaskId([Required] string taskId) { //获取任务实体 @@ -71,7 +75,9 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo //获取房屋编码信息 var houseCodeOutputAsync = await _dapperRepository.QueryAsync( - @"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No FROM bs_house_code HC + @"SELECT +HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName,HC.HouseCode,HC.Lng,HC.Lat,HC.No +FROM bs_house_code HC LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId LEFT JOIN sys_org O ON HC.ZoneId = O.Id LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode @@ -97,6 +103,12 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId } taskOutput.PatrolUser = String.IsNullOrEmpty(houseTask.PatrolUser) ? currentUser.Name : houseTask.PatrolUser; houseInfoOutputForDetailPage.PatrolInfo = taskOutput; + if (houseInfo == null || houseInfo.State <= (int)DataStatus.Submited) + { + // 未建档或者当前数据未提交时打开,标记为已读 + await _houseLogService.Read(houseCodeOutput.Id); + } + if (houseInfo == null) { houseInfoOutputForDetailPage.HouseInfo = new HouseInfoOutput(); diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs new file mode 100644 index 0000000..278fec9 --- /dev/null +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs @@ -0,0 +1,109 @@ +using Ewide.Core; +using Furion.DatabaseAccessor; +using Furion.DatabaseAccessor.Extensions; +using Furion.DependencyInjection; +using Furion.DynamicApiController; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Application.Service +{ + public class HouseLogService : IHouseLogService, ITransient + { + private readonly IRepository _bsHouseLogRep; + + public HouseLogService(IRepository bsHouseLogRep) + { + _bsHouseLogRep = bsHouseLogRep; + } + + [UnitOfWork] + public async Task Add(string houseCodeId, SysUser targetUser, HouseLogType type) + { + await Add(houseCodeId, new List { targetUser }, type); + } + + [UnitOfWork] + public async Task Add(string houseCodeId, List targetUsers, HouseLogType type) + { + await new BsHouseLog + { + Id = Guid.NewGuid().ToString(), + HouseCodeId = houseCodeId, + TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)), + Type = type, + Status = HouseLogStatus.Handle + }.InsertAsync(); + } + + [UnitOfWork] + public async Task Read(string houseCodeId) + { + var log = await _bsHouseLogRep + .Where(p => p.HouseCodeId.Equals(houseCodeId) && p.Status.Equals(HouseLogStatus.Handle)) + .OrderByDescending(p => p.CreatedTime) + .FirstOrDefaultAsync(); + if (log != null) + { + log.Status = HouseLogStatus.Handling; + await log.UpdateAsync(); + } + } + + [UnitOfWork] + public async Task Done(string houseCodeId) + { + var log = await _bsHouseLogRep + .Where(p => p.HouseCodeId.Equals(houseCodeId) && !p.Status.Equals(HouseLogStatus.Handled)) + .OrderByDescending(p => p.CreatedTime) + .FirstOrDefaultAsync(); + if (log != null) + { + log.Status = HouseLogStatus.Handled; + await log.UpdateAsync(); + } + } + + [UnitOfWork] + public async Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type) + { + await AddThenRead(houseCodeId, new List { targetUser }, type); + } + + [UnitOfWork] + public async Task AddThenRead(string houseCodeId, List targetUsers, HouseLogType type) + { + await new BsHouseLog + { + Id = Guid.NewGuid().ToString(), + HouseCodeId = houseCodeId, + TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)), + Type = type, + Status = HouseLogStatus.Handling + }.InsertAsync(); + } + + [UnitOfWork] + public async Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type) + { + await AddThenDone(houseCodeId, new List { targetUser }, type); + } + + [UnitOfWork] + public async Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type) + { + await new BsHouseLog + { + Id = Guid.NewGuid().ToString(), + HouseCodeId = houseCodeId, + TargetUserIds = String.Join(",", targetUsers.Select(p => p.Id)), + Type = type, + Status = HouseLogStatus.Handled + }.InsertAsync(); + } + } +} diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs new file mode 100644 index 0000000..b93db7b --- /dev/null +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs @@ -0,0 +1,21 @@ +using Ewide.Core; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Application.Service +{ + public interface IHouseLogService + { + Task Add(string houseCodeId, SysUser targetUser, HouseLogType type); + Task Add(string houseCodeId, List targetUsers, HouseLogType type); + Task Read(string houseCodeId); + Task Done(string houseCodeId); + Task AddThenRead(string houseCodeId, SysUser targetUser, HouseLogType type); + Task AddThenRead(string houseCodeId, List targetUsers, HouseLogType type); + Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type); + Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type); + } +} diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs index 5f68f22..a77a0b5 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseMember/HouseMemberService.cs @@ -322,14 +322,5 @@ WHERE SU.Id=@Id"; return roles; } - - [HttpGet("/houseMember/test")] - [Microsoft.AspNetCore.Authorization.AllowAnonymous] - public async Task Test([FromQuery] string str) - { - var result1 = str.ToCamelCase(); - var result2 = str.ToUnderScoreCase(); - return result1 + "," + result2; - } } } diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs index 46d1295..1207282 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseSelector/HouseSelectorService.cs @@ -1,4 +1,5 @@ using Dapper; +using Ewide.Core; using Ewide.Core.Extension; using Furion.DatabaseAccessor; using Furion.DatabaseAccessor.Extensions; @@ -19,26 +20,38 @@ namespace Ewide.Application.Service [ApiDescriptionSettings(Name = "HouseSelector", Order = 180)] public class HouseSelectorService : IHouseSelectorService, IDynamicApiController, ITransient { + private readonly IUserManager _userManager; private readonly IDapperRepository _dapperRep; private readonly IRepository _bsHouseMemberRelationRep; private readonly IRepository _bsHouseCodeRep; private readonly IRepository _bsHouseTaskRep; + private readonly IRepository _sysUserRep; private readonly IHouseZoneService _houseZoneService; + private readonly IHouseLogService _houseLogService; + public HouseSelectorService( + IUserManager userManager, IDapperRepository dapperRep, IRepository bsHouseMemberRelationRep, IRepository bsHouseCodeRep, IRepository bsHouseTaskRep, - IHouseZoneService houseZoneService + IRepository sysUserRep, + IHouseZoneService houseZoneService, + IHouseLogService houseLogService ) { + _userManager = userManager; + _dapperRep = dapperRep; _bsHouseMemberRelationRep = bsHouseMemberRelationRep; _bsHouseCodeRep = bsHouseCodeRep; _bsHouseTaskRep = bsHouseTaskRep; + _sysUserRep = sysUserRep; _houseZoneService = houseZoneService; + + _houseLogService = houseLogService; } /// @@ -50,7 +63,7 @@ namespace Ewide.Application.Service public async Task HouseSelectorList([FromBody] QueryHouseSelectorInput input) { var sql = @"SELECT - HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName + HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName FROM bs_house_code HC LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode @@ -77,7 +90,7 @@ WHERE HM.Id IS NULL"; public async Task HouseSelectedList([FromBody] QueryHouseSelectorInput input) { var sql = @"SELECT - HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`,'(',Proj.Note,')') FullProjName + HC.*,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,Proj.AreaCode,Proj.Note,CONCAT(Proj.`Name`, IFNULL(CONCAT('(',Proj.Note,')'), '')) FullProjName FROM bs_house_code HC LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode @@ -128,8 +141,10 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM if (ids.Count == 0) throw Oops.Oh("当前房屋在此之前已经全部被选中,请确认"); + var selectedUser = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.UserId)); + // 从用户所在片区中过滤房屋 - var zoneId = await _houseZoneService.GetZoneByUser(input.UserId); + var zoneId = await _houseZoneService.GetZoneByUser(selectedUser.Id); var house = await _bsHouseCodeRep.DetachedEntities.Where(p => ids.Contains(p.Id) && p.ZoneId == zoneId).Select(p => p.Id).ToListAsync(); if (house.Count == 0) throw Oops.Oh("选中的房屋错误"); @@ -137,11 +152,11 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM #endregion // 选定房屋 - house.ForEach(p => + house.ForEach(async p => { new BsHouseMemberRelation { - SysUserId = input.UserId, + SysUserId = selectedUser.Id, HouseCodeId = p }.Insert(); @@ -152,17 +167,23 @@ INNER JOIN (SELECT * FROM bs_house_member_relation WHERE SysUserId = @UserId) HM { Id = System.Guid.NewGuid().ToString(), HouseCodeId = p, - UserID = input.UserId, + UserID = selectedUser.Id, EndTime = System.DateTime.Now.AddMonths(1), Status = 0, TaskType = 0 }.Insert(); + + await _houseLogService.Done(p); } else { initTask.UserID = input.UserId; initTask.Update(); + + await _houseLogService.AddThenDone(p, _userManager.User, HouseLogType.SelectMember); } + + await _houseLogService.Add(p, selectedUser, HouseLogType.CreateInfo); }); } diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs index a99b541..2399842 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs @@ -29,18 +29,22 @@ namespace Ewide.Application.Service private readonly IDapperRepository _dapperRepository; private readonly IUserManager _userManager; - public HouseTaskService(IRepository HouseTaskRep, IRepository HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager) + private readonly IHouseLogService _houseLogService; + + public HouseTaskService(IRepository HouseTaskRep, IRepository HouseInfoRep, IDapperRepository dapperRepository, IUserManager userManager, IHouseLogService houseLogService) { _houseTaskRep = HouseTaskRep; _houseInfoRep = HouseInfoRep; _dapperRepository = dapperRepository; _userManager = userManager; + + _houseLogService = houseLogService; } [HttpPost("/houseTask/page")] public async Task 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,'(',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 + 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 @@ -90,6 +94,9 @@ WHERE {0}"; houseInfo.State = 5; await houseInfo.UpdateExcludeAsync(new[] { nameof(BsHouseInfo.HouseGrade) }, true); } + + // 提交时流转日志 + await _houseLogService.Done(houseTask.HouseCodeId); } } } diff --git a/web-react/src/pages/business/house/code/index.jsx b/web-react/src/pages/business/house/code/index.jsx index 175d5f1..35a069b 100644 --- a/web-react/src/pages/business/house/code/index.jsx +++ b/web-react/src/pages/business/house/code/index.jsx @@ -50,11 +50,11 @@ export default class index extends Component { title: '房屋编码', dataIndex: 'houseCode', sorter: true, - width: 300, + width: 400, render: (text, record) => ( <> {`${record.areaName}-${record.roadName}-${record.commName}-${ - record.note + record.fullProjName }-${record.no.toString().padStart(3, '0')}`}
{text} @@ -77,9 +77,9 @@ export default class index extends Component { }, { title: '登记时间', + width: 180, dataIndex: 'createdTime', sorter: true, - width: 150, }, ] diff --git a/web-react/src/pages/business/house/member/selector/selected-list.jsx b/web-react/src/pages/business/house/member/selector/selected-list.jsx index 038e8da..8c36e4c 100644 --- a/web-react/src/pages/business/house/member/selector/selected-list.jsx +++ b/web-react/src/pages/business/house/member/selector/selected-list.jsx @@ -48,9 +48,9 @@ export default class index extends Component { sorter: true, width: 300, render: (text, record) => - `${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no - .toString() - .padStart(3, '0')}`, + `${record.areaName}-${record.roadName}-${record.commName}-${ + record.fullProjName + }-${record.no.toString().padStart(3, '0')}`, }, { title: '房屋性质及行业', diff --git a/web-react/src/pages/business/house/member/selector/selector-list.jsx b/web-react/src/pages/business/house/member/selector/selector-list.jsx index e4f7bbf..3a9e355 100644 --- a/web-react/src/pages/business/house/member/selector/selector-list.jsx +++ b/web-react/src/pages/business/house/member/selector/selector-list.jsx @@ -48,9 +48,9 @@ export default class index extends Component { sorter: true, width: 300, render: (text, record) => - `${record.areaName}-${record.roadName}-${record.commName}-${record.note}-${record.no - .toString() - .padStart(3, '0')}`, + `${record.areaName}-${record.roadName}-${record.commName}-${ + record.fullProjName + }-${record.no.toString().padStart(3, '0')}`, }, { title: '房屋性质及行业', diff --git a/web-react/src/pages/business/house/task/index.jsx b/web-react/src/pages/business/house/task/index.jsx index ff9fcb6..1beecdd 100644 --- a/web-react/src/pages/business/house/task/index.jsx +++ b/web-react/src/pages/business/house/task/index.jsx @@ -49,11 +49,11 @@ export default class index extends Component { title: '房屋编码', dataIndex: 'houseCode', sorter: true, - width: 300, + width: 400, render: (text, record) => ( <> {`${record.areaName}-${record.roadName}-${record.commName}-${ - record.note + record.fullProjName }-${record.no.toString().padStart(3, '0')}`}
{text} From da14389a47342861b042332e8e83e1d927e9519e Mon Sep 17 00:00:00 2001 From: ky_yusj <2655568377@qq.com> Date: Tue, 6 Jul 2021 17:25:22 +0800 Subject: [PATCH 04/12] =?UTF-8?q?update=20=20=20=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E3=80=81=E7=89=87=E5=8C=BA=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=AF=BB=E6=95=B0=E6=8D=AE=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Application/Ewide.Application.xml | 2 +- .../HouseProjectInfoService.cs | 8 +++--- .../HouseSafety/HouseZone/HouseZoneService.cs | 6 ++++ .../business/houseSafety/houseProjectInfo.js | 3 +- .../business/houseSafety/houseZone.js | 3 +- .../src/pages/business/house/project/form.jsx | 28 +++++++++++++------ .../pages/business/house/project/index.jsx | 7 +++-- .../src/pages/business/house/zone/form.jsx | 21 +++++++++++--- .../src/pages/business/house/zone/index.jsx | 7 +++-- 9 files changed, 60 insertions(+), 25 deletions(-) diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 1faa368..32fc69a 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -730,7 +730,7 @@ 通过ID获取项目 - + diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs index 60048d3..d0f8112 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/HouseProjectInfoService.cs @@ -69,12 +69,12 @@ namespace Ewide.Application.Service.HouseProjectInfo /// /// 通过ID获取项目 /// - /// + /// /// - [HttpGet("/houseProjectInfo/detailById")] - public async Task GetProjectById([Required] string id) + [HttpGet("/houseProjectInfo/getById")] + public async Task GetById([Required] string projectId) { - return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == id); + return await _houseProjectInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == projectId); } /// diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs index e5aac58..791374b 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseZone/HouseZoneService.cs @@ -64,6 +64,12 @@ namespace Ewide.Application.Service .ToListAsync(); } + [HttpGet("/houseZone/getById")] + public async Task GetById([Required] string zoneId) + { + return await _sysOrgRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id == zoneId); + } + /// /// 分页查询片区 /// diff --git a/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js b/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js index 6b3175f..2ab0b53 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseProjectInfo.js @@ -5,7 +5,8 @@ const urls = { houseProejctDelete: ['/houseProjectInfo/delete', 'post'], houseProejctDetail: ['/houseProjectInfo/detail', 'get'], houseProjectNextSort: ['/houseProjectInfo/nextSort', 'get'], - houseProjectList: ['houseProjectInfo/list', 'get'] + houseProjectList: ['houseProjectInfo/list', 'get'], + houseProjectGetById: ['houseProjectInfo/getById', 'get'] } export default urls \ No newline at end of file diff --git a/web-react/src/common/api/requests/business/houseSafety/houseZone.js b/web-react/src/common/api/requests/business/houseSafety/houseZone.js index d042f01..29f4a98 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseZone.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseZone.js @@ -8,7 +8,8 @@ const urls = { houseZoneList: '/houseZone/list', houseZoneAutoIncrement: '/houseZone/autoIncrement', houseZoneAdd: ['/houseZone/add', 'post'], - houseZoneEdit: ['/houseZone/edit', 'post'] + houseZoneEdit: ['/houseZone/edit', 'post'], + houseZoneGetById: ['/houseZone/getById', 'get'] } export default urls \ No newline at end of file diff --git a/web-react/src/pages/business/house/project/form.jsx b/web-react/src/pages/business/house/project/form.jsx index 31a7ea1..cee85f4 100644 --- a/web-react/src/pages/business/house/project/form.jsx +++ b/web-react/src/pages/business/house/project/form.jsx @@ -41,19 +41,29 @@ export default class form extends Component { * @param {*} params */ async fillData(params) { - const areaCodeDefault = params.record - ? params.record.areaCode - : params.pid - ? params.pid - : '' + let areaCodeDefault = params.pid ? params.pid : '' this.houseType = params.record ? params.record.type : 1 - this.record = cloneDeep(params.record) + if (params.id) { + this.setState({ + loading: true, + }) + + api.houseProjectGetById({ projectId: params.id }).then(({ data }) => { + areaCodeDefault = data.areaCode + this.record = data + + this.setState({ + loading: false, + }) + }) + } + // this.record = cloneDeep(params.record) this.initRecord = cloneDeep(params.record) //#region 从后端转换成前段所需格式 const areaData = await this.loadAreaData() this.setState({ - exist: !!params.record, + exist: !!params.id, options: { areaData }, }) @@ -81,7 +91,9 @@ export default class form extends Component { if (areaCodeDefault) { findCode(areaData) this.areaCode = areaCodeDefault - this.nextSort(this.areaCode, this.houseType) + if (!this.state.exist) { + this.nextSort(this.areaCode, this.houseType) + } } this.record = { diff --git a/web-react/src/pages/business/house/project/index.jsx b/web-react/src/pages/business/house/project/index.jsx index 68ec611..1f6d8f7 100644 --- a/web-react/src/pages/business/house/project/index.jsx +++ b/web-react/src/pages/business/house/project/index.jsx @@ -88,7 +88,7 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(this.editForm, record)}>编辑 + this.onOpen(this.editForm, record.id)}>编辑 { + this.record = data + + this.setState({ + loading: false, + }) + }) + } + // this.record = cloneDeep(params.record) //#region 从后端转换成前段所需格式 const orgData = await this.loadOrgData() this.setState({ - exist: !!params.record, + exist: !!params.id, options: { orgData }, }) @@ -78,7 +91,7 @@ export default class form extends Component { } //#endregion - if (!params.record && !!params.orgId) { + if (!params.id && !!params.orgId) { this.onOrgIdChanged(params.orgId) } this.form.current.setFieldsValue(this.record) diff --git a/web-react/src/pages/business/house/zone/index.jsx b/web-react/src/pages/business/house/zone/index.jsx index fb8857f..bf84083 100644 --- a/web-react/src/pages/business/house/zone/index.jsx +++ b/web-react/src/pages/business/house/zone/index.jsx @@ -80,7 +80,7 @@ export default class index extends Component { render: (text, record) => ( - this.onOpen(this.editForm, record)}>编辑 + this.onOpen(this.editForm, record.id)}>编辑 Date: Tue, 6 Jul 2021 17:26:54 +0800 Subject: [PATCH 05/12] fix --- .../HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs index 2d6824d..e8b05c6 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseProjectInfo/IHouseProjectInfoService.cs @@ -14,7 +14,7 @@ namespace Ewide.Application.Service.HouseProjectInfo Task AddProject(AddProjectInput input); Task DeleteProject(DeleteProjectInput input); Task UpdateProject(UpdateProjectInput input); - Task GetProjectById([FromRoute] string id); + Task GetById([FromRoute] string projectId); Task GetProject([FromQuery] QueryProjectInput input); Task QueryProjectPageList([FromQuery] PageProjectInput input); From 40a267997f300b492146022cf2f102ca3c662970 Mon Sep 17 00:00:00 2001 From: ky_yusj <2655568377@qq.com> Date: Tue, 6 Jul 2021 17:57:38 +0800 Subject: [PATCH 06/12] merge --- Api/Ewide.Application/Ewide.Application.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 32fc69a..fb7a3f4 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -726,7 +726,7 @@ - + 通过ID获取项目 From 1d672586b3c9e23319e328f8328da0a28f9f583f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Tue, 6 Jul 2021 18:27:07 +0800 Subject: [PATCH 07/12] =?UTF-8?q?update=20=E8=8E=B7=E5=8F=96=E6=B5=81?= =?UTF-8?q?=E8=BD=AC=E6=97=A5=E5=BF=97=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HouseSafety/HouseLog/Dto/HouseLogInput.cs | 15 ++++++ .../HouseLog/Dto/HouseLogOutput.cs | 19 +++++++ .../HouseSafety/HouseLog/HouseLogService.cs | 51 +++++++++++++++++-- .../HouseSafety/HouseLog/IHouseLogService.cs | 3 ++ 4 files changed, 85 insertions(+), 3 deletions(-) create mode 100644 Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs create mode 100644 Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs new file mode 100644 index 0000000..356d221 --- /dev/null +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogInput.cs @@ -0,0 +1,15 @@ +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 HouseLogInput + { + [Required(ErrorMessage = "Id不能为空")] + public string Id { get; set; } + } +} diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs new file mode 100644 index 0000000..f5aab48 --- /dev/null +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/Dto/HouseLogOutput.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Ewide.Application +{ + public class HouseLogOutput + { + public string TargetUserNames { get; set; } + public int Type { get; set; } + public int Status { get; set; } + public DateTime CreatedTime { get; set; } + public DateTime? UpdatedTimeg { get; set; } + public string CreatedUserName { get; set; } + public string UpdatedUserName { get; set; } + } +} diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs index 278fec9..22dd992 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/HouseLogService.cs @@ -1,8 +1,10 @@ -using Ewide.Core; +using Dapper; +using Ewide.Core; using Furion.DatabaseAccessor; using Furion.DatabaseAccessor.Extensions; using Furion.DependencyInjection; using Furion.DynamicApiController; +using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; @@ -12,12 +14,16 @@ using System.Threading.Tasks; namespace Ewide.Application.Service { - public class HouseLogService : IHouseLogService, ITransient + [ApiDescriptionSettings(Name = "HouseLog", Order = 180)] + public class HouseLogService : IHouseLogService, IDynamicApiController, ITransient { + private readonly IDapperRepository _dapperRep; + private readonly IRepository _bsHouseLogRep; - public HouseLogService(IRepository bsHouseLogRep) + public HouseLogService(IDapperRepository dapperRep, IRepository bsHouseLogRep) { + _dapperRep = dapperRep; _bsHouseLogRep = bsHouseLogRep; } @@ -105,5 +111,44 @@ namespace Ewide.Application.Service Status = HouseLogStatus.Handled }.InsertAsync(); } + + [HttpGet("/houseLog/list")] + public async Task List([FromQuery] HouseLogInput input) + { + var sql = @"SELECT *, +(SELECT GROUP_CONCAT(`Name`) FROM sys_user + WHERE Id IN ( + SELECT DISTINCT SUBSTRING_INDEX(SUBSTRING_INDEX(_HL.TargetUserIds,',',HT.help_topic_id + 1),',',-1) + FROM bs_house_log _HL + JOIN mysql.help_topic HT ON HT.help_topic_id < (LENGTH(_HL.TargetUserIds) - LENGTH(REPLACE(_HL.TargetUserIds,',','')) + 1) + WHERE _HL.Id = HL.Id + ) +) TargetUserNames +FROM bs_house_log HL +WHERE HouseCodeId = @HouseCodeId +ORDER BY HL.CreatedTime DESC, Type DESC"; + + return await _dapperRep.QueryAsync(sql, new { houseCodeId = input.Id }); + } + + [HttpGet("/houseLog/listByInfoId")] + public async Task ListByInfoId([FromQuery] HouseLogInput input) + { + var info = await Db.GetRepository().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id)); + return await List(new HouseLogInput + { + Id = info.HouseCodeId + }); + } + + [HttpGet("/houseLog/listByTaskId")] + public async Task ListByTaskId([FromQuery] HouseLogInput input) + { + var task = await Db.GetRepository().DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(input.Id)); + return await List(new HouseLogInput + { + Id = task.HouseCodeId + }); + } } } diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs index b93db7b..f85e66f 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseLog/IHouseLogService.cs @@ -17,5 +17,8 @@ namespace Ewide.Application.Service Task AddThenRead(string houseCodeId, List targetUsers, HouseLogType type); Task AddThenDone(string houseCodeId, SysUser targetUser, HouseLogType type); Task AddThenDone(string houseCodeId, List targetUsers, HouseLogType type); + Task List(HouseLogInput input); + Task ListByInfoId(HouseLogInput input); + Task ListByTaskId(HouseLogInput input); } } 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 08/12] =?UTF-8?q?update=20=E4=BB=BB=E5=8A=A1=E8=A1=A8?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=20IsEnbaled=20=20=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E6=9C=89=E6=95=88=20=E6=8F=90=E4=BA=A4=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E3=80=81=E5=AE=A1=E6=A0=B8=E6=96=B0=E5=A2=9E=E6=88=BF?= =?UTF-8?q?=E5=B1=8B=E6=B5=81=E8=BD=AC=E6=97=A5=E5=BF=97=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=20=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} From 37aa61855dbf8565d806f68b369096106308a3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 8 Jul 2021 10:02:56 +0800 Subject: [PATCH 09/12] =?UTF-8?q?fix=20=E5=88=B7=E6=96=B0=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E4=B8=8D=E5=90=8C=E6=8C=89=E9=92=AE=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web-react/src/components/query-table-actions/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-react/src/components/query-table-actions/index.jsx b/web-react/src/components/query-table-actions/index.jsx index d509d3f..0b59588 100644 --- a/web-react/src/components/query-table-actions/index.jsx +++ b/web-react/src/components/query-table-actions/index.jsx @@ -26,7 +26,7 @@ export default class QueryTableActions extends Component { (series && node.className == className) || (!node.nextElementSibling && node.className == className) ) { - node.remove() + node.style.display = 'none' series = false } else if (node.className == className) { series = true From 598de7c026202963e72f013d97dcd3db141044b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 8 Jul 2021 10:55:59 +0800 Subject: [PATCH 10/12] =?UTF-8?q?update=20=E6=B5=81=E8=BD=AC=E6=97=A5?= =?UTF-8?q?=E5=BF=97,=20=E9=80=89=E6=8B=A9=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Api/Ewide.Application/Ewide.Application.xml | 20 +++++++++++++++ .../HouseSafety/HouseInfo/HouseInfoService.cs | 20 ++++++++++++--- .../HouseSafety/HouseTask/HouseTaskService.cs | 10 ++++---- web-react/src/components/index.js | 2 ++ .../src/pages/business/house/task/index.jsx | 25 +++++++++++++------ web-react/src/util/tool/index.js | 23 +++++++++++++++++ 6 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 web-react/src/util/tool/index.js diff --git a/Api/Ewide.Application/Ewide.Application.xml b/Api/Ewide.Application/Ewide.Application.xml index 0519e69..53d4ca2 100644 --- a/Api/Ewide.Application/Ewide.Application.xml +++ b/Api/Ewide.Application/Ewide.Application.xml @@ -489,6 +489,11 @@ 最后提交时间
+ + + 是否有效 + + 任务Id @@ -1451,6 +1456,21 @@ 上报备注 + + + 提交时间 + + + + + 最后提交时间 + + + + + 是否有效 + + 所属街道 diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs index 2a42a56..ee92918 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseInfo/HouseInfoService.cs @@ -28,17 +28,24 @@ namespace Ewide.Application.Service.HouseSafety.HouseInfo private readonly IRepository _houseCodeRep; private readonly IRepository _houseInfoRep; private readonly IRepository _houseTaskRep; + private readonly IRepository _sysUserRep; private readonly IUserManager _userManager; private readonly IDapperRepository _dapperRepository; private readonly IHouseLogService _houseLogService; - public HouseInfoService(IRepository HouseCodeRep,IRepository HouseInfoRep, IRepository HouseTaskRep, IUserManager userManager, IDapperRepository dapperRepository, IHouseLogService houseLogService) + public HouseInfoService( + IRepository HouseCodeRep, + IRepository HouseInfoRep, + IRepository HouseTaskRep, + IRepository sysUserRep, + IUserManager userManager, IDapperRepository dapperRepository, IHouseLogService houseLogService) { _houseCodeRep = HouseCodeRep; _houseInfoRep = HouseInfoRep; _houseTaskRep = HouseTaskRep; + _sysUserRep = sysUserRep; _userManager = userManager; _dapperRepository = dapperRepository; @@ -135,9 +142,9 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId } var houseEntity = await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(h => h.HouseCodeId == input.houseCode.Id); //建档审核通过的房屋数据修改时,对应的建档任务Task不处理 + var houseTask = input.PatrolInfo.Adapt(); if (houseEntity == null || houseEntity.State != 6) { - var houseTask = input.PatrolInfo.Adapt(); houseTask.HouseCodeId = input.houseCode.Id; //任务没有暂存状态,其他状态与HouseInfo的State一致 houseTask.Status = dataStatus == DataStatus.TempSaved ? (int)DataStatus.Saved : (int)dataStatus; @@ -167,7 +174,6 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId } var org = await _userManager.GetUserOrgInfo(); - var _sysUserRep = Db.GetRepository(); var _sysEmpRep = Db.GetRepository(); var _sysUserRoleRep = Db.GetRepository(); var _sysRoleRep = Db.GetRepository(); @@ -178,14 +184,20 @@ WHERE HC.Id=@HouseCodeId", new { houseTask.HouseCodeId } where e.OrgId == org.Id && r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase() select u).ToListAsync(); - await _houseLogService.AddThenDone(input.houseCode.Id, zoneManagerList, HouseLogType.Check); + await _houseLogService.Add(input.houseCode.Id, zoneManagerList, HouseLogType.Check); } //审核操作则新增一条审核记录 if (dataStatus == DataStatus.Back || dataStatus == DataStatus.Passed) { var checkRecord = input.TaskCheckRecord.Adapt(); await checkRecord.InsertAsync(); + await _houseLogService.Done(input.houseCode.Id); await _houseLogService.AddThenDone(input.houseCode.Id, _userManager.User, dataStatus == DataStatus.Passed ? HouseLogType.Agree : HouseLogType.Disagree); + if (dataStatus == DataStatus.Back) + { + var user = await _sysUserRep.DetachedEntities.FirstOrDefaultAsync(p => p.Id.Equals(houseTask.UserID)); + await _houseLogService.Add(input.houseCode.Id, user, HouseLogType.CreateInfo); + } } } } diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs index 2399842..6337437 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseTask/HouseTaskService.cs @@ -51,22 +51,22 @@ 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 {0}"; +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()).Count() > 0) + if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.HouseSecurityManager).ToUnderScoreCase()).Any()) { - sql = String.Format(sql, " T.UserID=@UserID "); + sql = String.Format(sql, " AND T.UserID=@UserID "); param.Add("UserID", user.Id); } - if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Count() > 0) + if (userRoles.Where(r => r.Code == Enum.GetName(HouseManagerRole.ZoneManager).ToUnderScoreCase()).Any()) { - sql = String.Format(sql, " (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId "); + sql = String.Format(sql, " AND (T.Status=3 OR T.Status=6) AND HC.ZoneId = @ZoneId "); param.Add("ZoneId", userOrg.Id); } diff --git a/web-react/src/components/index.js b/web-react/src/components/index.js index a729563..43eca8f 100644 --- a/web-react/src/components/index.js +++ b/web-react/src/components/index.js @@ -14,3 +14,5 @@ export { default as QueryList } from './query-list' export { default as QueryTable } from './query-table' export { default as QueryTableActions } from './query-table-actions' export { default as QueryTreeLayout } from './query-tree-layout' + +export { default as HouseLog } from './business/house-log' \ No newline at end of file diff --git a/web-react/src/pages/business/house/task/index.jsx b/web-react/src/pages/business/house/task/index.jsx index 1beecdd..ed5dea0 100644 --- a/web-react/src/pages/business/house/task/index.jsx +++ b/web-react/src/pages/business/house/task/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { Card, Form, Input, message as Message, Radio, Select, Tag } from 'antd' +import { Card, Checkbox, Form, Input, message as Message, Radio, Select, Tag } from 'antd' import { Auth, Container, QueryTable, QueryTableActions } from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' @@ -7,6 +7,7 @@ import { isEqual } from 'lodash' import getDictData from 'util/dic' import { toCamelCase } from 'util/format' import { getSearchInfo } from 'util/query' +import { checkboxCheckedNone } from 'util/tool' /** * 注释段[\/**\/]为必须要改 @@ -245,12 +246,22 @@ export default class index extends Component { columns={this.columns} queryInitialValues={{ type: '', - state: 0, + state: [-1, 0, 1, 2], }} onQueryChange={values => { if (values.hasOwnProperty('type')) { this.setState({ type: values.type }) } + if (values.hasOwnProperty('state')) { + const value = checkboxCheckedNone({ + value: values.state, + length: codes.houseStatus.length, + required: true, + }) + return { + state: value, + } + } }} query={ @@ -286,14 +297,14 @@ export default class index extends Component { - + } diff --git a/web-react/src/util/tool/index.js b/web-react/src/util/tool/index.js new file mode 100644 index 0000000..239faaf --- /dev/null +++ b/web-react/src/util/tool/index.js @@ -0,0 +1,23 @@ +import { first, last } from "lodash" + +export const checkboxCheckedNone = (arg) => { + let { value, length, noneValue, required } = arg + if (length === undefined) length = 2 + if (noneValue === undefined) noneValue = '' + if (required === undefined) required = false + + if (first(value) === noneValue && value.length > 1) { + // 在'无'之后选中其他值 + value.shift() + } else if ( + value.length >= length + || + (last(value) === noneValue && value.length > 1) + || + (!value.length && required) + ) { + // 在其他值之后选中'无' + value = [noneValue] + } + return value +} \ No newline at end of file From ad50293249a3d1a297d6295d33acd0634a635d83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=87=AA=E5=B8=A6=E5=A4=A7=E4=BD=AC=E6=B0=94=E5=9C=BA?= <188633308@qq.com> Date: Thu, 8 Jul 2021 13:43:45 +0800 Subject: [PATCH 11/12] =?UTF-8?q?add=20=E6=B5=81=E8=BD=AC=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E6=97=B6=E9=97=B4=E8=BD=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/business/house-log.jsx | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 web-react/src/components/business/house-log.jsx diff --git a/web-react/src/components/business/house-log.jsx b/web-react/src/components/business/house-log.jsx new file mode 100644 index 0000000..2ccf2c9 --- /dev/null +++ b/web-react/src/components/business/house-log.jsx @@ -0,0 +1,72 @@ +import React, { Component } from 'react' +import { Spin, Steps, Timeline } from 'antd' +import { AntIcon } from 'components' +import { api } from 'common/api' +import getDictData from 'util/dic' +import { toCamelCase } from 'util/format' + +export default class houseLog extends Component { + state = { + loading: true, + codes: { + houseLogType: [], + }, + data: [], + } + + async componentDidMount() { + const { id, infoId, taskId } = this.props + const state = { loading: false } + + state.codes = await getDictData('house_log_type') + + if (id) { + } else if (infoId) { + } else if (taskId) { + const { data } = await api.houseLogListByTaskId({ id: taskId }) + state.data = data + } + this.setState(state) + } + + bindCodeValue(code, name) { + name = toCamelCase(name) + const codes = this.state.codes[name] + if (codes) { + const c = codes.find(p => p.code == code) + if (c) { + return c.value + } + } + return null + } + + render() { + const { loading, codes, data } = this.state + + return ( + }> + + {data.map((item, i) => ( + , + , + ][item.status] + } + > +
+ {this.bindCodeValue(item.type, 'house_log_type')} +
+

{item.updatedTime}

+

{item.targetUserNames}

+
+ ))} +
+
+ ) + } +} From 990e8cf2957c1fcdc692f14134f5b8881868e494 Mon Sep 17 00:00:00 2001 From: Connor <9174814+connorxia618@user.noreply.gitee.com> Date: Thu, 8 Jul 2021 13:51:06 +0800 Subject: [PATCH 12/12] =?UTF-8?q?Notice=20=E5=86=8D=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extension/DataFilter/Entity/FilterInfo.cs | 1 + .../Service/Notice/SysNoticeService.cs | 8 ++- web-react/src/pages/system/notice/form.jsx | 1 - web-react/src/pages/system/notice/index.jsx | 25 ++++--- .../src/pages/system/noticeReceived/form.jsx | 65 ++++++++++++++++- .../src/pages/system/noticeReceived/index.jsx | 53 ++++++++------ .../src/views/main/_layout/header/notice.jsx | 71 ++++++++++++++++++- 7 files changed, 186 insertions(+), 38 deletions(-) diff --git a/Api/Ewide.Core/Extension/DataFilter/Entity/FilterInfo.cs b/Api/Ewide.Core/Extension/DataFilter/Entity/FilterInfo.cs index a7087be..42b1d2d 100644 --- a/Api/Ewide.Core/Extension/DataFilter/Entity/FilterInfo.cs +++ b/Api/Ewide.Core/Extension/DataFilter/Entity/FilterInfo.cs @@ -34,6 +34,7 @@ namespace Ewide.Core.Extension.DataFilter.Entity /// public void SetSearchInfo(SearchInfo[] searchInfo, IEnumerable filterFields) { + if (searchInfo == null) return; try { foreach (var elem in searchInfo) diff --git a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs index dba5165..b182d18 100644 --- a/Api/Ewide.Core/Service/Notice/SysNoticeService.cs +++ b/Api/Ewide.Core/Service/Notice/SysNoticeService.cs @@ -232,7 +232,7 @@ WHERE SNU.UserId = @UserId AND SN.Status = @Status"; }, new[] { - "Type","Title" + "Type","Title","ReadStatus" } ); @@ -254,8 +254,10 @@ WHERE SNU.UserId = @UserId AND SN.Status = @Status"; [HttpGet("/sysNotice/unread")] public async Task GetUnreadCount() { - var noticeList = await _sysNoticeRep.Where(u => u.Status != (int)NoticeStatus.DELETED).Select(s => s.Id).ToListAsync(); - return await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && noticeList.Contains(u.NoticeId) && u.ReadStatus == (int)NoticeUserStatus.UNREAD).CountAsync(); + //删除 或者 草稿都不让显示 + var noticeList = await _sysNoticeRep.Where(u => u.Status != (int)NoticeStatus.DELETED&& u.Status != (int)NoticeStatus.DRAFT).Select(s => s.Id).ToListAsync(); + var noticeUserList = await _sysNoticeUserRep.Where(u => u.UserId == _userManager.UserId && noticeList.Contains(u.NoticeId) && u.ReadStatus == (int)NoticeUserStatus.UNREAD).ToListAsync(); + return noticeUserList.Count(); } /// diff --git a/web-react/src/pages/system/notice/form.jsx b/web-react/src/pages/system/notice/form.jsx index b4ae8fc..13c8fe4 100644 --- a/web-react/src/pages/system/notice/form.jsx +++ b/web-react/src/pages/system/notice/form.jsx @@ -139,7 +139,6 @@ export default class form extends Component { */ async getData() { const form = this.form.current - console.log(this.record) const valid = await form.validateFields() if (valid) { const postData = form.getFieldsValue() diff --git a/web-react/src/pages/system/notice/index.jsx b/web-react/src/pages/system/notice/index.jsx index 555fe0e..0f43dfa 100644 --- a/web-react/src/pages/system/notice/index.jsx +++ b/web-react/src/pages/system/notice/index.jsx @@ -56,28 +56,38 @@ export default class index extends Component { { title: '标题', dataIndex: 'title', + width: 300, + sorter: true, }, { title: '发布人', dataIndex: 'publicUserName', + width: 120, + sorter: true, }, { title: '发布时间', dataIndex: 'createdTime', + width: 150, + sorter: true, }, { title: '发布单位', dataIndex: 'publicOrgName', - width: 200, + width: 150, + sorter: true, }, { title: '类型', dataIndex: 'type', + width: 120, + sorter: true, render: text => this.bindCodeValue(text, 'notice_type'), }, { title: '状态', dataIndex: 'status', + width: 120, render: text => this.bindCodeValue(text, 'notice_status'), }, ] @@ -94,7 +104,7 @@ export default class index extends Component { if (flag) { this.columns.push({ title: '操作', - width: 150, + width: 200, dataIndex: 'actions', render: (text, record) => ( @@ -178,6 +188,7 @@ export default class index extends Component { }) }) } + subUniqueKey(text, index) { return text.substr(index, 5) } @@ -252,26 +263,23 @@ export default class index extends Component { * @param {*} id */ onDelete(id) { - this.onAction(apiAction.Status({ id, Status: 3 }), '删除成功') + this.onAction(apiAction.Status({ id, status: 3 }), '删除成功') } /** * 发布 * @param {*} id */ onPublish(id) { - this.onAction(apiAction.Status({ id, Status: 1 }), '发布成功') + this.onAction(apiAction.Status({ id, status: 1 }), '发布成功') } /** * 撤回 * @param {*} id */ onGoBack(id) { - this.onAction(apiAction.Status({ id, Status: 2 }), '撤回成功') + this.onAction(apiAction.Status({ id, status: 2 }), '撤回成功') } // - //#region 自定义方法 - //#endregion - render() { const { codes } = this.state return ( @@ -280,7 +288,6 @@ export default class index extends Component { record.id} autoLoad={false} loadData={this.loadData} columns={this.columns} diff --git a/web-react/src/pages/system/noticeReceived/form.jsx b/web-react/src/pages/system/noticeReceived/form.jsx index e4d73c9..44465b1 100644 --- a/web-react/src/pages/system/noticeReceived/form.jsx +++ b/web-react/src/pages/system/noticeReceived/form.jsx @@ -1,15 +1,18 @@ import React, { Component } from 'react' -import { Spin, Divider, Modal, Row } from 'antd' +import { Spin, Divider, Modal, Row, Form, Upload } from 'antd' import { api } from 'common/api' import { AntIcon } from 'components' +import { BlobToBase64, GetFileName, PreviewFile } from 'util/file' export default class form extends Component { state = { detailVisible: false, detailLoading: false, detailData: {}, + fileValue: false, } + filedu = React.createRef() /** * mount后回调 */ @@ -20,12 +23,57 @@ export default class form extends Component { async onOpenDetail(id) { this.setState({ detailLoading: true, detailVisible: true }) const { data } = await api.sysNoticeDetail({ id }) + this.setState({ detailLoading: false, detailData: data, + fileValue: false, }) + + if (data) { + const { attachments } = data + if (attachments) { + const fileValue = [] + const fileList = attachments.split(',') + for (const fileId of fileList) { + try { + const file = await PreviewFile(fileId) + const base64 = await BlobToBase64(file) + fileValue.push({ + uid: fileId, + response: fileId, + name: file.name, + url: base64, + status: 'done', + }) + } catch { + const { data: file } = await api.sysFileInfoDetail({ id: fileId }) + fileValue.push({ + uid: fileId, + response: '文件已丢失', + name: file.fileOriginName, + status: 'error', + }) + } + } + this.setState({ + fileValue, + }) + } + } } + async onFileDownload(file) { + const { data, headers } = await api.sysFileInfoDownload({ id: file.response }) + const url = window.URL.createObjectURL(data) + const fileName = GetFileName(headers['content-disposition']) + const a = document.createElement('a') + a.href = url + a.download = fileName + a.click() + window.URL.revokeObjectURL(url) + a.remove() + } render() { const { detailLoading, detailVisible, detailData } = this.state return ( @@ -43,6 +91,21 @@ export default class form extends Component { dangerouslySetInnerHTML={{ __html: detailData.content }} >
+ {this.state.fileValue && ( + + + 查看附件 + this.onFileDownload(file)} + > + + + )} + 发布人:{detailData.publicUserName} 发布时间:{detailData.publicTime} diff --git a/web-react/src/pages/system/noticeReceived/index.jsx b/web-react/src/pages/system/noticeReceived/index.jsx index 3c5452f..d4b580f 100644 --- a/web-react/src/pages/system/noticeReceived/index.jsx +++ b/web-react/src/pages/system/noticeReceived/index.jsx @@ -20,6 +20,7 @@ export default class index extends Component { codes: { noticeStatus: [], noticeType: [], + readStatus: [], }, } @@ -33,25 +34,39 @@ export default class index extends Component { { title: '标题', dataIndex: 'title', + width: 300, + sorter: true, }, { title: '发布人', dataIndex: 'publicUserName', + width: 150, + sorter: true, }, { title: '发布时间', dataIndex: 'createdTime', + width: 200, + sorter: true, }, { title: '发布单位', dataIndex: 'publicOrgName', width: 200, + sorter: true, }, { title: '类型', dataIndex: 'type', + width: 120, render: text => this.bindCodeValue(text, 'notice_type'), }, + { + title: '已读未读', + dataIndex: 'readStatus', + width: 120, + render: text => this.bindCodeValue(text, 'read_status'), + }, ] /** @@ -94,33 +109,13 @@ export default class index extends Component { componentDidMount() { const { onLoading, onLoadData } = this.table.current onLoading() - getDictData('notice_status', 'notice_type').then(codes => { + getDictData('notice_status', 'notice_type', 'read_status').then(codes => { this.setState({ codes }, () => { onLoadData() }) }) } - /** - * 对表格上的操作进行统一处理 - * [异步] - * @param {*} action - * @param {*} successMessage - */ - async onAction(action, successMessage) { - const { onLoading, onLoaded, onReloadData } = this.table.current - onLoading() - try { - if (action) { - await action - } - if (successMessage) { - Message.success(successMessage) - } - onReloadData() - } catch { - onLoaded() - } - } + /** * 调用加载数据接口,可在调用前对query进行处理 * [异步,必要] @@ -134,6 +129,7 @@ export default class index extends Component { queryType: { type: QueryType.Equal, title: QueryType.Like, + readStatus: QueryType.Equal, }, }) @@ -200,6 +196,19 @@ export default class index extends Component { ))} + + + } /> diff --git a/web-react/src/views/main/_layout/header/notice.jsx b/web-react/src/views/main/_layout/header/notice.jsx index d0d2ec6..58abf17 100644 --- a/web-react/src/views/main/_layout/header/notice.jsx +++ b/web-react/src/views/main/_layout/header/notice.jsx @@ -1,8 +1,9 @@ import React, { Component } from 'react' -import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin } from 'antd' +import { Badge, Button, Divider, List, Menu, Modal, Popover, Row, Spin, Upload, Tag } from 'antd' import { AntIcon, Image } from 'components' import { api } from 'common/api' import InfiniteScroll from 'react-infinite-scroller' +import { BlobToBase64, GetFileName, PreviewFile } from 'util/file' import moment from 'moment' export default class notice extends Component { @@ -16,6 +17,7 @@ export default class notice extends Component { detailVisible: false, detailLoading: false, detailData: {}, + fileValue: false, } async componentDidMount() { @@ -42,7 +44,6 @@ export default class notice extends Component { sortField: 'createdTime', sortOrder: 'descend', }) - if (!items.length) { return this.finish() } @@ -59,7 +60,51 @@ export default class notice extends Component { this.setState({ detailLoading: false, detailData: data, + fileValue: false, }) + + if (data) { + const { attachments } = data + if (attachments) { + const fileValue = [] + const fileList = attachments.split(',') + for (const fileId of fileList) { + try { + const file = await PreviewFile(fileId) + const base64 = await BlobToBase64(file) + fileValue.push({ + uid: fileId, + response: fileId, + name: file.name, + url: base64, + status: 'done', + }) + } catch { + const { data: file } = await api.sysFileInfoDetail({ id: fileId }) + fileValue.push({ + uid: fileId, + response: '文件已丢失', + name: file.fileOriginName, + status: 'error', + }) + } + } + this.setState({ + fileValue, + }) + } + } + } + async onFileDownload(file) { + const { data, headers } = await api.sysFileInfoDownload({ id: file.response }) + const url = window.URL.createObjectURL(data) + const fileName = GetFileName(headers['content-disposition']) + const a = document.createElement('a') + a.href = url + a.download = fileName + a.click() + window.URL.revokeObjectURL(url) + a.remove() } renderList() { @@ -88,6 +133,13 @@ export default class notice extends Component { } + description={ + item.readStatus == 0 ? ( + 未读 + ) : ( + 已读 + ) + } />
{item.content}
@@ -140,6 +192,21 @@ export default class notice extends Component { dangerouslySetInnerHTML={{ __html: detailData.content }} > + {this.state.fileValue && ( + + + 查看附件 + this.onFileDownload(file)} + > + + + )} + 发布人:{detailData.publicUserName} 发布时间:{detailData.publicTime}