diff --git a/Docs/网闸需求反馈表_WSY_20190318.xlsx b/Docs/网闸需求反馈表_WSY_20190318.xlsx
new file mode 100644
index 0000000..70ec301
Binary files /dev/null and b/Docs/网闸需求反馈表_WSY_20190318.xlsx differ
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs b/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs
index b5b5ab7..dd421d3 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs
+++ b/WebSiteCode/Cmdjy/Cmdjy/Bll/DesHelper.cs
@@ -2,9 +2,54 @@
using System.IO;
using System.Security.Cryptography;
using System.Text;
+using System.Web.Mvc;
+using Cmdjy.Dal;
+using System.Linq;
namespace Cmdjy.Bll
{
+ ///
+ /// 标记Action需要对输出进行加密
+ ///
+ [AttributeUsage(AttributeTargets.Method,AllowMultiple = false,Inherited = false)]
+ [Obsolete("未完成",true)]
+ public class DesAttribute:ActionFilterAttribute, IResultFilter
+ {
+ public Lazy Db { get; set; }
+
+ // var acceptEncoding = filterContext.HttpContext.Request.Headers["Accept-Encoding"];
+ // if(string.IsNullOrEmpty(acceptEncoding)) return;
+ // var response = filterContext.HttpContext.Response;
+ // if(response.Filter == null) return;
+
+ // acceptEncoding = acceptEncoding.ToLower();
+ // if(acceptEncoding.Contains("gzip")) {
+ // response.AppendHeader("Content-encoding", "gzip");
+ // response.Filter = new GZipStream(response.Filter,CompressionMode.Compress);
+ // }
+ // else if(acceptEncoding.Contains("deflate")) {
+ // response.AppendHeader("Content-encoding", "deflate");
+ // response.Filter = new DeflateStream(response.Filter,CompressionMode.Compress);
+ //}
+
+ public override void OnResultExecuting(ResultExecutingContext filterContext) {
+ //var disableDes = filterContext.HttpContext.Request.Form.HasKey ?? false;
+ var request = filterContext.HttpContext.Request;
+ var db = this.Db.Value;
+ var companyCode = request["CompanyCode"];
+ var icompanycode = 0;
+ if(!int.TryParse(companyCode,out var iicc)) {
+
+ }
+ var conpanyQu = db.CompanyInfos.Where(m => m.Id == iicc);
+ var response = filterContext.HttpContext.Response;
+ base.OnResultExecuting(filterContext);
+ }
+ public override void OnResultExecuted(ResultExecutedContext filterContext) {
+ base.OnResultExecuted(filterContext);
+ }
+ }
+
///
/// 加密帮助类
///
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj
index 3c5f8cd..2fe6ced 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj
+++ b/WebSiteCode/Cmdjy/Cmdjy/Cmdjy.csproj
@@ -48,6 +48,9 @@
..\packages\Autofac.4.9.2\lib\net45\Autofac.dll
+
+ ..\packages\Autofac.Mvc5.4.0.2\lib\net45\Autofac.Integration.Mvc.dll
+
..\packages\CommonClass.Factory.1.2.0.8\lib\net45\CommonClass.Factory.dll
@@ -194,6 +197,7 @@
+
@@ -213,6 +217,7 @@
Global.asax
+
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css b/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css
index cb85799..6429134 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css
+++ b/WebSiteCode/Cmdjy/Cmdjy/Content/Site.css
@@ -3,26 +3,6 @@
padding-bottom: 20px;
}
-/* Set padding to keep content from hitting the edges */
-.body-content {
- padding-left: 15px;
- padding-right: 15px;
-}
-
-/* Override the default bootstrap behavior where horizontal description lists
- will truncate terms that are too long to fit in the left column
-*/
-.dl-horizontal dt {
- white-space: normal;
-}
-
-/* Set width on the form input elements since they're 100% wide by default */
-input,
-select,
-textarea {
- max-width: 280px;
-}
-
table {
border: 1px solid #000;
}
@@ -43,10 +23,10 @@ table {
/*工具条*/
.toolBar {
list-style: none;
- padding:0px;
+ padding: 0px;
}
.toolBar li {
display: inline-block;
- padding:3px 5px;
+ padding: 3px 5px;
}
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Controllers/ControllerBase.cs b/WebSiteCode/Cmdjy/Cmdjy/Controllers/ControllerBase.cs
new file mode 100644
index 0000000..060adda
--- /dev/null
+++ b/WebSiteCode/Cmdjy/Cmdjy/Controllers/ControllerBase.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Web.Mvc;
+using System.Web.Routing;
+using Newtonsoft.Json;
+
+namespace Cmdjy.Controllers
+{
+ public class ControllerBase:Controller
+ {
+ protected override JsonResult Json(object data,string contentType,Encoding contentEncoding) {
+ return Json(data,contentType,contentEncoding,JsonRequestBehavior.DenyGet);
+ }
+
+ protected override JsonResult Json(object data,string contentType,Encoding contentEncoding,JsonRequestBehavior behavior) {
+ return new MyJsonResult {
+ Data = data,
+ ContentType = contentType,
+ ContentEncoding = contentEncoding,
+ JsonRequestBehavior = behavior
+ };
+ }
+ }
+
+ public class MyJsonResult:JsonResult
+ {
+ public override void ExecuteResult(ControllerContext context) {
+ if(context == null) {
+ throw new ArgumentNullException("context");
+ }
+ if(JsonRequestBehavior == JsonRequestBehavior.DenyGet &&
+ String.Equals(context.HttpContext.Request.HttpMethod,"GET",StringComparison.OrdinalIgnoreCase)) {
+ throw new InvalidOperationException("GetNotAllowed");
+ }
+
+ HttpResponseBase response = context.HttpContext.Response;
+
+ if(!String.IsNullOrEmpty(ContentType)) {
+ response.ContentType = ContentType;
+ }
+ else {
+ response.ContentType = "application/json";
+ }
+ if(ContentEncoding != null) {
+ response.ContentEncoding = ContentEncoding;
+ }
+ if(Data != null) {
+ response.Write(JsonConvert.SerializeObject(Data));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Controllers/HomeController.cs b/WebSiteCode/Cmdjy/Cmdjy/Controllers/HomeController.cs
index b5830de..63b3a6f 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Controllers/HomeController.cs
+++ b/WebSiteCode/Cmdjy/Cmdjy/Controllers/HomeController.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Web.Mvc;
+using System.Web.Mvc;
namespace Cmdjy.Controllers
{
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Controllers/WsdInterfaceController.cs b/WebSiteCode/Cmdjy/Cmdjy/Controllers/WsdInterfaceController.cs
index 5fdda5e..d1abab0 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Controllers/WsdInterfaceController.cs
+++ b/WebSiteCode/Cmdjy/Cmdjy/Controllers/WsdInterfaceController.cs
@@ -1,30 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Web;
using System.Web.Mvc;
-using WsdInterfaceModels;
-using Cmdjy.Dal;
-using Cmdjy.Dal.Tables;
using Cmdjy.Bll;
-using Newtonsoft.Json;
+using Cmdjy.Dal;
using CommonHelper;
+using Newtonsoft.Json;
+using WsdInterfaceModels;
namespace Cmdjy.Controllers
{
- public class WsdInterfaceController:Controller
+ public class WsdInterfaceController:ControllerBase
{
public Lazy Db { get; set; }
public ActionResult Index() {
var model = new WsdRequest {
StartNo = "0",MaxCount = "10",
- CompanyCode="1", CompanyName= "万仕达",
+ CompanyCode = "1",CompanyName = "万仕达",
};
return PartialView(model);
}
- public ActionResult GetData(WsdRequest info) {
+ public ActionResult GetData(WsdRequest info,string noDes,string needNull) {
var result = new WsdResult {
Code = EnumCode.Success,
};
@@ -70,13 +68,14 @@ namespace Cmdjy.Controllers
//存缓存
if(one != null) cache.SetData(pkey,one);
}
- //对应代煎药厂商
- if(one == null) {
+ if(needNull != null && one == null) {
one = new WsdPrescriptionInfo {
Type = WsdPrescriptionType.NullOrder,Id = i,
};
}
- result.Prescriptions.Add(one);
+ if(one != null) {
+ result.Prescriptions.Add(one);
+ }
}
result.Code = EnumCode.Success;
result.Count = result.Prescriptions.Where(m => m.Type != WsdPrescriptionType.NullOrder).Count();
@@ -84,11 +83,11 @@ namespace Cmdjy.Controllers
result.More = db.PrescriptionInfos.Max(m => m.Id) > (start + count);
}
//编码:json串 + 加密信息
+ //return Json(result);
var resStr = JsonConvert.SerializeObject(result);
- return Content(resStr);
- //var mw = DesHelper.GetHelper().Encrypty(cKey,resStr);
- //logWsdRequest(info,result,resStr,mw);
- //return mw;
+ var mw = noDes == null ? DesHelper.GetHelper().Encrypty(cKey,resStr) : resStr;
+ logWsdRequest(info,result,resStr,mw);
+ return Content(mw);
}
///
/// 记录日志
@@ -130,6 +129,7 @@ namespace Cmdjy.Controllers
foreach(var item in qu) {
var od = new WsdDrugInfo();
od.CopyFrom(item);
+ od.PrescriptionId = item.PrescriptionId.ToString();
result.Add(od);
}
}
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Dal/DjyDbContext.cs b/WebSiteCode/Cmdjy/Cmdjy/Dal/DjyDbContext.cs
index 81f7687..f3c8e97 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Dal/DjyDbContext.cs
+++ b/WebSiteCode/Cmdjy/Cmdjy/Dal/DjyDbContext.cs
@@ -1,16 +1,13 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-using System.Data.Entity;
+using System.Data.Entity;
using Cmdjy.Dal.Tables;
+using CommonClass.Factory;
namespace Cmdjy.Dal
{
///
/// 崇明代煎药数据库
///
- public partial class DjyDbContext:DbContext
+ public partial class DjyDbContext:DbContext, IRegisterSelf
{
public DjyDbContext() : base("DjyDbContext") {
}
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs b/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs
index 65c9a72..cdb011f 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs
+++ b/WebSiteCode/Cmdjy/Cmdjy/Global.asax.cs
@@ -2,6 +2,7 @@
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
+using Autofac.Integration.Mvc;
using Cmdjy.Dal;
namespace Cmdjy
@@ -9,6 +10,9 @@ namespace Cmdjy
public class MvcApplication:System.Web.HttpApplication
{
protected void Application_Start() {
+
+ DependencyResolver.SetResolver(new AutofacDependencyResolver(IOC.Factory));
+
if(WebSettings.AutoMigrations) {
Database.SetInitializer(new MigrateDatabaseToLatestVersion());
}
diff --git a/WebSiteCode/Cmdjy/Cmdjy/IOCFactory.cs b/WebSiteCode/Cmdjy/Cmdjy/IOCFactory.cs
new file mode 100644
index 0000000..fb1d314
--- /dev/null
+++ b/WebSiteCode/Cmdjy/Cmdjy/IOCFactory.cs
@@ -0,0 +1,37 @@
+using Autofac;
+using Autofac.Integration.Mvc;
+using CommonClass.Factory;
+
+namespace Cmdjy
+{
+ ///
+ /// IOC框架
+ ///
+ public class IOC
+ {
+ private static IOCFactory _iocFactory = null;
+ private static object _objLock = new object();
+ ///
+ /// 控制反转容器工厂
+ ///
+ public static ILifetimeScope Factory {
+ get {
+ if(_iocFactory == null) {
+ lock(_objLock) {
+ if(_iocFactory == null) {
+ _iocFactory = new IOCFactory();
+ _iocFactory.BeforeBuild += _iocFactory_BeforeBuild;
+ _iocFactory.Init();
+ }
+ }
+ }
+ return _iocFactory.Container.BeginLifetimeScope();
+ }
+ }
+
+ private static void _iocFactory_BeforeBuild(IOCFactory arg1,ContainerBuilder arg2) {
+ arg2.RegisterControllers(typeof(IOC).Assembly).PropertiesAutowired();
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/Home/Index.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/Home/Index.cshtml
index 1b5b0da..dec3d66 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Views/Home/Index.cshtml
+++ b/WebSiteCode/Cmdjy/Cmdjy/Views/Home/Index.cshtml
@@ -1,6 +1,7 @@
代煎药平台
+ - 版本1.0
- @Ajax.ActionLink("厂商列表","Index","Company",new AjaxOptions { UpdateTargetId = "main" })
- @Ajax.ActionLink("医疗机构处方列表","Index","HisInfo",new AjaxOptions { UpdateTargetId = "main" })
- @Ajax.ActionLink("万仕达下载测试","Index","WsdInterface",new AjaxOptions { UpdateTargetId = "main" })
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Views/WsdInterface/Index.cshtml b/WebSiteCode/Cmdjy/Cmdjy/Views/WsdInterface/Index.cshtml
index abbf679..b9f0140 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Views/WsdInterface/Index.cshtml
+++ b/WebSiteCode/Cmdjy/Cmdjy/Views/WsdInterface/Index.cshtml
@@ -1,21 +1,35 @@
@model WsdInterfaceModels.WsdRequest
+
+
-
+
\ No newline at end of file
diff --git a/WebSiteCode/Cmdjy/Cmdjy/Web.config b/WebSiteCode/Cmdjy/Cmdjy/Web.config
index a26bd82..7124276 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/Web.config
+++ b/WebSiteCode/Cmdjy/Cmdjy/Web.config
@@ -20,7 +20,7 @@
-
+
@@ -66,7 +66,7 @@
-
+
diff --git a/WebSiteCode/Cmdjy/Cmdjy/packages.config b/WebSiteCode/Cmdjy/Cmdjy/packages.config
index de8ec17..19f3b25 100644
--- a/WebSiteCode/Cmdjy/Cmdjy/packages.config
+++ b/WebSiteCode/Cmdjy/Cmdjy/packages.config
@@ -2,6 +2,7 @@
+
diff --git a/WebSiteCode/Cmdjy/CmdjyTests/Bll/DesHelperTests.cs b/WebSiteCode/Cmdjy/CmdjyTests/Bll/DesHelperTests.cs
index 8ac9e7b..f8de950 100644
--- a/WebSiteCode/Cmdjy/CmdjyTests/Bll/DesHelperTests.cs
+++ b/WebSiteCode/Cmdjy/CmdjyTests/Bll/DesHelperTests.cs
@@ -10,9 +10,9 @@ namespace Cmdjy.Bll.Tests
{
[TestMethod()]
public void EncryptyTest() {
- byte[] IV = { 0x01,0x02,0x03,0x14,0x05,0x06,0x17,0x08 };
- string key = "12365478";
- var des = DesHelper.GetHelper(PaddingMode.PKCS7,CipherMode.CBC,IV);
+ //byte[] IV = { 0x01,0x02,0x03,0x14,0x05,0x06,0x17,0x08 };
+ string key = "wscdy19;";
+ var des = DesHelper.GetHelper();
Console.WriteLine($"Key:{key}");
string mingwen = getMingWen();
Console.WriteLine($"明文:{mingwen}");
@@ -20,13 +20,13 @@ namespace Cmdjy.Bll.Tests
Console.WriteLine($"密文:{miwen}");
var miwen2 = des.Encrypty(key,mingwen);
Console.WriteLine($"密文2:{miwen2}");
- Assert.AreEqual(miwen,miwen2);
+ Assert.AreEqual(miwen,miwen2,"多次加密密文应该相同");
var mingwen2 = des.DesCrypty(key,miwen);
- Assert.AreEqual(mingwen,mingwen2);
+ Assert.AreEqual(mingwen,mingwen2,"明文和密文相同");
}
public string getMingWen() {
- string str = "abcdefghijklmnopqrstuvwxyz1234567890,./*-+";
+ string str = "abcdefghijklmnopqrstuvwxyz1234567890,./*-+{}[],.;\"";
var result = new StringBuilder();
int len = 100;
var rean = new Random();
@@ -36,5 +36,9 @@ namespace Cmdjy.Bll.Tests
}
return result.ToString();
}
+
+ public string Realstr() {
+ return @"";
+ }
}
}
\ No newline at end of file
diff --git a/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj b/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj
index baab2e4..1f17410 100644
--- a/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj
+++ b/WebSiteCode/Cmdjy/CmdjyTests/CmdjyTests.csproj
@@ -36,6 +36,7 @@
4
+
..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
diff --git a/WebSiteCode/Cmdjy/CmdjyTests/app.config b/WebSiteCode/Cmdjy/CmdjyTests/app.config
index 07016e7..052db28 100644
--- a/WebSiteCode/Cmdjy/CmdjyTests/app.config
+++ b/WebSiteCode/Cmdjy/CmdjyTests/app.config
@@ -29,6 +29,10 @@
+
+
+
+
diff --git a/WebSiteCode/Cmdjy/CommonHelper/ObjExtend.cs b/WebSiteCode/Cmdjy/CommonHelper/ObjExtend.cs
index 9553056..e17b0a1 100644
--- a/WebSiteCode/Cmdjy/CommonHelper/ObjExtend.cs
+++ b/WebSiteCode/Cmdjy/CommonHelper/ObjExtend.cs
@@ -4,22 +4,6 @@
public static class ObjExtend
{
- ///
- /// 从目标对象中复制属性的值,执行浅表复制
- ///
- /// 复制目标
- /// 复制原
- public static void CopyFrom(this object t,object s) {
- foreach(var p in s.GetType().GetProperties()) {
- if(p.CanRead) {
- var tp = t.GetType().GetProperty(p.Name);
- if(tp != null && tp.CanWrite && canConvert(p.PropertyType,tp.PropertyType)) {
- tp.SetValue(t,p.GetValue(s));
- //tp.SetValue(t,Convert.ChangeType(p.GetValue(s),tp.PropertyType));
- }
- }
- }
- }
///
/// 从目标对象中复制属性的值,执行浅表复制
///
@@ -28,7 +12,14 @@
/// 复制原
///
public static T CopyFrom(this T t,object s) where T : class {
- CopyFrom(t,s);
+ foreach(var p in s.GetType().GetProperties()) {
+ if(p.CanRead) {
+ var tp = t.GetType().GetProperty(p.Name);
+ if(tp != null && tp.CanWrite && canConvert(p.PropertyType,tp.PropertyType)) {
+ tp.SetValue(t,p.GetValue(s));
+ }
+ }
+ }
return t as T;
}
///