@@ -0,0 +1,72 @@ | |||
数字化智慧校园 | |||
统一身份认证oauth2.0 | |||
对接说明 | |||
V1.0 | |||
概述 | |||
由于各学校存在N套系统,各系统都存在自己独立的用户登录验证,给使用者造成了许多重复操作,也容易造成帐户密码混乱及丢失的情况。为了低成本的解决以上问题,我公司特开发了基于原系统验证方式、无需统一使用用户库的解决方案。 | |||
对接方当前所使用的用户验证体系无需更改,仅需增加数据解密部分代码。 | |||
实现逻辑 | |||
标准oauth2.0认证。 | |||
统一身份认证工作机制说明 | |||
第一步,各对接方在数字化智慧校园系统中配置统一身份认证的登录接口地址 | |||
我方提供配置UI | |||
外网测试地址: | |||
http://demo.bjquanjiang.com:8081/ 测试用户名:thirdtest密码:123456 | |||
学校内网地址: | |||
依照学校实际地址 | |||
系统登录 | |||
应用添加 | |||
应用配置 | |||
权限配置 | |||
查看个人应用 | |||
点击【进入系统】访问 | |||
跳转页面如下图 | |||
至此,统一应用端配置完毕。 | |||
第二步 获取授权码(authorization code) | |||
采用标准Http Get请求方式,code有效期为10分钟 | |||
请求地址:http://demo.bjquanjiang.com:8081/SSOSystem/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code | |||
参数说明 | |||
参数 | |||
是否必须 | |||
说明 | |||
appid | |||
是 | |||
应用唯一标识 | |||
redirect_uri | |||
是 | |||
获取授权码成功后重定向到的地址 | |||
请使用urlEncode对链接进行处理 | |||
response_type | |||
是 | |||
填code | |||
获取到code后,授权系统会重定向到redirect_uri地址并携带code参数,例如: | |||
http://demo.bjquanjiang.com:8081/Login/CheckLoginForSSO20?code=CODE | |||
第三步:通过code获取access_token | |||
通过code获取access_token | |||
示例代码仅供参考: | |||
C# | |||
@@ -407,6 +407,31 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取实体,通过用户名 | |||
/// </summary> | |||
/// <param name="account">用户账号</param> | |||
/// <returns></returns> | |||
public UserEntity GetEntityByName(string name) | |||
{ | |||
try | |||
{ | |||
UserEntity userEntity; | |||
userEntity = userService.GetEntityByName(name); | |||
return userEntity; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void UpdateIp(string ip, string id) | |||
{ | |||
@@ -76,6 +76,12 @@ namespace Learun.Application.Organization | |||
/// <returns></returns> | |||
UserEntity GetEntityByAccount(string account); | |||
/// <summary> | |||
/// 获取实体,通过用户名 | |||
/// </summary> | |||
/// <param name="account">用户账号</param> | |||
/// <returns></returns> | |||
UserEntity GetEntityByName(string account); | |||
/// <summary> | |||
/// 获取用户数据 | |||
/// </summary> | |||
/// <param name="userId">用户主键</param> | |||
@@ -55,6 +55,30 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
/// <summary> | |||
/// 获取实体,通过用户账号 | |||
/// </summary> | |||
/// <param name="account">用户账号</param> | |||
/// <returns></returns> | |||
public UserEntity GetEntityByName(string name) | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository() | |||
.FindEntity<UserEntity>(a => a.F_RealName.Equals(name) && a.F_DeleteMark == 0); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 用户列表(根据公司主键) | |||
/// </summary> | |||
/// <param name="companyId">公司主键</param> | |||
@@ -81,7 +105,7 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
} | |||
internal bool GetStuAny() | |||
internal bool GetStuAny() | |||
{ | |||
try | |||
{ | |||
@@ -557,7 +581,7 @@ namespace Learun.Application.Organization | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindList<UserEntity>(a=>a.F_DepartmentId==departmentId).ToList(); | |||
return this.BaseRepository().FindList<UserEntity>(a => a.F_DepartmentId == departmentId).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -576,7 +600,7 @@ namespace Learun.Application.Organization | |||
try | |||
{ | |||
var ids = departmentId.Split(','); | |||
return this.BaseRepository().FindList<UserEntity>(a=> ids.Contains(a.F_DepartmentId)).ToList(); | |||
return this.BaseRepository().FindList<UserEntity>(a => ids.Contains(a.F_DepartmentId)).ToList(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -590,7 +614,7 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
} | |||
/// <summary> | |||
@@ -798,14 +822,14 @@ namespace Learun.Application.Organization | |||
string path = ""; | |||
try | |||
{ | |||
var userentity=BaseRepository().FindEntity<UserEntity>("select a.*,b.Photo from LR_Base_User a " + | |||
"left join "+BaseRepository("CollegeMIS").getDbConnection().Database+ | |||
".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='"+userid+"'", null); | |||
if (userentity!=null&&!string.IsNullOrEmpty(userentity.Photo)) | |||
var userentity = BaseRepository().FindEntity<UserEntity>("select a.*,b.Photo from LR_Base_User a " + | |||
"left join " + BaseRepository("CollegeMIS").getDbConnection().Database + | |||
".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='" + userid + "'", null); | |||
if (userentity != null && !string.IsNullOrEmpty(userentity.Photo)) | |||
{ | |||
//获取图片 | |||
var LR_Base_AnnexesFile = BaseRepository().FindEntity<dynamic>("select * from LR_Base_AnnexesFile where F_FolderId='"+ userentity.Photo + "'", null); | |||
if (LR_Base_AnnexesFile!=null) | |||
var LR_Base_AnnexesFile = BaseRepository().FindEntity<dynamic>("select * from LR_Base_AnnexesFile where F_FolderId='" + userentity.Photo + "'", null); | |||
if (LR_Base_AnnexesFile != null) | |||
{ | |||
path = LR_Base_AnnexesFile.F_FilePath; | |||
} | |||
@@ -226,6 +226,36 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers | |||
return Fail("导入数据失败!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 工资导入 | |||
/// </summary> | |||
/// <param name="templateId">模板Id</param> | |||
/// <param name="fileId">文件主键</param> | |||
/// <param name="chunks">分片数</param> | |||
/// <param name="ext">文件扩展名</param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
public ActionResult ExecuteImportSaralExcel(string fileId, int chunks,string ext) | |||
{ | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo); | |||
if (!string.IsNullOrEmpty(path)) | |||
{ | |||
DataTable dt = ExcelHelper.ExcelImport(path); | |||
string res = excelImportIBLL.ImportSalaryInfo(dt,fileId); | |||
var data = new | |||
{ | |||
Success = res.Split('|')[0], | |||
Fail = res.Split('|')[1] | |||
}; | |||
return JsonResult(data); | |||
} | |||
else | |||
{ | |||
return Fail("导入数据失败!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 下载文件(导入文件未被导入的数据) | |||
@@ -24,6 +24,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
else { | |||
moduleId = item.id; | |||
page.search(); | |||
} | |||
$('#titleinfo').text(item.text); | |||
} | |||
@@ -19,6 +19,10 @@ | |||
<div class="lr-form-item-title">登录接口地址<font face="宋体">*</font></div> | |||
<input id="FInterfaceUrl" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Perm_Function" style="display: none;" id="divFId"> | |||
<div class="lr-form-item-title">appid</div> | |||
<input id="FId" type="text" class="form-control" disabled="disabled" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="Perm_Function"> | |||
<div class="lr-form-item-title">应用私钥<font face="宋体">*</font></div> | |||
<input id="FSecret" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" /> | |||
@@ -43,6 +43,7 @@ var bootstrap = function ($, learun) { | |||
$('[data-table="' + id + '"]').lrSetFormData(data[id]); | |||
} | |||
} | |||
$("#divFId").css("display","block"); | |||
}); | |||
} | |||
} | |||
@@ -4,6 +4,7 @@ using System.Data; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
using System.Web.Mvc; | |||
using System.Collections.Generic; | |||
using System.Drawing; | |||
using System.Linq; | |||
namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
@@ -42,6 +43,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 工资导入 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult ImportForm() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 表单页 | |||
/// <summary> | |||
/// <returns></returns> | |||
@@ -256,5 +266,47 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
} | |||
#endregion | |||
#region 获取模板 | |||
/// <summary> | |||
/// 下载工资导入模板 | |||
/// </summary> | |||
[HttpPost] | |||
[ValidateAntiForgeryToken] | |||
public void DownTemplate() | |||
{ | |||
//设置导出格式 | |||
ExcelConfig excelConfig=new ExcelConfig(); | |||
excelConfig.FileName = "工资导入模板.xls"; | |||
excelConfig.IsAllSizeColumn = true; | |||
excelConfig.ColumnEntity=new List<ColumnModel>(); | |||
//获取工资列 | |||
var itemList = sal_UserSalaryIBLL.GetAllTemplateInfo(); | |||
//表头 | |||
DataTable dt=new DataTable(); | |||
excelConfig.ColumnEntity.Add(new ColumnModel() | |||
{ | |||
Column = "姓名", | |||
ExcelColumn = "姓名", | |||
Alignment = "center", | |||
Background = new Color() | |||
}); | |||
dt.Columns.Add("姓名", typeof(string)); | |||
foreach (var item in itemList) | |||
{ | |||
excelConfig.ColumnEntity.Add(new ColumnModel() | |||
{ | |||
Column = item.STIName, | |||
ExcelColumn = item.STIName, | |||
Alignment = "center", | |||
Background = new Color() | |||
}); | |||
dt.Columns.Add(item.STIName, typeof(string)); | |||
} | |||
ExcelHelper.ExcelDownload(dt, excelConfig); | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
@{ | |||
ViewBag.Title = "Form"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<link href="~/Content/webuploader/webuploader.css" rel="stylesheet" /> | |||
<script src="~/Content/webuploader/webuploader.nolog.min.js"></script> | |||
@Html.AppendCssFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css") | |||
<div class="lr-form-layout lr-form-layout-top-bottom"> | |||
<div class="lr-form-layout-header"> | |||
<div id="lr_add_file_btn"><i class="fa fa-cloud-upload"></i><span class="lrlt">上传文件</span></div> | |||
<div class="webuploader-pick" id="lr_down_file_btn"><i class="fa fa-download"></i><span class="lrlt">下载模板</span></div> | |||
</div> | |||
<div class="lr-form-layout-body"> | |||
<div class="lr-form-file-queue-wrap" id="lr_form_file_queue"> | |||
<div class="lr-form-file-queue" id="lr_form_file_queue_list"> | |||
</div> | |||
<div class="lr-form-file-queue-bg"> | |||
<h1><span class="lrlt">试试将电脑里的文件拖拽到此上传</span></h1> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js") |
@@ -0,0 +1,136 @@ | |||
.lr-form-layout-body { | |||
padding:0 5px 5px 5px; | |||
} | |||
.lr-form-file-queue-wrap { | |||
position:relative; | |||
width:100%; | |||
height:100%; | |||
border:1px solid #ddd; | |||
border-radius:4px; | |||
} | |||
.lr-form-file-queue { | |||
position:relative; | |||
} | |||
.lr-form-file-queue { | |||
position:relative; | |||
} | |||
.lr-form-file-queue-item { | |||
position:relative; | |||
width:100%; | |||
height:50px; | |||
border-bottom:1px solid #ddd; | |||
padding-left:60px; | |||
} | |||
.lr-file-image { | |||
position:absolute; | |||
top:5px; | |||
left:5px; | |||
} | |||
.lr-file-image img { | |||
width:40px; | |||
height:40px; | |||
} | |||
.lr-file-name{ | |||
line-height:50px; | |||
} | |||
.lr-msg { | |||
position:absolute; | |||
top:0; | |||
right:5px; | |||
font-size: 25px; | |||
line-height:50px; | |||
} | |||
.lr-msg .fa-check-circle{ | |||
color: #5cb85c; | |||
} | |||
.lr-msg .fa-exclamation-circle { | |||
color: #b94a48; | |||
} | |||
.lr-msg2 { | |||
position:absolute; | |||
top:0; | |||
right:5px; | |||
line-height:50px; | |||
} | |||
.lr-msg2 span { | |||
color:#333; | |||
font-size:14px; | |||
margin-right:5px; | |||
} | |||
.lr-tool-bar { | |||
position:absolute; | |||
top:0; | |||
right:35px; | |||
font-size: 25px; | |||
line-height:50px; | |||
color:#666; | |||
cursor:pointer; | |||
} | |||
.lr-tool-bar > i { | |||
margin-left:8px; | |||
} | |||
.lr-tool-bar .fa-minus-circle { | |||
color: #b94a48; | |||
} | |||
.lr-tool-bar .fa-cloud-download { | |||
color: #3498db; | |||
} | |||
.lr-uploader-progress { | |||
position:absolute; | |||
bottom:2px; | |||
left:60px; | |||
height:4px; | |||
width:500px; | |||
width:calc(100% - 90px); | |||
} | |||
.lr-uploader-progress-bar { | |||
position:relative; | |||
height:100%; | |||
background-color:#039cfd; | |||
border-radius:4px; | |||
} | |||
.lr-form-file-queue-bg { | |||
position:absolute; | |||
top:50%; | |||
left:50%; | |||
width:300px; | |||
height:30px; | |||
line-height:30px; | |||
margin:-15px 0 0 -150px; | |||
} | |||
.lr-form-file-queue-bg h1 { | |||
color: #666; | |||
font-size: 20px; | |||
font-family: Microsoft Yahei; | |||
padding-bottom: 2px; | |||
margin: 0; | |||
} | |||
#lr_down_file_btn { | |||
position:absolute; | |||
right:5px; | |||
background:#fff; | |||
border:1px solid #ddd; | |||
color:#333; | |||
} | |||
#lr_down_file_btn:hover { | |||
color:#337ab7; | |||
} | |||
/*对百度插件的样式重写*/ | |||
.webuploader-container { | |||
position:absolute; | |||
} | |||
.webuploader-pick { | |||
padding:8px 15px; | |||
background-color:#039cfd; | |||
} | |||
.webuploader-pick-hover { | |||
background-color:#027dcb; | |||
} |
@@ -0,0 +1,242 @@ | |||
/* | |||
* 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) | |||
* Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
* 创建人:陈彬彬 | |||
* 日 期:2017.04.11 | |||
* 描 述:导入Excel | |||
*/ | |||
var id = request('id'); | |||
var keyVaule = ''; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var page1 = { | |||
init: function () { | |||
page.bind(); | |||
page.initData(); | |||
}, | |||
bind: function () { | |||
$('#lr_add_format').on('click', function () { | |||
currentColRow = null; | |||
learun.layerForm({ | |||
id: 'FormatForm', | |||
title: '添加', | |||
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', | |||
width: 450, | |||
height: 310, | |||
callBack: function (id) { | |||
return top[id].acceptClick(function (data) { | |||
$('#gridtable').jfGridSet('addRow', { row: data }); | |||
}); | |||
} | |||
}); | |||
}); | |||
$('#lr_edit_format').on('click', function () { | |||
currentColRow = $('#gridtable').jfGridGet('rowdata'); | |||
var _id = currentColRow ? currentColRow.itemTypeName : ''; | |||
if (learun.checkrow(_id)) { | |||
learun.layerForm({ | |||
id: 'FormatForm', | |||
title: '修改', | |||
url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', | |||
width: 450, | |||
height: 310, | |||
callBack: function (id) { | |||
return top[id].acceptClick(function (data) { | |||
$('#gridtable').jfGridSet('updateRow', { row: data }); | |||
}); | |||
} | |||
}); | |||
} | |||
}); | |||
$('#lr_delete_format').on('click', function () { | |||
currentColRow = null; | |||
var row = $('#gridtable').jfGridGet('rowdata'); | |||
var _id = row ? row.itemTypeName : ''; | |||
if (learun.checkrow(_id)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res, index) { | |||
if (res) { | |||
$('#gridtable').jfGridSet('removeRow'); | |||
top.layer.close(index); //再执行关闭 | |||
} | |||
}); | |||
} | |||
}); | |||
$('#gridtable').jfGrid({ | |||
headData: [ | |||
{ label: "前缀", name: "itemTypeName", width: 120, align: "left" }, | |||
{ label: "格式", name: "formatStr", width: 120, align: "left" }, | |||
{ label: "步长", name: "stepValue", width: 100, align: "left" }, | |||
{ label: "初始值", name: "initValue", width: 120, align: "left" }, | |||
{ label: "说明", name: "description", width: 180, align: "left" } | |||
] | |||
}); | |||
/*检测重复项*/ | |||
$('#F_EnCode').on('blur', function () { | |||
$.lrExistField(keyValue, 'F_EnCode', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistEnCode'); | |||
}); | |||
$('#F_FullName').on('blur', function () { | |||
$.lrExistField(keyValue, 'F_FullName', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistFullName'); | |||
}); | |||
}, | |||
initData: function () { | |||
if (!!selectedRow) { | |||
keyValue = selectedRow.F_RuleId; | |||
$('#form').lrSetFormData(selectedRow); | |||
var formatdata = JSON.parse(selectedRow.F_RuleFormatJson); | |||
$('#gridtable').jfGridSet('refreshdata', formatdata); | |||
} | |||
} | |||
}; | |||
var fileInfo = {}; | |||
// 触发合并文件碎片 | |||
var mergeFileChunks = function (file) { | |||
var param = {}; | |||
param['__RequestVerificationToken'] = $.lrToken; | |||
param['fileId'] = fileInfo[file.id].fileGuid; | |||
param['chunks'] = fileInfo[file.id].chunks; | |||
param['ext'] = file.ext; | |||
param['templateId'] = id; | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/ExecuteImportSaralExcel", param, function (res) { | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.find('.lr-uploader-progress').remove(); | |||
if (res.code == learun.httpCode.success) { | |||
if (res.data.Success != '0') { | |||
learun.alert.success('导入成功' + res.data.Success + '条'); | |||
} | |||
// 文件保存成功后 | |||
$fileItem.append('<div class="lr-msg2"><span>' + res.data.Success + '</span><span>/</span><span style="color:#b94a48;" >' + res.data.Fail + '</span></div>'); | |||
// 如果有失败 | |||
if (res.data.Fail != '0') | |||
{ | |||
learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' }); | |||
} | |||
} | |||
else { | |||
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>'); | |||
} | |||
}); | |||
} | |||
// 触发清楚文件碎片 | |||
var reomveFileChunks = function (file) { | |||
var param = {}; | |||
param['__RequestVerificationToken'] = $.lrToken; | |||
param['fileGuid'] = fileInfo[file.id].fileGuid; | |||
param['chunks'] = fileInfo[file.id].chunks; | |||
learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { }); | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.find('.lr-uploader-progress').remove(); | |||
$fileItem.append('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>'); | |||
} | |||
var page = { | |||
uploader: null, | |||
init: function () { | |||
/*模板下载*/ | |||
$('#lr_down_file_btn').on('click', function () { | |||
learun.download({ url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); | |||
}); | |||
if (!WebUploader.Uploader.support()) { | |||
alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); | |||
throw new Error('WebUploader does not support the browser you are using.'); | |||
} | |||
page.uploader = WebUploader.create({ | |||
auto: true, | |||
swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf', | |||
// 文件接收服务端。 | |||
server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk", | |||
// 选择文件的按钮。可选。 | |||
// 内部根据当前运行是创建,可能是input元素,也可能是flash. | |||
pick: '#lr_add_file_btn', | |||
dnd: '#lr_form_file_queue', | |||
paste: 'document.body', | |||
disableGlobalDnd: true, | |||
accept: { | |||
extensions: "xls,xlsx" | |||
}, | |||
multiple: true, | |||
// 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传! | |||
resize: false, | |||
// 文件分片上传 | |||
chunked: true, | |||
chunkRetry: 3, | |||
prepareNextFile: true, | |||
chunkSize: '1048576', | |||
// 上传参数 | |||
formData: { | |||
__RequestVerificationToken: $.lrToken | |||
} | |||
}); | |||
page.uploader.on('fileQueued', page.fileQueued); | |||
page.uploader.on('uploadStart', page.uploadStart); | |||
page.uploader.on('uploadBeforeSend', page.uploadBeforeSend); | |||
page.uploader.on('uploadProgress', page.uploadProgress); | |||
page.uploader.on('uploadSuccess', page.uploadSuccess); | |||
page.uploader.on('uploadError', page.uploadError); | |||
page.uploader.on('uploadComplete', page.uploadComplete); | |||
page.uploader.on('error', page.error); | |||
$('#lr_form_file_queue').lrscroll(); | |||
}, | |||
fileQueued: function (file) {// 文件加载到队列 | |||
fileInfo[file.id] = { name: file.name }; | |||
$('#lr_form_file_queue .lr-form-file-queue-bg').hide(); | |||
// 添加一条文件记录 | |||
var $item = $('<div class="lr-form-file-queue-item" id="lr_filequeue_' + file.id + '" ></div>'); | |||
$item.append('<div class="lr-file-image"><img src="' + top.$.rootUrl + '/Content/images/filetype/' + file.ext + '.png"></div>'); | |||
$item.append('<span class="lr-file-name">' + file.name + '(' + learun.countFileSize(file.size) + ')</span>'); | |||
$('#lr_form_file_queue_list').append($item); | |||
}, | |||
uploadStart: function (file) { | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.append('<div class="lr-uploader-progress"><div class="lr-uploader-progress-bar" style="width:0%;"></div></div>'); | |||
}, | |||
uploadBeforeSend: function (object, data, headers) { | |||
data.chunk = data.chunk || 0; | |||
data.chunks = data.chunks || 1; | |||
fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid(); | |||
data.fileGuid = fileInfo[data.id].fileGuid; | |||
fileInfo[data.id].chunks = data.chunks; | |||
}, | |||
uploadProgress: function (file, percentage) { | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%')); | |||
}, | |||
uploadSuccess: function (file, res) { | |||
if (res.code == 200) {// 上传成功 | |||
mergeFileChunks(file); | |||
} | |||
else {// 上传失败 | |||
reomveFileChunks(file); | |||
} | |||
}, | |||
uploadError: function (file, code) { | |||
reomveFileChunks(file); | |||
}, | |||
uploadComplete: function (file) { | |||
}, | |||
error: function (type) { | |||
switch (type) { | |||
case 'Q_TYPE_DENIED': | |||
learun.alert.error('当前文件类型不允许上传'); | |||
break; | |||
}; | |||
} | |||
}; | |||
page.init(); | |||
} |
@@ -7,6 +7,19 @@ | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="multiple_condition_query"> | |||
<div class="lr-query-formcontent"> | |||
<div class="col-xs-12 lr-form-item"> | |||
<div class="lr-form-item-title">单位组织</div> | |||
<div id="F_UserId"></div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
@@ -17,6 +30,7 @@ | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 查看</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
<a id="lr_import" class="btn btn-default"><i class="fa fa-trash-o"></i> 导入</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -7,12 +7,48 @@ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var startTime; | |||
var endTime; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
// 时间搜索框 | |||
$('#datesearch').lrdate({ | |||
dfdata: [ | |||
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } | |||
], | |||
// 月 | |||
mShow: false, | |||
premShow: false, | |||
// 季度 | |||
jShow: false, | |||
prejShow: false, | |||
// 年 | |||
ysShow: false, | |||
yxShow: false, | |||
preyShow: false, | |||
yShow: false, | |||
// 默认 | |||
dfvalue: '1', | |||
selectfn: function (begin, end) { | |||
startTime = begin; | |||
endTime = end; | |||
page.search(); | |||
} | |||
}); | |||
$('#multiple_condition_query').lrMultipleQuery(function (queryJson) { | |||
page.search(queryJson); | |||
}, 220, 400); | |||
$('#F_UserId').lrUserSelect(0); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -46,6 +82,18 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
$('#lr_import').on('click',function() { | |||
learun.layerForm({ | |||
id: 'form', | |||
title: '导入', | |||
url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/ImportForm', | |||
width: 400, | |||
height: 300, | |||
callBack: function (id) { | |||
return top[id].acceptClick(refreshGirdData); | |||
} | |||
}); | |||
}) | |||
//查看 | |||
$('#lr_view').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('USId'); | |||
@@ -87,7 +135,7 @@ var bootstrap = function ($, learun) { | |||
{ | |||
label: "人员", name: "F_UserId", width: 100, align: "left", | |||
formatterAsync: function (callback, value, row, op, $cell) { | |||
learun.clientdata.getAsync('user', { | |||
learun.clientdata.getAsyncReal('user', { | |||
key: value, | |||
callback: function (_data) { | |||
callback(_data.name); | |||
@@ -7,6 +7,10 @@ | |||
<div class="lr-layout-wrap lr-layout-wrap-notitle "> | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch"></div> | |||
</div> | |||
</div> | |||
<div class="lr-layout-tool-right"> | |||
<div class=" btn-group btn-group-sm"> | |||
@@ -7,12 +7,42 @@ | |||
var refreshGirdData; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var startTime; | |||
var endTime; | |||
var page = { | |||
init: function () { | |||
page.initGird(); | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
// 时间搜索框 | |||
$('#datesearch').lrdate({ | |||
dfdata: [ | |||
{ name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, | |||
{ name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } | |||
], | |||
// 月 | |||
mShow: false, | |||
premShow: false, | |||
// 季度 | |||
jShow: false, | |||
prejShow: false, | |||
// 年 | |||
ysShow: false, | |||
yxShow: false, | |||
preyShow: false, | |||
yShow: false, | |||
// 默认 | |||
dfvalue: '1', | |||
selectfn: function (begin, end) { | |||
startTime = begin; | |||
endTime = end; | |||
page.search(); | |||
} | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
location.reload(); | |||
@@ -15,6 +15,7 @@ using Learun.Application.TwoDevelopment.LogisticsManagement; | |||
using System.Linq; | |||
using Learun.Application.OA; | |||
using Learun.Application.TwoDevelopment.LR_Desktop; | |||
using Learun.Application.TwoDevelopment.Permission; | |||
using Learun.Application.WorkFlow; | |||
namespace Learun.Application.Web.Controllers | |||
@@ -54,6 +55,7 @@ namespace Learun.Application.Web.Controllers | |||
private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL(); | |||
private Sys_UpdateRecordIBLL sys_UpdateRecordIBLL = new Sys_UpdateRecordBLL(); | |||
private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL(); | |||
#region 视图功能 | |||
public ActionResult ChangePwd() | |||
@@ -61,11 +63,34 @@ namespace Learun.Application.Web.Controllers | |||
return View(); | |||
} | |||
#region 统一身份认证2.0 | |||
public ActionResult SSOApplication() | |||
{ | |||
var userinfo = LoginUserInfo.Get(); | |||
ViewBag.FunctionList = perm_FunctionIBLL.GetListByUserId(userinfo.userId); | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 跳转网站 | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult GoToApplication() | |||
{ | |||
string redi = Request.QueryString["redi"]; | |||
if (!string.IsNullOrEmpty(redi)) | |||
{ | |||
var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(Request.QueryString["appid"]); | |||
if (perm_application != null) | |||
{ | |||
return Redirect(perm_application.FInterfaceUrl); | |||
} | |||
else | |||
return RedirectToAction("Index"); | |||
} | |||
return View(); | |||
} | |||
#endregion | |||
public ActionResult NeedToDoForm() | |||
{ | |||
var userinfo = LoginUserInfo.Get(); | |||
@@ -35,6 +35,50 @@ namespace Learun.Application.Web.Controllers | |||
private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL(); | |||
private Perm_FunctionVisitIBLL functionVisitIbll = new Perm_FunctionVisitBLL(); | |||
#region 统一身份认证2.0 | |||
/// <summary> | |||
/// 请求code | |||
/// </summary> | |||
/// <returns></returns> | |||
public ActionResult authorize() | |||
{ | |||
string appid = Request.QueryString["appid"]; | |||
string redirect_uri = Request.QueryString["redirect_uri"]; | |||
string response_type = Request.QueryString["response_type"]; | |||
if (string.IsNullOrEmpty(appid)) | |||
{ | |||
return Fail("参数:appid不能为空"); | |||
} | |||
if (string.IsNullOrEmpty(redirect_uri)) | |||
{ | |||
return Fail("参数:redirect_uri不能为空"); | |||
} | |||
if (string.IsNullOrEmpty(response_type)) | |||
{ | |||
return Fail("参数:response_type不能为空"); | |||
} | |||
if (response_type!="code") | |||
{ | |||
return Fail("参数:response_type必须为code"); | |||
} | |||
var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); | |||
if (application != null) | |||
{ | |||
if (application.FInterfaceUrl.Equals(redirect_uri)) | |||
{ | |||
var code = appid + Util.CommonHelper.RndNum(9); | |||
return Success(""); | |||
} | |||
else | |||
{ | |||
return Fail("未授权的redirect_uri"); | |||
} | |||
} | |||
else | |||
return Fail("未授权的appid"); | |||
} | |||
#endregion | |||
public ActionResult Index() | |||
{ | |||
string account = ""; | |||
@@ -1323,6 +1323,8 @@ | |||
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormRemove.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormTerminate.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\ContractManagement\FormRenew.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.css" /> | |||
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\StuSaverecord\IndexForStudent.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\StuSaverecord\IndexForTeacher.js" /> | |||
<Content Include="Areas\StudentWork\Views\SW_Ask_Main\AnswerIndex.js" /> | |||
@@ -6836,6 +6838,7 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\StuInfoFresh\StatisticClassIndex.cshtml" /> | |||
<Content Include="Areas\LR_Desktop\Views\WeChatDevelop\Form.cshtml" /> | |||
<Content Include="Areas\LR_Desktop\Views\WeChatDevelop\Index.cshtml" /> | |||
<Content Include="Areas\PersonnelManagement\Views\Sal_UserSalary\ImportForm.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile1.pubxml" /> | |||
@@ -6905,6 +6908,7 @@ | |||
<Content Include="Views\Login\PageThreeWxLogin.cshtml" /> | |||
<Content Include="Views\Login\PageTwoWxLogin.cshtml" /> | |||
<Content Include="Views\Home\SSOApplication.cshtml" /> | |||
<Content Include="Views\Home\GoToApplication.cshtml" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<WCFMetadata Include="Connected Services\" /> | |||
@@ -0,0 +1,34 @@ | |||
@{ | |||
Layout = null; | |||
} | |||
<!DOCTYPE html> | |||
<html> | |||
<head> | |||
<meta name="viewport" content="width=device-width" /> | |||
<title>统一身份认证平台</title> | |||
<script src="~/Content/jquery/jquery-1.10.2.min.js"></script> | |||
<script> | |||
function request(d) { for (var c = location.search.slice(1).split("&"), a = 0; a < c.length; a++) { var b = c[a].split("="); if (b[0] == d) if ("undefined" == unescape(b[1])) break; else return unescape(b[1]) } return "" }; | |||
</script> | |||
<script type="text/javascript"> | |||
$(function () { | |||
setTimeout(function () { | |||
location.href = '/Home/GoToApplication?redi=1&appid=' + request('appid'); | |||
}, 1000); | |||
}); | |||
</script> | |||
</head> | |||
<body> | |||
<div style="width: 100%; text-align: center;"> | |||
<div style="margin-top: 10%;"> | |||
<img src="~/Content/sso/fx.png" /> | |||
</div> | |||
<div style="color: #959595; font-size: 14px; padding-top: 40px;">IDENTITY AUTHENTICATION</div> | |||
<div style="text-align:center;font-size:26px; line-height:40px; padding-bottom:25px; color:#3d3d3d;">统一身份认证平台</div> | |||
<div style="text-align:center; font-size:15px; color:#fe7511;">系统认证中,请耐心等待...</div> | |||
</div> | |||
</body> | |||
</html> |
@@ -1,4 +1,5 @@ | |||
@{ | |||
@using Learun.Application.TwoDevelopment.Permission | |||
@{ | |||
ViewBag.Title = "title"; | |||
Layout = "~/Views/Shared/_Index.cshtml"; | |||
} | |||
@@ -131,13 +132,15 @@ | |||
</style> | |||
<div class="lr-desktop-panel lr-scroll-wrap" style="overflow: auto;"> | |||
<div class="nav"> | |||
<div class="navClo6"> | |||
<div class="navBox navMoreBox" id="0f7a71fe-a95d-47a6-b8b3-854862a36225" style="background: #8564D8; border-color: #8564D8;"> | |||
<div class="navT"><i class="fa fa-caret-square-o-down lr-menu-item-icon"></i><span>地区管理</span></div> | |||
<div class="navMore" style="color: #8564D8">进入系统 <i class="fa fa-caret-right"></i></div> | |||
@foreach (Perm_FunctionEntity permFunctionEntity in ViewBag.FunctionList) | |||
{ | |||
<div class="navClo6"> | |||
<div class="navBox navMoreBox" id="0f7a71fe-a95d-47a6-b8b3-854862a36225" style="background: #8564D8; border-color: #8564D8;"> | |||
<div class="navT"><i class="fa fa-caret-square-o-down lr-menu-item-icon"></i><span>@permFunctionEntity.FName</span></div> | |||
<div class="navMore" style="color: #8564D8"><a href="/Home/GoToApplication?appid=@permFunctionEntity.FId" target="_blank">进入系统</a> <i class="fa fa-caret-right"></i></div> | |||
</div> | |||
</div> | |||
</div> | |||
} | |||
</div> | |||
</div> | |||
@@ -99,6 +99,10 @@ | |||
}, | |||
update: function (name) { | |||
clientAsyncData[name].update && clientAsyncData[name].update(); | |||
}, | |||
getAsyncReal:function(name, op) { | |||
clientAsyncData[name].states = 1; | |||
return clientAsyncData[name].get(op); | |||
} | |||
}; | |||
@@ -9,16 +9,16 @@ | |||
<add name="CollegeMIS" connectionString="Server=192.168.2.126;Initial Catalog=CollegeMIS;User ID=sa;Password=bjqj@2015!" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=192.168.2.126;Initial Catalog=Hangfire;User ID=sa;Password=bjqj@2015!" providerName="System.Data.SqlClient" />--> | |||
<!--西昌--> | |||
<!--<add name="BaseDb" connectionString="Server=112.45.152.8;Initial Catalog=adms7ultimate2;User ID=sa;Password=qj@2018" providerName="System.Data.SqlClient" /> | |||
<add name="BaseDb" connectionString="Server=112.45.152.8;Initial Catalog=adms7ultimate2;User ID=sa;Password=qj@2018" providerName="System.Data.SqlClient" /> | |||
<add name="CollegeMIS" connectionString="Server=112.45.152.8;Initial Catalog=NewCollegeMIS;User ID=sa;Password=qj@2018" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=112.45.152.8;Initial Catalog=HangFire;User ID=sa;Password=qj@2018" providerName="System.Data.SqlClient" />--> | |||
<add name="hangfireString" connectionString="Server=112.45.152.8;Initial Catalog=HangFire;User ID=sa;Password=qj@2018" providerName="System.Data.SqlClient" /> | |||
<!--demo.quanjiang.com--> | |||
<!--<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=123.57.209.16;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />--> | |||
<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<!--<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS_西昌;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=123.57.209.16;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="hangfireString" connectionString="Server=123.57.209.16;Initial Catalog=Hangfire;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" />--> | |||
<!--<add name="BaseDb" connectionString="Server=123.57.209.16;Initial Catalog=adms7ultimate2_20200403test;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
<add name="CollegeMIS" connectionString="Server=123.57.209.16;Initial Catalog=CollegeMIS_20200403test;User ID=sa;Password=bjqjkj@2014~2015!" providerName="System.Data.SqlClient" /> | |||
@@ -8,7 +8,9 @@ using System; | |||
using System.Collections.Generic; | |||
using System.Data; | |||
using System.Linq; | |||
using Learun.Application.Organization; | |||
using Learun.Application.TwoDevelopment.LogisticsManagement; | |||
using Learun.Application.TwoDevelopment.PersonnelManagement; | |||
namespace Learun.Application.Excel | |||
@@ -30,6 +32,9 @@ namespace Learun.Application.Excel | |||
private DataItemIBLL dataItemIBLL = new DataItemBLL(); | |||
private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL(); | |||
private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); | |||
private Sal_UserSalaryIBLL sal_UserSalaryIBLL = new Sal_UserSalaryBLL(); | |||
private Sal_UserSalaryItemIBLL sal_UserSalaryItemIBLL=new Sal_UserSalaryItemBLL(); | |||
private UserIBLL userIBLL = new UserBLL(); | |||
#region 缓存定义 | |||
private ICache cache = CacheFactory.CaChe(); | |||
@@ -668,6 +673,105 @@ namespace Learun.Application.Excel | |||
} | |||
// 写入缓存如果有未导入的数据 | |||
if (failDt.Rows.Count > 0) | |||
{ | |||
string errordt = failDt.ToJson(); | |||
cache.Write<string>(cacheKey + fileId, errordt, CacheId.excel); | |||
} | |||
return snum + "|" + fnum; | |||
} | |||
/// <summary> | |||
/// 导入工资条 | |||
/// </summary> | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <returns></returns> | |||
public string ImportSalaryInfo(DataTable dt, string fileId) | |||
{ | |||
int snum = 0; | |||
int fnum = 0; | |||
decimal stall = 0; | |||
decimal stactual = 0; | |||
// 创建一个datatable容器用于保存导入失败的数据 | |||
DataTable failDt = new DataTable(); | |||
dt.Columns.Add("导入错误", typeof(string)); | |||
foreach (DataColumn dc in dt.Columns) | |||
{ | |||
failDt.Columns.Add(dc.ColumnName, dc.DataType); | |||
} | |||
var data = accommodationIBLL.GetAllList().ToList(); | |||
//获取工资条列 | |||
var templateItemList = sal_UserSalaryIBLL.GetAllTemplateInfo(); | |||
foreach (DataRow dr in dt.Rows) | |||
{ | |||
try | |||
{ | |||
//录入工资条信息 | |||
Sal_UserSalaryEntity sal_UserSalaryEntity = new Sal_UserSalaryEntity(); | |||
sal_UserSalaryEntity.Create(); | |||
sal_UserSalaryEntity.F_UserId = userIBLL.GetEntityByName(dr["姓名"].ToString())?.F_UserId; | |||
sal_UserSalaryEntity.USDate = DateTime.Now; | |||
stall = 0;//重置应发合计 | |||
stactual = 0;//重置实发合计 | |||
foreach (var templateItem in templateItemList) | |||
{ | |||
var stiValue = Convert.ToDecimal(dr[templateItem.STIName].ToString()); | |||
//工资详细添加 | |||
Sal_UserSalaryItemEntity sal_UserSalaryItemEntity=new Sal_UserSalaryItemEntity | |||
{ | |||
USIId = Guid.NewGuid().ToString(), | |||
USId=sal_UserSalaryEntity.USId, | |||
STIId=templateItem.STIId, | |||
STIValue = Convert.ToDecimal(stiValue) | |||
}; | |||
sal_UserSalaryItemIBLL.SaveEntity("", sal_UserSalaryItemEntity); | |||
//计算应发合计和实发合计 | |||
if (templateItem.STIParticipation == "true") | |||
{ | |||
if (templateItem.STIAdd == "true") | |||
{ | |||
stactual += stiValue; | |||
} | |||
else | |||
{ | |||
stactual -= stiValue; | |||
} | |||
} | |||
if (templateItem.STIAdd == "true") | |||
{ | |||
stall += stiValue; | |||
} | |||
else | |||
{ | |||
stall -= stiValue; | |||
} | |||
} | |||
sal_UserSalaryEntity.STAll = stall; | |||
sal_UserSalaryEntity.STActual = stactual; | |||
sal_UserSalaryIBLL.SaveEntity("",sal_UserSalaryEntity); | |||
snum++; | |||
} | |||
catch (Exception e) | |||
{ | |||
dr["导入错误"] = dr["姓名"] + "导入错误"; | |||
fnum++; | |||
failDt.Rows.Add(dr.ItemArray); | |||
continue; | |||
} | |||
} | |||
// 写入缓存如果有未导入的数据 | |||
if (failDt.Rows.Count > 0) | |||
@@ -72,6 +72,7 @@ namespace Learun.Application.Excel | |||
/// <param name="dt">导入数据</param> | |||
/// <returns></returns> | |||
string ImportTable(string templateId, string fileId, DataTable dt); | |||
string ImportSalaryInfo(DataTable dt, string fileId); | |||
/// <summary> | |||
/// 获取excel导入的错误数据 | |||
/// </summary> | |||
@@ -80,6 +80,10 @@ | |||
<Compile Include="Properties\AssemblyInfo.cs" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\..\..\Learun.Application.Organization\Learun.Application.Organization.csproj"> | |||
<Project>{E9877A25-801B-4605-AD35-E6306916513C}</Project> | |||
<Name>Learun.Application.Organization</Name> | |||
</ProjectReference> | |||
<ProjectReference Include="..\..\Learun.Cache\Learun.Cache.Base\Learun.Cache.Base.csproj"> | |||
<Project>{975f2cb8-605c-4add-b365-b97bf844f0fe}</Project> | |||
<Name>Learun.Cache.Base</Name> | |||
@@ -817,7 +817,7 @@ WHERE (AcademicYearNo = '" + stringAcademicYear + "') and semester='" + string | |||
MajorNo = altitem.MajorNo, | |||
LessonNo = altitem.LessonNo, | |||
Grade = classData.FirstOrDefault(m => m.ClassNo == altitem.TeachClassNo)?.Grade, | |||
LessonSortNo = altitem.LessonSortNo, | |||
LessonSortNo ="1", | |||
TeachClassNo = altitem.TeachClassNo, | |||
EmpNo = altitem.EmpNo, | |||
F_SchoolId = altitem.F_SchoolId | |||
@@ -43,6 +43,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) | |||
{ | |||
dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); | |||
dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); | |||
strSql.Append(" AND ( t.USDate >= @startTime AND t.USDate <= @endTime ) "); | |||
} | |||
if (!queryParam["F_UserId"].IsEmpty()) | |||
{ | |||
dp.Add("F_UserId", queryParam["F_UserId"].ToString(), DbType.String); | |||