/// <summary> /// 添加到配置表 /// </summary> /// <param name="json"></param> /// <returns></returns> public JsonResult AddrConfiguration(ApprconfigurationDto apprconfigurationDto) { string json = Newtonsoft.Json.JsonConvert.SerializeObject(apprconfigurationDto); var target = HelperHttpClient.GetAll("post", "Audit/AddrConfiguration", json); return(Json(target)); }
public int AddrConfiguration([FromBody] string json) { ApprconfigurationDto apprconfigurationDto = Newtonsoft.Json.JsonConvert.DeserializeObject <ApprconfigurationDto>(json); string s = apprconfigurationDto.AuditValue; //string userId = s.Substring(0, s.Length - 1); string[] SuserId = s.Split(','); int[] User_Id = new int[SuserId.Length]; for (int i = 0; i < SuserId.Length; i++) { User_Id[i] = int.Parse(SuserId[i]); } int Goal_Id = apprconfigurationDto.GoalId; return(_iauditRepository.AddrConfiguration(User_Id, Goal_Id)); }
public async Task <IActionResult> GoalSubmit([FromForm] IFormCollection formData, GoalBaseData baseData) { //添加目标表 var goal = new Goal() { GoalName = baseData.GoalName, RoleId = baseData.RoleId, GoalTypeId = baseData.GoalTypeId, FrequencyId = baseData.FrequencyId, IndexLevelId = baseData.IndexLevelId, GoalStartTime = baseData.GoalStartTime, GoalEndTime = baseData.GoalEndTime, GoalWeight = baseData.GoalWeight, Goal_DutyUserId = baseData.Goal_DutyUserId, Goal_DutyCommanyId = baseData.Goal_DutyCommanyId, Goal_ParentId = baseData.Goal_ParentId, BusinessState = 0, FeedbackId = 1, FileId = 0, GoalCreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy MM dd")), GoalFormula = baseData.GoalFormula, GoalPeriod = baseData.GoalPeriod, GoalSources = baseData.GoalSources, GoalInformant = RedisHelper.Get("username"), GoalChargePeople = "admin", GoalOrganiser = baseData.GoalOrganiser, GoalUnit = DateTime.Now.ToString("yyyy MM dd"), GoalStateId = 4, }; string auditValue = baseData.AuditValue; //获取到审核人id var goaldata = JsonConvert.SerializeObject(goal); var goalId = HelperHttpClient.GetAll("post", "GoalManage/GoalAdd", goaldata); //添加成功返回自增长id //添加到配置表 ApprconfigurationDto apprconfigurationDto = new ApprconfigurationDto(); apprconfigurationDto.AuditValue = auditValue; apprconfigurationDto.GoalId = int.Parse(goalId); AddrConfiguration(apprconfigurationDto); //添加进展表 Feedback feedback = new Feedback(); feedback.GoalId = int.Parse(goalId); feedback.StateId = 1; feedback.FeedbackWorkEvolve = "未启动"; feedback.FeedbackDayEvolve = "完成0%"; feedback.FeedbackQuestion = "无问题"; feedback.FeedbackMeasure = "无"; feedback.FeedbackCoordinateMatters = "无"; feedback.FeedbackNowEvolve = 0; AddFeedBack(feedback); //添加指标分解表 Indexs indexs = new Indexs(); indexs.IndexsJanuary = baseData.IndexsJanuary; indexs.IndexsFebruary = baseData.IndexsFebruary; indexs.IndexsMarch = baseData.IndexsMarch; indexs.IndexsApril = baseData.IndexsApril; indexs.IndexsMay = baseData.IndexsMay; indexs.IndexsJune = baseData.IndexsJune; indexs.IndexsJuly = baseData.IndexsJuly; indexs.IndexsAugust = baseData.IndexsAugust; indexs.IndexsSeptember = baseData.IndexsSeptember; indexs.IndexsOctober = baseData.IndexsOctober; indexs.IndexsNovember = baseData.IndexsNovember; indexs.IndexsYearTarget = baseData.IndexsYearTarget; indexs.GoalId = int.Parse(goalId); indexs.IndexsCreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy MM dd")); var index = HelperHttpClient.GetAll("post", "GoalManage/GoalIndexsAdd", indexs); //上传文件 IFormFileCollection files = formData.Files; long size = files.Sum(f => f.Length); var i = ""; foreach (var item in files) { var inputName = item.Name; var filePath = "Common/UpdateFiles/" + item.FileName.Substring(item.FileName.LastIndexOf("\\") + 1); if (item.Length > 0) { using (var stream = new FileStream(filePath, FileMode.Create)) { await item.CopyToAsync(stream); } } var file = new Files() { FileName = item.FileName, FileUrl = filePath, CreateTime = Convert.ToDateTime(DateTime.Now.ToString("yyyy MM dd")), GoalId = int.Parse(goalId), }; i = HelperHttpClient.GetAll("post", "GoalManage/GoalFileAdd", file); } return(Json("目标下达成功,望督促按时完成任务!")); }