zhengcaioa/DTO/CooperOrderDTO.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/IServices/ICooperOrderService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/Model/zcUserInfoN_db/GadeRole.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/Model/zcUserInfoN_db/UsergGadeRole.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/Services/CooperOrderService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/zhengcaioa/Startup.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/zhengcaioa/appsettings.Development.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zhengcaioa/zhengcaioa/appsettings.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
zhengcaioa/DTO/CooperOrderDTO.cs
@@ -144,6 +144,21 @@ public string OrderId { get; set; } public int PrintNum { get; set; } public bool AnswerRoles { get; set; } public bool XiaocaiKeTang { get; set; } public bool XiaoCaiQandA { get; set; } public int Discount { get; set; } public int BiddingDocumentsCount { get; set; } public int ComplaintsDisputeCount { get; set; } public int PerformanceDisputeCount { get; set; } public int BiddingDocumentsCountused { get; set; } public int ComplaintsDisputeCountused { get; set; } public int PerformanceDisputeCountused { get; set; } } public class CooperOrderDTOSearch : SearchEntity zhengcaioa/IServices/ICooperOrderService.cs
@@ -87,5 +87,8 @@ ResultDataEntity<CooperOrderDTO> SearchByPagingWenshu(CooperOrderDTOSearch searchEntity); //获取质疑投诉的次数 List<CooperOrderDTO> GetListComplaintsDisputeCount(string huiyuanid); } } zhengcaioa/Model/zcUserInfoN_db/GadeRole.cs
New file @@ -0,0 +1,36 @@ using System; using System.Collections.Generic; #nullable disable namespace zhengcaioa.Models { public partial class GadeRole { public GadeRole() { UsergGadeRoleSecondUserGadeRoles = new HashSet<UsergGadeRole>(); UsergGadeRoleUserGadeRoles = new HashSet<UsergGadeRole>(); } public Guid Id { get; set; } public Guid? FrameworkRoleId { get; set; } public bool AnswerRoles { get; set; } public bool XiaocaiKeTang { get; set; } public bool XiaoCaiQandA { get; set; } public bool GaveBook { get; set; } public int Discount { get; set; } public int BiddingDocumentsCount { get; set; } public int ComplaintsDisputeCount { get; set; } public int PerformanceDisputeCount { get; set; } public decimal Price { get; set; } public bool OnShelf { get; set; } public DateTime? CreateTime { get; set; } public string CreateBy { get; set; } public DateTime? UpdateTime { get; set; } public string UpdateBy { get; set; } public virtual ICollection<UsergGadeRole> UsergGadeRoleSecondUserGadeRoles { get; set; } public virtual ICollection<UsergGadeRole> UsergGadeRoleUserGadeRoles { get; set; } } } zhengcaioa/Model/zcUserInfoN_db/UsergGadeRole.cs
New file @@ -0,0 +1,27 @@ using System; using System.Collections.Generic; #nullable disable namespace zhengcaioa.Models { public partial class UsergGadeRole { public Guid Id { get; set; } public Guid? UserId { get; set; } public bool GaveBook { get; set; } public DateTime? TimeOut { get; set; } public int BiddingDocumentsCount { get; set; } public int ComplaintsDisputeCount { get; set; } public int PerformanceDisputeCount { get; set; } public Guid? UserGadeRolesId { get; set; } public Guid? SecondUserGadeRolesId { get; set; } public DateTime? CreateTime { get; set; } public string CreateBy { get; set; } public DateTime? UpdateTime { get; set; } public string UpdateBy { get; set; } public virtual GadeRole SecondUserGadeRoles { get; set; } public virtual GadeRole UserGadeRoles { get; set; } } } zhengcaioa/Model/zcUserInfoN_db/zcUserInfoN_dbContext.cs
New file @@ -0,0 +1,93 @@ using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; #nullable disable namespace zhengcaioa.Models { public partial class zcUserInfoN_dbContext : DbContext { public zcUserInfoN_dbContext() { } public zcUserInfoN_dbContext(DbContextOptions<zcUserInfoN_dbContext> options) : base(options) { } public virtual DbSet<GadeRole> GadeRoles { get; set; } public virtual DbSet<UsergGadeRole> UsergGadeRoles { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263. optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=zcUserInfoN_db;User ID=sa;Password=123456"); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS"); modelBuilder.Entity<GadeRole>(entity => { entity.ToTable("gadeRoles"); entity.HasIndex(e => e.FrameworkRoleId, "IX_gadeRoles_FrameworkRoleId"); entity.Property(e => e.Id) .ValueGeneratedNever() .HasColumnName("ID"); entity.Property(e => e.CreateBy).HasMaxLength(50); entity.Property(e => e.OnShelf).HasColumnName("onShelf"); entity.Property(e => e.Price) .HasColumnType("decimal(18, 2)") .HasColumnName("price"); entity.Property(e => e.UpdateBy).HasMaxLength(50); entity.Property(e => e.XiaoCaiQandA).HasColumnName("XiaoCaiQAndA"); entity.Property(e => e.XiaocaiKeTang).HasColumnName("xiaocaiKeTang"); }); modelBuilder.Entity<UsergGadeRole>(entity => { entity.ToTable("usergGadeRoles"); entity.HasIndex(e => e.SecondUserGadeRolesId, "IX_usergGadeRoles_SecondUserGadeRolesId"); entity.HasIndex(e => e.UserGadeRolesId, "IX_usergGadeRoles_UserGadeRolesId"); entity.HasIndex(e => e.UserId, "IX_usergGadeRoles_UserId"); entity.Property(e => e.Id) .ValueGeneratedNever() .HasColumnName("ID"); entity.Property(e => e.CreateBy).HasMaxLength(50); entity.Property(e => e.UpdateBy).HasMaxLength(50); entity.HasOne(d => d.SecondUserGadeRoles) .WithMany(p => p.UsergGadeRoleSecondUserGadeRoles) .HasForeignKey(d => d.SecondUserGadeRolesId); entity.HasOne(d => d.UserGadeRoles) .WithMany(p => p.UsergGadeRoleUserGadeRoles) .HasForeignKey(d => d.UserGadeRolesId); }); OnModelCreatingPartial(modelBuilder); } partial void OnModelCreatingPartial(ModelBuilder modelBuilder); } } zhengcaioa/Services/CooperOrderService.cs
@@ -14,11 +14,13 @@ public class CooperOrderService: ICooperOrderService { private readonly zhengcaioaContext _context; private readonly zcUserInfoN_dbContext _zcUserInfoN_dbContext; private readonly IMapper _mapper; public CooperOrderService(zhengcaioaContext context, IMapper mapper) public CooperOrderService(zhengcaioaContext context, IMapper mapper, zcUserInfoN_dbContext zcUserInfoN_dbContext) { _context = context; _mapper = mapper; _zcUserInfoN_dbContext = zcUserInfoN_dbContext; } @@ -1936,5 +1938,37 @@ data.LoadData(searchEntity, lianlist); return data; } public List<CooperOrderDTO> GetListComplaintsDisputeCount(string huiyuanid) { var query = (from a in _zcUserInfoN_dbContext.UsergGadeRoles join b in _zcUserInfoN_dbContext.GadeRoles on a.UserGadeRolesId equals b.Id where a.UserId == Guid.Parse(huiyuanid) select new CooperOrderDTO { Id = a.UserId.ToString(), AnswerRoles = b.AnswerRoles, XiaocaiKeTang = b.XiaocaiKeTang, XiaoCaiQandA = b.XiaoCaiQandA, Discount = b.Discount, BiddingDocumentsCount = b.BiddingDocumentsCount, ComplaintsDisputeCount = b.ComplaintsDisputeCount, PerformanceDisputeCount = b.PerformanceDisputeCount, BiddingDocumentsCountused = a.BiddingDocumentsCount, ComplaintsDisputeCountused = a.ComplaintsDisputeCount, PerformanceDisputeCountused = a.PerformanceDisputeCount, } ).ToList(); return query; } } } zhengcaioa/zhengcaioa/Controllers/BusinessOrder/CooperOrderController.cs
@@ -582,120 +582,161 @@ var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); ViewData["curentuser"] = curentuser; data.RecStatus = "A"; if (String.IsNullOrEmpty(data.Id)) { data.Creater = curentuser.Id; data.Createtime = DateTime.Now; data.XdTime = data.Createtime; if (data.OrderType == "03" || data.OrderType == "07" || (data.OrderType == "02" && (data.OrderType1 == "代拟投诉书" || data.OrderType1 == "代拟质疑函"))) { var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(data.Khdw); if (cooperatecustomCustomerDTO != null && !string.IsNullOrEmpty(cooperatecustomCustomerDTO.HuiyuanId)) { string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; string SetCaseOrder = _configuration.GetSection("SetCaseOrder").Value; Uri postUrl2 = new Uri(huiyuanurl + SetCaseOrder); JObject questions2 = new JObject(); questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId); if (data.OrderType == "03") { questions2.Add("CaseType", 0); } else if (data.OrderType == "07") { questions2.Add("CaseType", 1); } else if (data.OrderType == "07") { questions2.Add("CaseType", 1); } else if (data.OrderType == "02" && (data.OrderType1 == "代拟投诉书" || data.OrderType1 == "代拟质疑函")) { questions2.Add("CaseType", 2); } bool youhui = true; questions2.Add("count", Decimal.ToInt32(data.OrderNum.Value) ); string requestJson2 = questions2.ToString(); string result2 = string.Empty; using (HttpContent httpContent = new StringContent(requestJson2)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var httpClient2 = _clientFactory.CreateClient(); httpClient2.Timeout = new TimeSpan(0, 0, 10); var Result2 = await httpClient2.PostAsync(postUrl2, httpContent); result2 = Result2.Content.ReadAsStringAsync().Result; } _logger.LogInformation("result2:" + result2); JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") { resultEntity.Result = true; } else { resultEntity.Result = false; resultEntity.Message = "写入会员订单失败"; return new JsonResult(resultEntity); } } } } using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = TransactionManager.MaximumTimeout } )) if (String.IsNullOrEmpty(data.Id)) { var youHuiDTOs = _askService.GetAskYouHuiList(data.Khdw, data.OrderType).FirstOrDefault(); if (youHuiDTOs != null) var cooperatecustomCustomerDTO = _cooperatecustomCustomerService.Get(data.Khdw); if (cooperatecustomCustomerDTO != null && !string.IsNullOrEmpty(cooperatecustomCustomerDTO.HuiyuanId)) { data.Youhuier = youHuiDTOs.Id; if (youHuiDTOs.Youhuistandard == "01") var cooperOrderDTOs = _cooperOrderService.GetListComplaintsDisputeCount(cooperatecustomCustomerDTO.HuiyuanId).FirstOrDefault(); if(cooperOrderDTOs != null) { data.Youhui = youHuiDTOs.YouHui.Value; if (data.Money.Value < data.Youhui.Value) { data.Money = 0; } else { data.Money = data.Money.Value - data.Youhui.Value; } } else if (youHuiDTOs.Youhuistandard == "02") { if (youHuiDTOs.YouHui.Value >= 100) if ((cooperOrderDTOs.ComplaintsDisputeCount - cooperOrderDTOs.ComplaintsDisputeCountused > 0) && (data.OrderType == "02" && (data.OrderType1 == "代拟投诉书" || data.OrderType1 == "代拟质疑函"))) { data.Youhui = data.Money.Value; data.Money = 0; youhui = false; } else else if ((cooperOrderDTOs.BiddingDocumentsCount - cooperOrderDTOs.BiddingDocumentsCountused > 0) && data.OrderType == "03") { data.Youhui = Math.Round(data.Money.Value * youHuiDTOs.YouHui.Value * new decimal(0.01), 2); data.Money = data.Money.Value - data.Youhui.Value; data.Youhui = data.Money.Value; data.Money = 0; youhui = false; } else if ((cooperOrderDTOs.PerformanceDisputeCount - cooperOrderDTOs.PerformanceDisputeCountused > 0) && data.OrderType == "07") { data.Youhui = data.Money.Value; data.Money = 0; youhui = false; } } } data.Creater = curentuser.Id; data.Createtime = DateTime.Now; data.XdTime = data.Createtime; if (data.OrderType == "03" || data.OrderType == "07" || (data.OrderType == "02" && (data.OrderType1 == "代拟投诉书" || data.OrderType1 == "代拟质疑函"))) { if (cooperatecustomCustomerDTO != null && !string.IsNullOrEmpty(cooperatecustomCustomerDTO.HuiyuanId)) { string huiyuanurl = _configuration.GetSection("huiyuanurl").Value; string SetCaseOrder = _configuration.GetSection("SetCaseOrder").Value; Uri postUrl2 = new Uri(huiyuanurl + SetCaseOrder); JObject questions2 = new JObject(); questions2.Add("UserID", cooperatecustomCustomerDTO.HuiyuanId); if (data.OrderType == "03") { questions2.Add("CaseType", 0); } else if (data.OrderType == "07") { questions2.Add("CaseType", 1); } else if (data.OrderType == "07") { questions2.Add("CaseType", 1); } else if (data.OrderType == "02" && (data.OrderType1 == "代拟投诉书" || data.OrderType1 == "代拟质疑函")) { questions2.Add("CaseType", 2); } questions2.Add("count", Decimal.ToInt32(data.OrderNum.Value)); string requestJson2 = questions2.ToString(); string result2 = string.Empty; using (HttpContent httpContent = new StringContent(requestJson2)) { httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var httpClient2 = _clientFactory.CreateClient(); httpClient2.Timeout = new TimeSpan(0, 0, 10); var Result2 = await httpClient2.PostAsync(postUrl2, httpContent); result2 = Result2.Content.ReadAsStringAsync().Result; } _logger.LogInformation("result2:" + result2); JObject jobjectresult = (JObject)JsonConvert.DeserializeObject(result2); if (jobjectresult["code"] != null && jobjectresult["code"].ToString() == "1") { resultEntity.Result = true; } else { resultEntity.Result = false; resultEntity.Message = "写入会员订单失败"; return new JsonResult(resultEntity); } } } } using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = TransactionManager.MaximumTimeout } )) { if (youhui) { var youHuiDTOs = _askService.GetAskYouHuiList(data.Khdw, data.OrderType).FirstOrDefault(); if (youHuiDTOs != null) { data.Youhuier = youHuiDTOs.Id; if (youHuiDTOs.Youhuistandard == "01") { data.Youhui = youHuiDTOs.YouHui.Value; if (data.Money.Value < data.Youhui.Value) { data.Money = 0; } else { data.Money = data.Money.Value - data.Youhui.Value; } } else if (youHuiDTOs.Youhuistandard == "02") { if (youHuiDTOs.YouHui.Value >= 100) { data.Youhui = data.Money.Value; data.Money = 0; } else { data.Youhui = Math.Round(data.Money.Value * youHuiDTOs.YouHui.Value * new decimal(0.01), 2); data.Money = data.Money.Value - data.Youhui.Value; } } } } data.ShouliStatus = "1"; data.Modifier = curentuser.Id; data.Modifytime = DateTime.Now; zhengcaioa/zhengcaioa/Startup.cs
@@ -74,6 +74,10 @@ services.AddDbContext<zcwebContext>(options => options.UseSqlServer(connectionString1)); var connectionString2 = Configuration.GetConnectionString("zcUserInfoNConnection"); services.AddDbContext<zcUserInfoN_dbContext>(options => options.UseSqlServer(connectionString2)); services.AddControllersWithViews(); services.AddScoped(typeof(ISimService), typeof(SimService)); zhengcaioa/zhengcaioa/appsettings.Development.json
@@ -1,7 +1,8 @@ { "ConnectionStrings": { "DefaultConnection": "server=.;database=zhengcaioa;uid=sa;pwd=123456;", "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;" "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;", "zcUserInfoNConnection": "server=localhost;database=zcUserInfoN_db;uid=sa;pwd=123456;" }, "Logging": { "LogLevel": { zhengcaioa/zhengcaioa/appsettings.json
@@ -1,7 +1,8 @@ { "ConnectionStrings": { "DefaultConnection": "server=localhost;database=zhengcaioa;uid=sa;pwd=123456;", "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;" "zcwebConnection": "server=localhost;database=zcweb;uid=sa;pwd=123456;", "zcUserInfoNConnection": "server=localhost;database=zcUserInfoN_db;uid=sa;pwd=123456;" }, "Logging": { "LogLevel": {