You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using Microsoft.AspNetCore.Authorization;using Microsoft.AspNetCore.Mvc;using Microsoft.CodeAnalysis;using Microsoft.CodeAnalysis.CSharp;using Microsoft.DotNet.PlatformAbstractions;using Microsoft.Extensions.DependencyModel;using Shentun.Peis.Models;using Shentun.Peis.RegisterCheckSummarys;using System;using System.CodeDom;using System.Collections.Generic;using System.Linq;using System.Reflection;using System.Text;using System.Threading.Tasks;using Volo.Abp;using Volo.Abp.Application.Services;using Volo.Abp.Domain.Repositories;using Volo.Abp.Identity;
namespace Shentun.Peis.RegisterCheckSuggestions{ /// <summary>
/// 建议
/// </summary>
[ApiExplorerSettings(GroupName = "Work")] [Authorize] public class RegisterCheckSuggestionAppService : ApplicationService { private readonly IRepository<RegisterCheckSuggestion, Guid> _registerCheckSuggestionRepository; private readonly IRepository<IdentityUser, Guid> _userRepository; private readonly RegisterCheckSuggestionManager _registerCheckSuggestionManager;
public RegisterCheckSuggestionAppService( IRepository<RegisterCheckSuggestion, Guid> registerCheckSuggestionRepository, IRepository<IdentityUser, Guid> userRepository, RegisterCheckSuggestionManager registerCheckSuggestionManager ) { this._registerCheckSuggestionRepository = registerCheckSuggestionRepository; this._userRepository = userRepository; this._registerCheckSuggestionManager = registerCheckSuggestionManager; }
/// <summary>
/// 批量生成建议 先删除全部,然后批量创建,前台调用直接传所有的建议就行
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/registerchecksuggestion/createregisterchecksuggestionmany")] public async Task CreateRegisterCheckSuggestionManyAsync(CreateRegisterCheckSuggestionDto input) {
throw new Exception("禁止"); List<RegisterCheckSuggestion> dtolist = ObjectMapper.Map<List<CreateRegisterCheckSuggestion_Detail>, List<RegisterCheckSuggestion>>(input.Details);
// await _registerCheckSuggestionRepository.DeleteAsync(m => m.RegisterCheckId == input[0].RegisterCheckId, true);
await _registerCheckSuggestionManager.CheckAndDeleteAsync(input.RegisterCheckId);
await _registerCheckSuggestionManager.CreateRegisterCheckSuggestionManyAsync(dtolist); }
/// <summary>
/// 根据RegisterCheckId获取检查建议数据
/// </summary>
/// <param name="RegisterCheckId">RegisterCheck表ID</param>
/// <returns></returns>
[HttpGet("api/app/registerchecksuggestion/getregisterchecksuggestionlist")] public async Task<List<RegisterCheckSuggestionDto>> GetRegisterCheckSuggestionListAsync(Guid RegisterCheckId) { var entlist = (await _registerCheckSuggestionRepository.GetListAsync(m => m.RegisterCheckId == RegisterCheckId)).OrderBy(o => o.DisplayOrder).ToList(); var userList = await _userRepository.GetListAsync(); var entlistdto = entlist.Select(s => new RegisterCheckSuggestionDto { CreationTime = s.CreationTime, DisplayOrder = s.DisplayOrder, CreatorId = s.CreatorId, Id = s.Id, LastModificationTime = s.LastModificationTime, LastModifierId = s.LastModifierId, RegisterCheckId = s.RegisterCheckId, Suggestion = s.Suggestion, CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId), LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId) }).ToList();
return entlistdto; }
}}
|