This commit is contained in:
wyw 2024-07-12 14:18:57 +08:00
commit eba7e9ada9
9 changed files with 135 additions and 69 deletions

View File

@ -17,5 +17,7 @@ namespace APT.BaseData.Domain.Entities.FM
[Description("颜色")]
public string COLOR { get; set; }
[Description("排序")]
public int NUM { get; set; }
}
}

View File

@ -244,7 +244,13 @@ namespace APT.BaseData.Domain.IServices.FM
/// <returns></returns>
List<T_FM_NOTIFICATION_TASK> InsertUserNoticeTaskModels(List<string> Name, List<Guid> DataId, Guid? OrgId, List<Guid> UserId, List<string> userName,
DateTime startTime, DateTime endTime, int noticeType, List<string> formCode);
/// <summary>
/// 发送新消息集合返回实体集合
/// </summary>
/// <param name="id">消息ID</param>
/// <returns></returns>
List<T_FM_NOTIFICATION_TASK> InsertUserNoticeTaskModels(List<string> Name, List<Guid> DataId, Guid? OrgId, List<Guid> UserId, List<string> userName,
DateTime startTime, List<DateTime> endTime, int noticeType, List<string> formCode);
/// <summary>
/// 发送新消息集合返回实体集合
/// </summary>

View File

@ -581,7 +581,40 @@ namespace APT.BaseData.Services.Services.FM
return notices;
}
/// <summary>
/// 插入新消息集合返回实体集合(wjn240705)
/// </summary>
/// <param name="id">消息ID</param>
/// <returns></returns>
public List<T_FM_NOTIFICATION_TASK> InsertUserNoticeTaskModels(List<string> Names, List<Guid> DataIds, Guid? OrgId, List<Guid> UserIds, List<string> UserNames,
DateTime startTime, List<DateTime> endTimes, int noticeType, List<string> formCode)
{
List<T_FM_NOTIFICATION_TASK> notices = new List<T_FM_NOTIFICATION_TASK>();
if (UserIds.Count > 0)
{
var index = 0;
UserIds.ForEach(t =>
{
T_FM_NOTIFICATION_TASK notice = new T_FM_NOTIFICATION_TASK();
notice.CODE = DateTime.Now.ToString("yyyyMMddHHmmss");
notice.NOTICE_TITLE = Names[index];
notice.SOURCE_DATA_ID = DataIds[index];
notice.ORG_ID = OrgId;
notice.ID = Guid.NewGuid();
notice.TASK_STARTDT = startTime;
notice.TASK_ENDDT = endTimes[index];
notice.NOTICE_TYPE = noticeType;
notice.NOTICE_STATUS = (int)FMNoticeStatusEnum.;
notice.USER_ID = t;
notice.USER_NAME = UserNames[index];
notice.SOURCE_FORMCODE = formCode[index];
notices.Add(notice);
index++;
});
}
return notices;
}
/// <summary>
/// 插入新消息集合返回实体集合(wjn0513)
/// </summary>

View File

@ -5406,6 +5406,7 @@ namespace APT.BaseData.Services.DomainServices
var noticeUserNames = new List<string>();
var noticeDataIds = new List<Guid>();
var noticeFormCodes = new List<string>();
var noticeEndTime = new List<DateTime>();
SystemCodeFilter riskCode = new SystemCodeFilter
{
CodeType = (int)PFCodeRuleType.,
@ -5510,6 +5511,7 @@ namespace APT.BaseData.Services.DomainServices
noticeUserIds.Add((Guid)riskDetail.CHARGE_USER_ID);
noticeUserNames.Add(user.NAME);
noticeFormCodes.Add("HM062");
noticeEndTime.Add(DateTime.Parse(riskTask.END_TIME.ToShortDateString() + " 23:59:59"));
risks.Add(riskTask);
}
int hazardIndex = 0;
@ -5571,9 +5573,10 @@ namespace APT.BaseData.Services.DomainServices
noticeUserIds.Add((Guid)hazardDetail.CHARGE_USER_ID);
noticeUserNames.Add(user.NAME);
noticeFormCodes.Add("HM102");
noticeEndTime.Add(DateTime.Parse(hazardTask.END_TIME.ToShortDateString() + " 23:59:59"));
hazards.Add(hazardTask);
}
sendNoticeList = NotificationTaskService.InsertUserNoticeTaskModels(noticeTitles, noticeDataIds, entity.ORG_ID, noticeUserIds, noticeUserNames, DateTime.Now, DateTime.Parse(DateTime.Now.AddDays(1).ToShortDateString() + " 23:59:59"), (int)FMNoticeTypeEnum., noticeFormCodes);
sendNoticeList = NotificationTaskService.InsertUserNoticeTaskModels( noticeTitles, noticeDataIds, entity.ORG_ID, noticeUserIds, noticeUserNames, DateTime.Now, noticeEndTime, (int)FMNoticeTypeEnum., noticeFormCodes);
this.UnifiedCommit(() =>
{
if (entity != null)

View File

@ -525,7 +525,16 @@ namespace APT.HM.WebApi.Controllers.Api
}
if (!string.IsNullOrEmpty(dtSource.Rows[i][18].ToString().Trim()))//责任单位
{
item.DEPARTMENT_LIABLE_ID = deps.FirstOrDefault(t => t.NAME == dtSource.Rows[i][18].ToString().Trim()).ID;
var dep = deps.FirstOrDefault(t => t.NAME == dtSource.Rows[i][18].ToString().Trim());
if (dep != null)
{
item.DEPARTMENT_LIABLE_ID = dep.ID;
}
else
{
var depName = dtSource.Rows[i][18].ToString().Trim();
}
}
if (!string.IsNullOrEmpty(dtSource.Rows[i][19].ToString().Trim()))//责任岗位
{

View File

@ -75,10 +75,6 @@ namespace APT.HM.WebApi.Controllers.Api
throw new Exception("辨识区域不能为空");
}
});
if (files == null || files.Count <= 0)
{
throw new Exception("附件未上传,无法发送");
}
if (entity.DEPUTY_GROUP_LEADER_ID == null || entity.GROUP_LEADER_ID == null)
{
throw new Exception("组长或副组长未填写");

View File

@ -297,7 +297,7 @@ namespace APT.HM.WebApi.Controllers.Api
}
allUsers.Add(recordUser);
}
allUsers= allUsers.DistinctBy(u => new { u.USER_ID, u.AREA_ID }).ToList();
allUsers = allUsers.DistinctBy(u => new { u.USER_ID, u.AREA_ID }).ToList();
}
}
//添加附件
@ -408,5 +408,38 @@ namespace APT.HM.WebApi.Controllers.Api
}
return result;
}
/// <summary>
/// 审批流回调
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost, Route("RejectUpdate")]
public JsonActionResult<bool> RejectUpdate([FromBody] T_PF_APPROVE entity)
{
return SafeExecute<bool>(() =>
{
T_PF_APPROVE modelApp = null;
List<T_PF_APPROVE_DETAIL> listAppDetail = null;
T_FM_NOTIFICATION_TASK taskFinish = null;
string Msg = string.Empty;
var record = GetEntity<T_HM_HAZARD_TASK>(entity.DATA_ID, new string[] { "Nav_LiableUser" });
bool ResultGetInfo = ApproveCallBackService.GetApproject(entity, ref modelApp, ref listAppDetail, ref taskFinish, ref Msg);
if (!ResultGetInfo)
throw new Exception("驳回失败!");
record.STATUS = FOPreMeetingStatusEnum.;
var sendNotice = NotificationTaskService.InsertUserNoticeTaskModel("职业危害辨识任务-驳回", entity.DATA_ID, record.ORG_ID, (Guid)record.LIABLE_USER_ID, record.Nav_LiableUser.NAME, DateTime.Now, DateTime.Now.AddDays(7), 0, "HM102");
UnifiedCommit(() =>
{
if (record != null)
UpdateEntityNoCommit(record); //保存主表
if (sendNotice != null)
AddEntityNoCommit(sendNotice);
});
return true;
});
}
}
}

View File

@ -533,49 +533,46 @@ namespace APT.PP.WebApi.Controllers.Api.PP
BaseFilter baseFilter = new BaseFilter(filter.GetOrgId());
var riskLevelProportions = new List<T_FM_RISK_LEVEL_PROPORTION>();
var riskTypeProportions = new List<T_FM_RISK_TYPE_PROPORTION>();
baseFilter.SelectField = new string[] { "EVALUATE_LEVEL", "Nav_Type.NAME", "MineType" };
var evaluateRisks = GetEntities<T_HM_EVALUATE_RISK>(t => t.TYPE_ID != null && t.EVALUATE_LEVEL != 0 && t.MineType != 0, baseFilter).Select(i => new { i.EVALUATE_LEVEL, i.Nav_Type.NAME, i.MineType }).OrderBy(i => i.EVALUATE_LEVEL).ToList();
var distinctLevelTypes = evaluateRisks.GroupBy(m => new { m.EVALUATE_LEVEL, m.MineType }).Select(group => new { group.Key.EVALUATE_LEVEL, group.Key.MineType, count = group.Count() }).ToList();
baseFilter.SelectField = new string[] { "EVALUATE_LEVEL", "Nav_Type.NAME" };
var evaluateRisks = GetEntities<T_HM_EVALUATE_RISK>(t => t.TYPE_ID != null && t.EVALUATE_LEVEL != 0 && t.STATUS == 0, baseFilter).Select(i => new { i.EVALUATE_LEVEL, i.Nav_Type.NAME }).OrderBy(i => i.EVALUATE_LEVEL).ToList();
var distinctLevelTypes = evaluateRisks.GroupBy(m => new { m.EVALUATE_LEVEL }).Select(group => new { group.Key.EVALUATE_LEVEL, count = group.Count() }).ToList();
var levels = new int[] { 10, 20, 30, 40 };
var mineTypes = new int[] { 10, 20, 30 };
foreach (var level in levels)
{
foreach (var mineType in mineTypes)
var item = distinctLevelTypes.FirstOrDefault(t => (int)t.EVALUATE_LEVEL == level);
T_FM_RISK_LEVEL_PROPORTION riskLevelProportion = new T_FM_RISK_LEVEL_PROPORTION();
if (item != null)
{
var item = distinctLevelTypes.FirstOrDefault(t => (int)t.MineType.Value == mineType && (int)t.EVALUATE_LEVEL == level);
T_FM_RISK_LEVEL_PROPORTION riskLevelProportion = new T_FM_RISK_LEVEL_PROPORTION();
riskLevelProportion.COLOR = mineType.ToString();
if (item != null)
{
riskLevelProportion.COUNT = item.count;
}
else
{
riskLevelProportion.COUNT = 0;
}
var label = "";
if (level == 10)
{
label = "一级";
}
else if (level == 20)
{
label = "二级";
}
else if (level == 30)
{
label = "三级";
}
else if (level == 40)
{
label = "四级";
}
riskLevelProportion.RISK_LEVEL = label;
riskLevelProportion.ORG_ID = filter.GetOrgId();
riskLevelProportions.Add(riskLevelProportion);
riskLevelProportion.COUNT = item.count;
}
else
{
riskLevelProportion.COUNT = 0;
}
var label = "";
if (level == 10)
{
label = "重大风险";
riskLevelProportion.NUM = 1;
}
else if (level == 20)
{
label = "较大风险";
riskLevelProportion.NUM = 2;
}
else if (level == 30)
{
label = "一般风险";
riskLevelProportion.NUM = 3;
}
else if (level == 40)
{
label = "低风险";
riskLevelProportion.NUM = 4;
}
riskLevelProportion.RISK_LEVEL = label;
riskLevelProportion.ORG_ID = filter.GetOrgId();
riskLevelProportions.Add(riskLevelProportion);
}
var distinctTypes = evaluateRisks.GroupBy(m => m.NAME).Select(group => new { group.Key, count = group.Count() }).ToList();
foreach (var item in distinctTypes)
@ -771,8 +768,8 @@ namespace APT.PP.WebApi.Controllers.Api.PP
{
DeleteEntityNoCommit<T_FM_HIDDEN_DANGER_RECTIFICATION>(t => true);//删除表数据
//添加信息
if (listResult.Any() && listResult.Count > 0)
//添加信息
if (listResult.Any() && listResult.Count > 0)
BantchAddEntityNoCommit(listResult);
});

View File

@ -213,7 +213,6 @@ namespace APT.SC.WebApi.Controllers.Api.BI
var measure3 = GetEntities<T_HM_EMERGENCY_MEASURES>(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count();
var measure4 = GetEntities<T_HM_ENGINEERING_MEASURES>(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count();
var measure5 = GetEntities<T_HM_MANAGEMENT_MEASURES>(t => t.IS_DELETED == false, measureFilter).Select(t => t.NAME).Distinct().Count();
//var distinctDepartment = allrisk.Select(t => new { t.SOURCE_DEPARTMENT_ID, t.Nav_SourceDepartment.NAME }).Distinct();
var distinctDepartment = GetEntities<T_FM_DEPARTMENT>(t => t.DEPARTMENT_TYPE == 0, new BaseFilter(filter.GetOrgId()));
riskData riskData = new riskData();
@ -234,24 +233,12 @@ namespace APT.SC.WebApi.Controllers.Api.BI
var distinctArea = allrisk.Select(t => new { t.AREA_ID, AreaName = t.Nav_Area.NAME, SourceDepartmentName = t.Nav_SourceDepartment.NAME }).Distinct();
foreach (var area in distinctArea)
{
if (area.SourceDepartmentName.Contains("矿山") || area.SourceDepartmentName.Contains("选矿"))
{
areaCountModel item = new areaCountModel();
if (area.SourceDepartmentName.Contains("矿山"))
{
item.AREATYPE = 0;
}
else
{
item.AREATYPE = 1;
}
item.AREANAME = area.AreaName;
item.AREACOUNT = allrisk.Count(t => t.AREA_ID == area.AREA_ID);
item2s.Add(item);
}
areaCountModel item = new areaCountModel();
item.AREANAME = area.AreaName;
item.AREACOUNT = allrisk.Count(t => t.AREA_ID == area.AREA_ID);
item2s.Add(item);
}
var currMonth = DateTime.Now.Month;
DateTime today = DateTime.Today;
for (var i = 1; i < currMonth + 1; i++)
@ -581,7 +568,7 @@ namespace APT.SC.WebApi.Controllers.Api.BI
sDatas.Add(Data);
}
}
var orderData = sDatas.OrderBy(t => t.NAME1).ThenBy(t=>t.NAME7).ToList();
var orderData = sDatas.OrderBy(t => t.NAME1).ThenBy(t => t.NAME7).ToList();
return orderData;
});
}