|
|
@@ -25,6 +25,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
public ToChargeByStageController(IHttpContextAccessor accessor, ILogger<BaseController> logger, IOptions<Setting> setting) : base(accessor, logger, setting)
|
|
|
{
|
|
|
+ OtherMySqlConn.connstr = ConfigurationManager.AppSettings["SqlConnStr"].ToString();
|
|
|
}
|
|
|
|
|
|
#region 分期扣款信息列表
|
|
|
@@ -37,8 +38,8 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
@@ -50,24 +51,54 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
/// 分期扣款信息列表
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public JsonResult IndexData(ToChargeByStage data, int? sUserId, int? eUserId, int page = 1, int limit = 30)
|
|
|
+ public JsonResult IndexData(ToChargeByStage data, string MakerCode, string StatusSelect, string CreateDateData, int page = 1, int limit = 30)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
-
|
|
|
- Fields.Add("sUserId", "31"); //创客上限
|
|
|
-Fields.Add("eUserId", "32"); //创客下限
|
|
|
-Fields.Add("CreateDate", "3"); //时间
|
|
|
|
|
|
+ Fields.Add("SeoTitle", "1"); //创客姓名
|
|
|
|
|
|
string condition = " and Status>-1";
|
|
|
-
|
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("ToChargeByStage", Fields, "Id desc", "0", page, limit, condition);
|
|
|
+ //创客编号
|
|
|
+ if (!string.IsNullOrEmpty(MakerCode))
|
|
|
+ {
|
|
|
+ var userForMakerCode = db.UserForMakerCode.FirstOrDefault(m => m.MakerCode == MakerCode) ?? new UserForMakerCode();
|
|
|
+ condition += " and UserId=" + userForMakerCode.UserId;
|
|
|
+ }
|
|
|
+
|
|
|
+ //状态
|
|
|
+ if (!string.IsNullOrEmpty(StatusSelect))
|
|
|
+ {
|
|
|
+ if (StatusSelect == "0")//待处理
|
|
|
+ {
|
|
|
+ condition += " and QueryCount<TimeNumber and QueryCount=0 and Status=0";
|
|
|
+ }
|
|
|
+ if (StatusSelect == "1")//已扣款
|
|
|
+ {
|
|
|
+ condition += " and QueryCount=TimeNumber and Status=1";
|
|
|
+ }
|
|
|
+ if (StatusSelect == "2")//扣款中
|
|
|
+ {
|
|
|
+ condition += " and QueryCount<TimeNumber and QueryCount>0 and Status=0";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //创建时间
|
|
|
+ if (!string.IsNullOrEmpty(CreateDateData))
|
|
|
+ {
|
|
|
+ string[] datelist = CreateDateData.Split(new string[] { " - " }, StringSplitOptions.None);
|
|
|
+ string start = datelist[0];
|
|
|
+ string end = datelist[1];
|
|
|
+ condition += " and CreateDate>='" + start + " 00:00:00' and CreateDate<='" + end + " 23:59:59'";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ToChargeByStage", Fields, "Id desc", "0", page, limit, condition);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
return Json(obj);
|
|
|
}
|
|
|
@@ -84,7 +115,7 @@ Fields.Add("CreateDate", "3"); //时间
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return View();
|
|
|
}
|
|
|
@@ -101,21 +132,21 @@ Fields.Add("CreateDate", "3"); //时间
|
|
|
public string Add(ToChargeByStage data)
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
-
|
|
|
+
|
|
|
Fields.Add("UserId", data.UserId); //创客
|
|
|
-Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
|
|
|
-Fields.Add("Remark", data.Remark); //备注
|
|
|
-Fields.Add("StartDate", data.StartDate); //扣款开始时间
|
|
|
-Fields.Add("TimeNumber", data.TimeNumber); //期数
|
|
|
-Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
+ Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
|
|
|
+ Fields.Add("Remark", data.Remark); //备注
|
|
|
+ Fields.Add("StartDate", data.StartDate); //扣款开始时间
|
|
|
+ Fields.Add("TimeNumber", data.TimeNumber); //期数
|
|
|
+ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
|
|
|
Fields.Add("SeoTitle", data.SeoTitle);
|
|
|
Fields.Add("SeoKeyword", data.SeoKeyword);
|
|
|
Fields.Add("SeoDescription", data.SeoDescription);
|
|
|
- int Id = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Add("ToChargeByStage", Fields, 0);
|
|
|
+ int Id = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Add("ToChargeByStage", Fields, 0);
|
|
|
AddSysLog(data.Id.ToString(), "ToChargeByStage", "add");
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -131,7 +162,7 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
{
|
|
|
ViewBag.RightInfo = RightInfo;
|
|
|
ViewBag.right = right;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
ToChargeByStage editData = db.ToChargeByStage.FirstOrDefault(m => m.Id == Id) ?? new ToChargeByStage();
|
|
|
ViewBag.data = editData;
|
|
|
@@ -150,21 +181,21 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
public string Edit(ToChargeByStage data)
|
|
|
{
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
-
|
|
|
+
|
|
|
Fields.Add("UserId", data.UserId); //创客
|
|
|
-Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
|
|
|
-Fields.Add("Remark", data.Remark); //备注
|
|
|
-Fields.Add("StartDate", data.StartDate); //扣款开始时间
|
|
|
-Fields.Add("TimeNumber", data.TimeNumber); //期数
|
|
|
-Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
+ Fields.Add("ChargeAmount", data.ChargeAmount); //待扣金额
|
|
|
+ Fields.Add("Remark", data.Remark); //备注
|
|
|
+ Fields.Add("StartDate", data.StartDate); //扣款开始时间
|
|
|
+ Fields.Add("TimeNumber", data.TimeNumber); //期数
|
|
|
+ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
|
|
|
Fields.Add("SeoTitle", data.SeoTitle);
|
|
|
Fields.Add("SeoKeyword", data.SeoKeyword);
|
|
|
Fields.Add("SeoDescription", data.SeoDescription);
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("ToChargeByStage", Fields, data.Id);
|
|
|
- AddSysLog(data.Id.ToString(),"ToChargeByStage","update");
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, data.Id);
|
|
|
+ AddSysLog(data.Id.ToString(), "ToChargeByStage", "update");
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -179,16 +210,16 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
public string Delete(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"ToChargeByStage","del");
|
|
|
+ AddSysLog(Id, "ToChargeByStage", "del");
|
|
|
foreach (string subid in idlist)
|
|
|
{
|
|
|
int id = int.Parse(subid);
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
Fields.Add("Status", -1);
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("ToChargeByStage", Fields, id);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
-
|
|
|
+
|
|
|
return "success";
|
|
|
}
|
|
|
|
|
|
@@ -203,13 +234,13 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
public string Open(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"ToChargeByStage","open");
|
|
|
+ AddSysLog(Id, "ToChargeByStage", "open");
|
|
|
foreach (string subid in idlist)
|
|
|
{
|
|
|
int id = int.Parse(subid);
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
Fields.Add("Status", 1);
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("ToChargeByStage", Fields, id);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
return "success";
|
|
|
@@ -226,13 +257,13 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
public string Close(string Id)
|
|
|
{
|
|
|
string[] idlist = Id.Split(new char[] { ',' });
|
|
|
- AddSysLog(Id,"ToChargeByStage","close");
|
|
|
+ AddSysLog(Id, "ToChargeByStage", "close");
|
|
|
foreach (string subid in idlist)
|
|
|
{
|
|
|
int id = int.Parse(subid);
|
|
|
Dictionary<string, object> Fields = new Dictionary<string, object>();
|
|
|
Fields.Add("Status", 0);
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Edit("ToChargeByStage", Fields, id);
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Edit("ToChargeByStage", Fields, id);
|
|
|
}
|
|
|
db.SaveChanges();
|
|
|
return "success";
|
|
|
@@ -247,8 +278,8 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
/// <param name="Id"></param>
|
|
|
public string Sort(int Id, int Sort)
|
|
|
{
|
|
|
- new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).Sort("ToChargeByStage", Sort, Id);
|
|
|
-
|
|
|
+ new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).Sort("ToChargeByStage", Sort, Id);
|
|
|
+
|
|
|
AddSysLog(Id.ToString(), "ToChargeByStage", "sort");
|
|
|
return "success";
|
|
|
}
|
|
|
@@ -263,26 +294,26 @@ Fields.Add("TotalAmount", data.TotalAmount); //扣款总金额
|
|
|
{
|
|
|
ExcelData = HttpUtility.UrlDecode(ExcelData);
|
|
|
JsonData list = JsonMapper.ToObject(ExcelData);
|
|
|
- for (int i = 1; i < list.Count;i++ )
|
|
|
+ for (int i = 1; i < list.Count; i++)
|
|
|
{
|
|
|
JsonData dr = list[i];
|
|
|
int UserId = int.Parse(dr["创客"].ToString());
|
|
|
-decimal ChargeAmount = decimal.Parse(dr["待扣金额"].ToString());
|
|
|
-string Remark = dr["备注"].ToString();
|
|
|
-DateTime StartDate = DateTime.Parse(dr["扣款开始时间"].ToString());
|
|
|
-int TimeNumber = int.Parse(dr["期数"].ToString());
|
|
|
-decimal TotalAmount = decimal.Parse(dr["扣款总金额"].ToString());
|
|
|
+ decimal ChargeAmount = decimal.Parse(dr["待扣金额"].ToString());
|
|
|
+ string Remark = dr["备注"].ToString();
|
|
|
+ DateTime StartDate = DateTime.Parse(dr["扣款开始时间"].ToString());
|
|
|
+ int TimeNumber = int.Parse(dr["期数"].ToString());
|
|
|
+ decimal TotalAmount = decimal.Parse(dr["扣款总金额"].ToString());
|
|
|
|
|
|
db.ToChargeByStage.Add(new ToChargeByStage()
|
|
|
{
|
|
|
CreateDate = DateTime.Now,
|
|
|
UpdateDate = DateTime.Now,
|
|
|
UserId = UserId, //创客
|
|
|
-ChargeAmount = ChargeAmount, //待扣金额
|
|
|
-Remark = Remark, //备注
|
|
|
-StartDate = StartDate, //扣款开始时间
|
|
|
-TimeNumber = TimeNumber, //期数
|
|
|
-TotalAmount = TotalAmount, //扣款总金额
|
|
|
+ ChargeAmount = ChargeAmount, //待扣金额
|
|
|
+ Remark = Remark, //备注
|
|
|
+ StartDate = StartDate, //扣款开始时间
|
|
|
+ TimeNumber = TimeNumber, //期数
|
|
|
+ TotalAmount = TotalAmount, //扣款总金额
|
|
|
|
|
|
});
|
|
|
db.SaveChanges();
|
|
|
@@ -302,18 +333,18 @@ TotalAmount = TotalAmount, //扣款总金额
|
|
|
{
|
|
|
Dictionary<string, string> Fields = new Dictionary<string, string>();
|
|
|
Fields.Add("sUserId", "31"); //创客上限
|
|
|
-Fields.Add("eUserId", "32"); //创客下限
|
|
|
-Fields.Add("CreateDate", "3"); //时间
|
|
|
+ Fields.Add("eUserId", "32"); //创客下限
|
|
|
+ Fields.Add("CreateDate", "3"); //时间
|
|
|
|
|
|
|
|
|
string condition = " and Status>-1";
|
|
|
-
|
|
|
|
|
|
- Dictionary<string, object> obj = new AdminContent(_accessor.HttpContext, SystemPublicFuction.dbtables).IndexData("ToChargeByStage", Fields, "Id desc", "0", 1, 20000, condition, "", false);
|
|
|
+
|
|
|
+ Dictionary<string, object> obj = new AdminContentOther(_accessor.HttpContext, PublicFunction.MainTables).IndexData("ToChargeByStage", Fields, "Id desc", "0", 1, 20000, condition, "", false);
|
|
|
List<Dictionary<string, object>> diclist = obj["data"] as List<Dictionary<string, object>>;
|
|
|
foreach (Dictionary<string, object> dic in diclist)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
Dictionary<string, object> result = new Dictionary<string, object>();
|
|
|
@@ -321,7 +352,7 @@ Fields.Add("CreateDate", "3"); //时间
|
|
|
result.Add("Info", "Excel报表-" + DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss") + ".xlsx");
|
|
|
result.Add("Obj", diclist);
|
|
|
Dictionary<string, object> ReturnFields = new Dictionary<string, object>();
|
|
|
-
|
|
|
+
|
|
|
result.Add("Fields", ReturnFields);
|
|
|
AddSysLog("0", "ToChargeByStage", "ExportExcel");
|
|
|
return Json(result);
|