diff --git a/Untitled-1.php b/Untitled-1.php
new file mode 100644
index 0000000..a8e4d2b
--- /dev/null
+++ b/Untitled-1.php
@@ -0,0 +1,291 @@
+//查看未参加考试人员
+ public function looktakeexam(){
+ $param_ary=$this->request->param();
+ if(empty($param_ary['id'])) return '参数错误!不可访问';
+
+ $can_jia_people=examination::field('ex_id,ex_can_jia_people,ex_key,ex_range,ex_wsid,ex_wpid,ex_specified_range_us,ex_group')->where('ex_id',$param_ary['id'])->find();
+
+ $test_cj_peo=test_paper::distinct(true)->field('tp_u_key')->where(array('tp_exa_key'=>$can_jia_people['ex_key']))->select()->toArray();
+
+ if(!$can_jia_people) return '参数错误!不可访问';
+
+
+
+ // var_dump($can_jia_people);
+
+ $canJiaPeopleAry= array();
+ if(!empty($can_jia_people['ex_can_jia_people'])) $canJiaPeopleAry= json_decode($can_jia_people['ex_can_jia_people'],true);
+
+ if(!empty($test_cj_peo)){
+ $cj_ren=array();
+ foreach($test_cj_peo as $key=>$val){
+ $cj_ren[]=$val['tp_u_key'];
+ }
+ $canJiaPeopleAry=$cj_ren;
+ }
+ //划定考试人员
+ $hua_ding_user=array();
+ if(!empty($can_jia_people['ex_specified_range_us'])) $hua_ding_user= $this->get_user_key(explode(',',$can_jia_people['ex_specified_range_us']));
+
+ //划定人员分组
+ $hua_ding_fenzu=array();
+ if(!empty($hua_ding_user)){
+ foreach($hua_ding_user as $hdu_key => $hdu_val){
+ $hua_ding_fenzu[$this->get_workman_bf(array('wm_key'=>$hdu_val))][]=$hdu_val;
+ }
+ }
+ // $hebing_cjrs=array_merge($can_jia_people,$test_cj_peo);
+ // var_dump($canJiaPeopleAry);
+
+
+ $ret_data = array();
+ $ret_wei_data=array();
+
+ if($this->session_val['bf_id'] == 0){
+ // echo 1;
+ // echo "
";
+ $exam_bf_ary = explode(',',$can_jia_people['ex_range']);
+
+
+ if(count($exam_bf_ary) > 1){
+ // echo 2;
+ // var_dump($exam_bf_ary);
+ // echo "
";
+ foreach($exam_bf_ary as $bf_key => $bf_val){
+ $bf_name=branch_factory::field('bf_name')->where('bf_id',$bf_val)->find();
+ $ret_data['date_val'][]=$bf_name['bf_name'];
+ $wei_can_jia=array();
+ if(!empty($hua_ding_fenzu)){
+ foreach($hua_ding_fenzu[$bf_val] as $hdf_key => $hdf_val){
+
+ if(!in_array($hdf_val,$canJiaPeopleAry)){
+ $wei_can_jia[]=array(
+ 'wm_number' => select_worker_man(array('wm_key'=>$hdf_val),'wm_number'),
+ 'wmd_name' => select_worker_man_data(array('wmd_key'=>$hdf_val),'wmd_name'),
+ );
+ }
+ }
+ }else{
+ $user_ary=$this->get_people_cont($bf_val,$can_jia_people['ex_wsid'],$can_jia_people['ex_wpid']);
+ // $ret_wei_data=$user_ary;
+
+ if(!empty($user_ary)){
+ foreach($user_ary['us_key'] as $us_key => $us_val){
+ if(!in_array($us_val,$canJiaPeopleAry)){
+ // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ }
+ }
+ }
+ }
+
+
+ $ret_wei_data[]=array(
+ 'title'=>$bf_name['bf_name'],
+ 'datalist'=>$wei_can_jia
+ );
+ }
+ }else{
+ // echo 3;
+ // echo "
";
+ if($can_jia_people['ex_range'] != -1 && $can_jia_people['ex_range'] != -2 && $this->session_val['u_private'] != 2){
+ // echo 4;
+ // echo "
";
+ $bf_name=branch_factory::field('bf_name')->where('bf_id',$can_jia_people['ex_range'])->find();
+ $ret_data['date_val'][]=$bf_name['bf_name'];
+
+ $user_ary=$this->get_people_cont($can_jia_people['ex_range'],$can_jia_people['ex_wsid'],$can_jia_people['ex_wpid']);
+ // $ret_wei_data=$user_ary;
+ $wei_can_jia=array();
+ if(!empty($user_ary)){
+ foreach($user_ary['us_key'] as $us_key => $us_val){
+ if(!in_array($us_val,$canJiaPeopleAry)){
+ // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ }
+ }
+ }
+ $ret_wei_data[]=array(
+ 'title'=>$bf_name['bf_name'],
+ 'datalist'=>$wei_can_jia
+ );
+ // echo $can_jia_people['ex_range'].'====>'.$can_jia_people['ex_wsid'].'====>'.$can_jia_people['ex_wpid'].'====>'.$param_ary['id'];
+ }else{
+
+
+
+
+ // $list=test_paper::distinct(true)->field('tp_bf_id')->where(array('tp_exa_key'=>$can_jia_people['ex_key']))->where('tp_bf_id','<>',9)->select()->toArray();
+
+ // foreach($list as $key => $val){
+ // $bf_name=branch_factory::field('bf_name')->where('bf_id',$val['tp_bf_id'])->find();
+ // $ret_data['date_val'][]=$bf_name['bf_name'];
+
+ // $user_ary=$this->get_people_cont($val['tp_bf_id']);
+ // // $ret_wei_data=$user_ary;
+ // $wei_can_jia=array();
+ // if(!empty($user_ary)){
+ // foreach($user_ary['us_key'] as $us_key => $us_val){
+ // if(!in_array($us_val,$canJiaPeopleAry)){
+ // // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ // $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ // }
+ // }
+ // }
+ // $ret_wei_data[$key]=array(
+ // 'title'=>$bf_name['bf_name'],
+ // 'datalist'=>$wei_can_jia
+ // );
+
+
+ // }
+
+ //改版
+ // echo 5;
+ // echo "
";
+ $BF_wher=array(
+ ['bf_set','=',1],
+ ['bf_group','=',$can_jia_people['ex_group']]
+ );
+ $deparAry = branch_factory::field('bf_id,bf_name')->where($BF_wher)->select();
+ foreach($deparAry as $dep_key => $dep_val){
+ $ret_data['date_val'][]=$dep_val['bf_name'];
+
+ $user_ary=$this->get_people_cont($dep_val['bf_id']);
+
+ $wei_can_jia=array();
+ if(!empty($user_ary)){
+ foreach($user_ary['us_key'] as $us_key => $us_val){
+ if(!in_array($us_val,$canJiaPeopleAry)){
+ // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ }
+ }
+ }
+
+ $ret_wei_data[$dep_key]=array(
+ 'title'=>$dep_val['bf_name'],
+ 'datalist'=>$wei_can_jia
+ );
+ }
+
+
+
+
+ }
+ }
+
+
+ $ceyan = 1;
+ }else{
+ if($this->session_val['u_private'] == 2){
+ echo 6;
+ echo "
";
+ $list=test_paper::distinct(true)->field('tp_bf_id')->where(array('tp_exa_key'=>$can_jia_people['ex_key']))->where('tp_bf_id','<>',9)->select()->toArray();
+
+ foreach($list as $key => $val){
+ $bf_name=branch_factory::field('bf_name')->where('bf_id',$val['tp_bf_id'])->find();
+ $ret_data['date_val'][]=$bf_name['bf_name'];
+
+ // $user_ary=$this->get_people_cont($val['tp_bf_id']);
+ // // $ret_wei_data=$user_ary;
+ // $wei_can_jia=array();
+ // if(!empty($user_ary)){
+ // foreach($user_ary['us_key'] as $us_key => $us_val){
+ // if(!in_array($us_val,$canJiaPeopleAry)){
+ // // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ // $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ // }
+ // }
+ // }
+ // $ret_wei_data[$key]=array(
+ // 'title'=>$bf_name['bf_name'],
+ // 'datalist'=>$wei_can_jia
+ // );
+
+
+ $wei_can_jia=array();
+ if(!empty($hua_ding_fenzu)){
+ foreach($hua_ding_fenzu[$val['tp_bf_id']] as $hdf_key => $hdf_val){
+
+ if(!in_array($hdf_val,$canJiaPeopleAry)){
+ $wei_can_jia[]=array(
+ 'wm_number' => select_worker_man(array('wm_key'=>$hdf_val),'wm_number'),
+ 'wmd_name' => select_worker_man_data(array('wmd_key'=>$hdf_val),'wmd_name'),
+ );
+ }
+ }
+ }else{
+ $user_ary=$this->get_people_cont($val['tp_bf_id'],$can_jia_people['ex_wsid'],$can_jia_people['ex_wpid']);
+ // $ret_wei_data=$user_ary;
+
+ if(!empty($user_ary)){
+ foreach($user_ary['us_key'] as $us_key => $us_val){
+ if(!in_array($us_val,$canJiaPeopleAry)){
+ // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ }
+ }
+ }
+ }
+
+
+ $ret_wei_data[]=array(
+ 'title'=>$bf_name['bf_name'],
+ 'datalist'=>$wei_can_jia
+ );
+
+
+ }
+ $ceyan = 1;
+ }else{
+ echo 7;
+ echo "
";
+ $ws_array=work_shopsection::field('ws_id,ws_name')->where(array('ws_bf_id'=>$this->session_val['bf_id'],'ws_set'=>1))->select();
+
+ $us_kkk =array();
+
+ foreach($ws_array as $ws_key => $ws_val){
+ $ret_data['date_val'][]=$ws_val['ws_name'];
+
+ $user_ary=$this->get_people_cont($this->session_val['bf_id'],$ws_val['ws_id']);
+
+ $us_kkk[] = $user_ary;
+ $wei_can_jia=array();
+ if(!empty($user_ary)){
+ foreach($user_ary['us_key'] as $us_key => $us_val){
+ if(!in_array($us_val,$canJiaPeopleAry)){
+ // $ret_wei_data[$bf_name['bf_name']][]=$user_ary['us_list'][$us_val];
+ $wei_can_jia[]=$user_ary['us_list'][$us_val];
+ }
+ }
+ }
+
+ $ret_wei_data[$ws_key]=array(
+ 'title'=>$ws_val['ws_name'],
+ 'datalist'=>$wei_can_jia
+ );
+
+ // $sum_ping=$this->sum_fenshu_ws($ws_val['ws_id'],$param_ary['id']);
+
+ // $sum_fenshu[$ws_key]=$sum_ping['sum_val'];
+ // $ping_junfen[$ws_key]=$sum_ping['ping'];
+ // $he_ge_lv[$ws_key]=$this->he_ge_lv_ws($ws_val['ws_id'],$param_ary['id']);
+ }
+ $ceyan = 2;
+
+ // var_dump($us_kkk);
+ }
+
+
+
+ }
+
+ // var_dump($ret_data);
+ // return $this->jsonecho(array($ret_data,$ret_wei_data),1,'数据读取成功!');
+ // return $this->jsonecho($ret_wei_data,1,'数据读取成功!');
+ View::assign('ex_id',$param_ary['id']);
+ View::assign('list',$ret_wei_data);
+ return View::fetch();
+
+ }
\ No newline at end of file
diff --git a/gin_server_admin/api/index/assessment/assesshandle.go b/gin_server_admin/api/index/assessment/assesshandle.go
index cd36a8c..928caa4 100644
--- a/gin_server_admin/api/index/assessment/assesshandle.go
+++ b/gin_server_admin/api/index/assessment/assesshandle.go
@@ -2,9 +2,7 @@ package assessment
import (
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
- "github.com/flipped-aurora/gin-vue-admin/server/global"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
- "github.com/flipped-aurora/gin-vue-admin/server/model/testpage"
"github.com/gin-gonic/gin"
)
@@ -28,6 +26,6 @@ func (a *Assessment) MyAssEssMentList(c *gin.Context) {
if requestData.Page <= 0 {
requestData.Page = 1
}
- offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
- gormDb := global.GVA_DB_Master.Model(&testpage.WorkMan{})
+ // offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+ // gormDb := global.GVA_DB_Master.Model(&testpage.WorkMan{})
}
diff --git a/gin_server_admin/api/index/assessment/assesstype.go b/gin_server_admin/api/index/assessment/assesstype.go
new file mode 100644
index 0000000..6e01ddf
--- /dev/null
+++ b/gin_server_admin/api/index/assessment/assesstype.go
@@ -0,0 +1,12 @@
+package assessment
+
+import "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+
+//考核
+type Assessment struct{}
+
+//列表参数
+type getAssEssList struct {
+ commonus.PageSetLimt
+ BranchFactoryId int `json:"branchFactoryId"`
+}
diff --git a/gin_server_admin/api/index/assessment/enter.go b/gin_server_admin/api/index/assessment/enter.go
new file mode 100644
index 0000000..6b12ce9
--- /dev/null
+++ b/gin_server_admin/api/index/assessment/enter.go
@@ -0,0 +1,5 @@
+package assessment
+
+type ApiGroup struct {
+ Assessment
+}
diff --git a/gin_server_admin/api/index/enter.go b/gin_server_admin/api/index/enter.go
new file mode 100644
index 0000000..78b947f
--- /dev/null
+++ b/gin_server_admin/api/index/enter.go
@@ -0,0 +1,9 @@
+package index
+
+import "github.com/flipped-aurora/gin-vue-admin/server/api/index/assessment"
+
+type ApiGroup struct {
+ AssessMentApi assessment.ApiGroup
+}
+
+var ApiGroupApp = new(ApiGroup)
diff --git a/gin_server_admin/api/v1/assessment/assesshandle.go b/gin_server_admin/api/v1/assessment/assesshandle.go
new file mode 100644
index 0000000..602f190
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/assesshandle.go
@@ -0,0 +1,268 @@
+package assessment
+
+import (
+ "strconv"
+ "time"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/gin-gonic/gin"
+)
+
+//考核项目
+
+func (d *DutyHandle) AssEssList(c *gin.Context) {
+ var requestData assessRequest
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ // response.Result(101, err, "参数错误!请重新提交!", c)
+ // return
+ }
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+ // var assessList assessmentmodel.AssessMentitems
+ gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.AssessMentitems{})
+ if requestData.ParentId != 0 {
+ gormDb = gormDb.Where("`ai_parent` = ?", requestData.ParentId)
+ }
+ if requestData.Title != "" {
+ gormDb = gormDb.Where("ai_title LIKE ?", "%"+requestData.Title+"%")
+ }
+
+ if requestData.State != 0 {
+ gormDb = gormDb.Where("`ai_state` = ?", requestData.State)
+ } else {
+ gormDb = gormDb.Where("`ai_state` IN ?", []int{1, 2})
+ }
+ var total int64
+ totalErr := gormDb.Count(&total).Error
+ if totalErr != nil {
+ total = 0
+ }
+ var assessList []assessmentmodel.AssessMentitems
+ assessListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Find(&assessList).Error
+ if assessListerr != nil {
+ response.Result(103, assessListerr, "数据获取失败!", c)
+ return
+ }
+ var assessOutMap []assessOutput
+ for _, val := range assessList {
+ var assessOutInfo assessOutput
+ assessOutInfo.Id = val.Id
+ assessOutInfo.Title = val.Title
+ assessOutInfo.Weight = val.Weight
+ assessOutInfo.Fraction = val.Fraction
+ assessOutInfo.Content = val.Content
+ assessOutInfo.PartId = val.PartId
+ assessOutInfo.Time = val.Time
+ assessOutInfo.State = val.State
+ assessOutInfo.OutId = strconv.FormatInt(val.Id, 10)
+ assessOutInfo.ParentIdStr = strconv.FormatInt(val.PartId, 10)
+
+ isTrue, parentCont := GetDutyClassCont(val.PartId)
+ if isTrue == true {
+ assessOutInfo.ParentTitle = parentCont.Title
+ }
+
+ assessOutMap = append(assessOutMap, assessOutInfo)
+ }
+ countSum := len(assessOutMap)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, assessOutMap)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//添加考核项目
+func (d *DutyHandle) AddAssEssInfo(c *gin.Context) {
+ var requestData addAssEssInfo
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Title == "" {
+ response.Result(102, err, "请输入考核项目名称", c)
+ return
+ }
+ if requestData.ParentId == "" {
+ response.Result(103, err, "请指定该考核项目归属于职责分类", c)
+ return
+ }
+ var assessInfo assessmentmodel.AssessMentitems
+ assessInfo.Id = commonus.GetFileNumberEs()
+ assessInfo.Title = requestData.Title
+ assessInfo.Weight = 0
+ assessInfo.Fraction = 0
+ assessInfo.Content = requestData.Content
+ partIdInt, partIdIntErr := strconv.ParseInt(requestData.ParentId, 10, 64)
+ if partIdIntErr == nil {
+ assessInfo.PartId = partIdInt
+ } else {
+ assessInfo.PartId = 0
+ }
+ assessInfo.Time = time.Now().Unix()
+ assessInfo.State = 1
+ addassessInfoErr := global.GVA_DB_Performanceappraisal.Create(&assessInfo).Error
+ if addassessInfoErr != nil {
+ response.Result(104, assessInfo, "数据写入失败!", c)
+ } else {
+ response.Result(0, assessInfo, "数据写入成功!", c)
+ }
+}
+
+//获取考核项目详细内容
+func (d *DutyHandle) GetAssEssInfo(c *gin.Context) {
+ var requestData commonus.SetId
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ var assessOutInfo assessOutput
+ inFoErr := global.GVA_DB_Performanceappraisal.Where("`ai_id` = ?", requestData.Id).First(&assessOutInfo).Error
+ assessOutInfo.OutId = strconv.FormatInt(assessOutInfo.Id, 10)
+
+ assessOutInfo.ParentIdStr = strconv.FormatInt(assessOutInfo.PartId, 10)
+ isTrue, parentCont := GetDutyClassCont(assessOutInfo.PartId)
+ if isTrue == true {
+ assessOutInfo.ParentTitle = parentCont.Title
+ }
+ if inFoErr != nil {
+ response.Result(103, inFoErr, "数据查询失败!", c)
+ return
+ }
+ response.Result(0, assessOutInfo, "数据查询成功!", c)
+
+}
+
+//修改考核项目内容
+func (d *DutyHandle) EiteAssEssInfo(c *gin.Context) {
+ var requestData eiteAssEssCont
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ saveData := commonus.MapOut()
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.Title == "" {
+ response.Result(103, err, "请输入考核项目名称", c)
+ return
+ }
+ if requestData.ParentId != "" {
+ parentIdInt, parentErr := strconv.ParseInt(requestData.ParentId, 10, 64)
+ if parentErr == nil {
+ saveData["ai_parent"] = parentIdInt
+ }
+
+ }
+ if requestData.Content != "" {
+ saveData["ai_content"] = requestData.Content
+ }
+ var assessInfo assessmentmodel.AssessMentitems
+ saveData["ai_title"] = requestData.Title
+ saveData["ai_time"] = time.Now().Unix()
+ isTrue, isErr := eiteAssEssInfoCont(requestData.Id, assessInfo, saveData)
+ if isTrue != true {
+ response.Result(104, isErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, saveData, "修改成功!", c)
+}
+
+//考核项目编辑操作
+func eiteAssEssInfoCont(saveId int64, modelInfo assessmentmodel.AssessMentitems, saveData map[string]interface{}) (isTrue bool, dutyClassInfoErr error) {
+ isTrue = false
+ dutyClassInfoErr = global.GVA_DB_Performanceappraisal.Model(&modelInfo).Where("ai_id = ?", saveId).Updates(saveData).Error
+ if dutyClassInfoErr != nil {
+ return
+ }
+ isTrue = true
+ return
+}
+
+//修改考核项目的状态
+func (d *DutyHandle) EiteAssEssState(c *gin.Context) {
+ var requestData dutyClassState
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.State == 0 {
+ requestData.State = 1
+ }
+ saveData := commonus.MapOut()
+ saveData["ai_state"] = requestData.State
+ saveData["ai_time"] = time.Now().Unix()
+ var eiteAssEssStateInfo assessmentmodel.AssessMentitems
+ if requestData.IsDel != 1 {
+ isTrue, dutyErr := eiteAssEssInfoCont(requestData.Id, eiteAssEssStateInfo, saveData)
+ if isTrue != true {
+ response.Result(103, dutyErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ } else {
+ if requestData.State == 3 {
+ archiveInfoErr := global.GVA_DB_Performanceappraisal.Where("ai_id = ?", requestData.Id).Delete(&eiteAssEssStateInfo).Error
+ if archiveInfoErr != nil {
+ response.Result(104, requestData, "删除失败!", c)
+ return
+ }
+ response.Result(0, requestData, "删除成功!", c)
+ } else {
+ isTrue, saveErr := eiteAssEssInfoCont(requestData.Id, eiteAssEssStateInfo, saveData)
+ if isTrue != true {
+ response.Result(105, saveErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ }
+ }
+}
+
+//获取职责类别内容
+func GetAssEssCont(id int64) (isTrue bool, ContInfo assessmentmodel.AssessMentitems) {
+ isTrue = false
+ err := global.GVA_DB_Performanceappraisal.Where("ai_id = ?", id).First(&ContInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
diff --git a/gin_server_admin/api/v1/assessment/dutyhandle.go b/gin_server_admin/api/v1/assessment/dutyhandle.go
new file mode 100644
index 0000000..999ac5c
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/dutyhandle.go
@@ -0,0 +1,243 @@
+package assessment
+
+import (
+ "strconv"
+ "time"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/gin-gonic/gin"
+)
+
+//入口
+func (d *DutyHandle) Index(c *gin.Context) {
+ outPut := commonus.MapOut()
+ response.Result(0, outPut, "获取成功", c)
+}
+
+//职责类别列表
+func (d *DutyHandle) DutyClassList(c *gin.Context) {
+ var requestData dutyClassRequest
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ // response.Result(101, err, "参数错误!请重新提交!", c)
+ // return
+ }
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+ var total int64 //获取所有数据
+ //条件
+ whereMap := commonus.MapOut()
+ if requestData.State != 0 {
+ whereMap["state"] = requestData.State
+ }
+ var dutyClassAry []assessmentmodel.DutyClass
+ if requestData.Title != "" {
+ listTitleErr := global.GVA_DB_Performanceappraisal.Where(whereMap).Where("`title` LIKE '%"+requestData.Title+"%' AND `state` IN ?", []int{1, 2}).Order("id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&dutyClassAry).Error
+ if listTitleErr != nil {
+ response.Result(103, listTitleErr, "数据获取失败!", c)
+ return
+ }
+ counrErr := global.GVA_DB_Performanceappraisal.Model(&dutyClassAry).Where(whereMap).Where("`title` LIKE '%"+requestData.Title+"%' AND `state` IN ?", []int{1, 2}).Count(&total).Error
+ if counrErr != nil {
+ total = 0
+ }
+ } else {
+ listTitleErr := global.GVA_DB_Performanceappraisal.Where(whereMap).Where("`state` IN ?", []int{1, 2}).Order("id DESC").Limit(requestData.PageSize).Offset(offSetPage).Find(&dutyClassAry).Error
+ if listTitleErr != nil {
+ response.Result(103, listTitleErr, "数据获取失败!", c)
+ return
+ }
+ counrErr := global.GVA_DB_Performanceappraisal.Model(&dutyClassAry).Where(whereMap).Where("`state` IN ?", []int{1, 2}).Count(&total).Error
+ if counrErr != nil {
+ total = 0
+ }
+ }
+ var dutyClassOutputAry []dutyClassOutput
+ for _, val := range dutyClassAry {
+ var dutyClassCont dutyClassOutput
+ dutyClassCont.Id = val.Id
+ dutyClassCont.Title = val.Title
+ dutyClassCont.Type = val.Type
+ dutyClassCont.Weight = val.Weight
+ dutyClassCont.Time = val.Time
+ dutyClassCont.State = val.State
+ dutyClassCont.OutId = strconv.FormatInt(val.Id, 10)
+ dutyClassOutputAry = append(dutyClassOutputAry, dutyClassCont)
+ }
+ countSum := len(dutyClassOutputAry)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, dutyClassOutputAry)
+ // fmt.Printf("%v\n", printData)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//添加职责类别
+func (d *DutyHandle) AddDutyClass(c *gin.Context) {
+ var requestData dutyClassAdd
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Title == "" {
+ response.Result(102, err, "请输入职责名称", c)
+ return
+ }
+ var dutyClassCont assessmentmodel.DutyClass
+ dutyClassCont.Id = commonus.GetFileNumberEs()
+ dutyClassCont.Title = requestData.Title
+ dutyClassCont.Type = 1
+ dutyClassCont.Weight = 0
+ dutyClassCont.State = 1
+ dutyClassCont.Time = time.Now().Unix()
+
+ addArchiveFileErr := global.GVA_DB_Performanceappraisal.Create(&dutyClassCont).Error
+ if addArchiveFileErr != nil {
+ response.Result(108, dutyClassCont, "数据写入失败!", c)
+ } else {
+ response.Result(0, dutyClassCont, "数据写入成功!", c)
+ }
+}
+
+//查看职责类别详情
+func (d *DutyHandle) GetDutyClassInfo(c *gin.Context) {
+ var requestData commonus.SetId
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ var dutyClassCont assessmentmodel.DutyClass
+ inFoErr := global.GVA_DB_Performanceappraisal.Where("`id` = ?", requestData.Id).First(&dutyClassCont).Error
+ if inFoErr != nil {
+ response.Result(103, inFoErr, "数据查询失败!", c)
+ return
+ }
+ response.Result(0, dutyClassCont, "数据查询成功!", c)
+}
+
+//修改职责类别内容
+func (d *DutyHandle) EiteDutyClassInfo(c *gin.Context) {
+ var requestData dutyClassEite
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.Title == "" {
+ response.Result(103, err, "请输入职责名称", c)
+ return
+ }
+ //软处理
+ saveData := commonus.MapOut()
+ saveData["title"] = requestData.Title
+ saveData["time"] = time.Now().Unix()
+
+ var eiteDutyClass assessmentmodel.DutyClass
+ inFoErr := global.GVA_DB_Performanceappraisal.Model(&eiteDutyClass).Where("`id` = ?", requestData.Id).Updates(saveData).Error
+ if inFoErr != nil {
+ response.Result(104, inFoErr, "数据编辑失败!", c)
+ return
+ }
+ response.Result(0, eiteDutyClass, "数据编辑成功!", c)
+}
+
+//状态变更及删除
+func (d *DutyHandle) StateDutyClass(c *gin.Context) {
+ var requestData dutyClassState
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.State == 0 {
+ requestData.State = 1
+ }
+ var eiteDutyClass assessmentmodel.DutyClass
+ if requestData.IsDel != 1 {
+ isTrue, dutyErr := dutyInfoStateSet(eiteDutyClass, requestData)
+ if isTrue != true {
+ response.Result(103, dutyErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ } else {
+ if requestData.State == 3 {
+ archiveInfoErr := global.GVA_DB_Performanceappraisal.Where("at_id = ?", requestData.Id).Delete(&eiteDutyClass).Error
+ if archiveInfoErr != nil {
+ response.Result(104, requestData, "删除失败!", c)
+ return
+ }
+ response.Result(0, requestData, "删除成功!", c)
+ } else {
+ isTrue, saveErr := dutyInfoStateSet(eiteDutyClass, requestData)
+ if isTrue != true {
+ response.Result(105, saveErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ }
+ }
+}
+
+//状态软操作
+func dutyInfoStateSet(dutyClassInfo assessmentmodel.DutyClass, arrData dutyClassState) (isTrue bool, dutyClassInfoErr error) {
+ isTrue = false
+ //软处理
+ saveData := commonus.MapOut()
+ saveData["state"] = arrData.State
+ saveData["time"] = time.Now().Unix()
+ dutyClassInfoErr = global.GVA_DB_Performanceappraisal.Model(&dutyClassInfo).Where("id = ?", arrData.Id).Updates(saveData).Error
+ if dutyClassInfoErr != nil {
+ return
+ }
+ isTrue = true
+ return
+}
+
+//获取职责类别内容
+func GetDutyClassCont(id int64) (isTrue bool, ContInfo assessmentmodel.DutyClass) {
+ isTrue = false
+ err := global.GVA_DB_Performanceappraisal.Where("id = ?", id).First(&ContInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
diff --git a/gin_server_admin/api/v1/assessment/dutylist.go b/gin_server_admin/api/v1/assessment/dutylist.go
new file mode 100644
index 0000000..041fa23
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/dutylist.go
@@ -0,0 +1,319 @@
+package assessment
+
+import (
+ "strconv"
+ "time"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/gin-gonic/gin"
+)
+
+//具体职责
+func (d *DutyHandle) DutyList(c *gin.Context) {
+ var requestData dutyRequest
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ // response.Result(101, err, "参数错误!请重新提交!", c)
+ // return
+ }
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+ gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DutyContent{})
+ if requestData.ParentId != 0 {
+ gormDb = gormDb.Where("`dc_parent` = ?", requestData.ParentId)
+ }
+ if requestData.Title != "" {
+ gormDb = gormDb.Where("dc_title LIKE ?", "%"+requestData.Title+"%")
+ }
+
+ if requestData.State != 0 {
+ gormDb = gormDb.Where("`dc_state` = ?", requestData.State)
+ } else {
+ gormDb = gormDb.Where("`dc_state` IN ?", []int{1, 2})
+ }
+
+ if requestData.AssEssType != 0 {
+ gormDb = gormDb.Where("`dc_user_type` = ?", requestData.AssEssType)
+ if requestData.AssEssUserId != "" {
+ assessUserId, assessErr := strconv.ParseInt(requestData.AssEssUserId, 10, 64)
+ if assessErr == nil {
+ if requestData.AssEssType == 1 {
+ gormDb = gormDb.Where("`dc_user_dump` = ?", assessUserId)
+ } else {
+ gormDb = gormDb.Where("`dc_dump` = ?", assessUserId)
+ }
+ }
+ }
+ } else {
+ if requestData.AssEssUserId != "" {
+ assessUserId, assessErr := strconv.ParseInt(requestData.AssEssUserId, 10, 64)
+ if assessErr == nil {
+ if requestData.AssEssType == 1 {
+ gormDb = gormDb.Where("`dc_user_dump` = ?", assessUserId)
+ } else {
+ gormDb = gormDb.Where("`dc_dump` = ?", assessUserId)
+ }
+ }
+ }
+ }
+
+ var total int64
+ totalErr := gormDb.Count(&total).Error
+ if totalErr != nil {
+ total = 0
+ }
+
+ var dutyList []assessmentmodel.DutyContent
+ dutyListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Find(&dutyList).Error
+ if dutyListerr != nil {
+ response.Result(103, dutyListerr, "数据获取失败!", c)
+ return
+ }
+ var outDutyMap []dutyOutput
+ for _, val := range dutyList {
+ var outDutyInfo dutyOutput
+ outDutyInfo.Id = val.Id
+ outDutyInfo.Title = val.Title
+ outDutyInfo.Time = val.Time
+ outDutyInfo.State = val.State
+ outDutyInfo.PartId = val.PartId
+ outDutyInfo.UserType = val.UserType
+ outDutyInfo.UserDump = val.UserDump
+ outDutyInfo.Dump = val.Dump
+ outDutyInfo.OutId = strconv.FormatInt(outDutyInfo.Id, 10)
+
+ outDutyInfo.ParentIdStr = strconv.FormatInt(val.PartId, 10)
+ isTrue, parentCont := GetAssEssCont(val.PartId)
+ if isTrue == true {
+ outDutyInfo.ParentTitle = parentCont.Title
+ }
+
+ outDutyMap = append(outDutyMap, outDutyInfo)
+ }
+ countSum := len(outDutyMap)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, outDutyMap)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//添加具体职责
+func (d *DutyHandle) AddDutyInfo(c *gin.Context) {
+ var requestData addDutyContent
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Title == "" {
+ response.Result(102, err, "请输入具体职责名称", c)
+ return
+ }
+ if requestData.ParentId == "" {
+ response.Result(103, err, "请指定该具体归属于职责项目", c)
+ return
+ }
+ if requestData.UserId == "" {
+ response.Result(103, err, "请指定该具体职责执行人或执行部门", c)
+ return
+ }
+ if requestData.Type == 0 {
+ requestData.Type = 1
+ }
+ var dutyInfo assessmentmodel.DutyContent
+ dutyInfo.Id = commonus.GetFileNumberEs()
+ dutyInfo.Title = requestData.Title
+ dutyInfo.Time = time.Now().Unix()
+ dutyInfo.State = 1
+ parentId, parentIdErr := strconv.ParseInt(requestData.ParentId, 10, 64)
+ if parentIdErr == nil {
+ dutyInfo.PartId = parentId
+ } else {
+ dutyInfo.PartId = 0
+ }
+ userID, userIDErr := strconv.ParseInt(requestData.UserId, 10, 64)
+ if userIDErr != nil {
+ userID = 0
+ }
+ dutyInfo.UserType = requestData.Type
+ if requestData.Type == 1 {
+ dutyInfo.UserDump = userID
+ dutyInfo.Dump = 0
+ } else {
+ dutyInfo.UserDump = 0
+ dutyInfo.Dump = userID
+ }
+ dutyInfoErr := global.GVA_DB_Performanceappraisal.Create(&dutyInfo).Error
+ if dutyInfoErr != nil {
+ response.Result(104, dutyInfo, "数据写入失败!", c)
+ } else {
+ response.Result(0, dutyInfo, "数据写入成功!", c)
+ }
+}
+
+//获取具体职责
+func (d *DutyHandle) GetDutyInfo(c *gin.Context) {
+ var requestData commonus.SetId
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ var dutyOutInfo dutyOutput
+ inFoErr := global.GVA_DB_Performanceappraisal.Where("`dc_id` = ?", requestData.Id).First(&dutyOutInfo).Error
+ dutyOutInfo.OutId = strconv.FormatInt(dutyOutInfo.Id, 10)
+ dutyOutInfo.ParentIdStr = strconv.FormatInt(dutyOutInfo.PartId, 10)
+ isTrue, parentCont := GetAssEssCont(dutyOutInfo.PartId)
+ if isTrue == true {
+ dutyOutInfo.ParentTitle = parentCont.Title
+ }
+ if inFoErr != nil {
+ response.Result(103, inFoErr, "数据查询失败!", c)
+ return
+ }
+ response.Result(0, dutyOutInfo, "数据查询成功!", c)
+}
+
+//编辑具体职责
+func (d *DutyHandle) EiteDutyInfor(c *gin.Context) {
+ var requestData eiteDutyCont
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ saveData := commonus.MapOut()
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.Title == "" {
+ response.Result(103, err, "请输入具体职责", c)
+ return
+ }
+ if requestData.ParentId != "" {
+ parentIdInt, parentErr := strconv.ParseInt(requestData.ParentId, 10, 64)
+ if parentErr == nil {
+ saveData["dc_parent"] = parentIdInt
+ }
+ }
+ if requestData.Type != 0 {
+ saveData["dc_user_type"] = requestData.Type
+ if requestData.UserId != "" {
+ userID, userIDErr := strconv.ParseInt(requestData.UserId, 10, 64)
+ if userIDErr != nil {
+ userID = 0
+ }
+ if requestData.Type == 1 {
+ saveData["dc_user_dump"] = userID
+ saveData["dc_dump"] = 0
+ } else {
+ saveData["dc_user_dump"] = 0
+ saveData["dc_dump"] = userID
+ }
+ }
+ }
+ var assessInfo assessmentmodel.DutyContent
+ saveData["dc_title"] = requestData.Title
+ saveData["dc_time"] = time.Now().Unix()
+ isTrue, isErr := eiteDutyInfoCont(requestData.Id, assessInfo, saveData)
+ if isTrue != true {
+ response.Result(104, isErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, saveData, "修改成功!", c)
+}
+
+//编辑具体职责内容
+func eiteDutyInfoCont(saveId int64, modelInfo assessmentmodel.DutyContent, saveData map[string]interface{}) (isTrue bool, dutyClassInfoErr error) {
+ isTrue = false
+ dutyClassInfoErr = global.GVA_DB_Performanceappraisal.Model(&modelInfo).Where("dc_id = ?", saveId).Updates(saveData).Error
+ if dutyClassInfoErr != nil {
+ return
+ }
+ isTrue = true
+ return
+}
+
+//修改考核项目的状态
+func (d *DutyHandle) EiteDutyState(c *gin.Context) {
+ var requestData dutyClassState
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.State == 0 {
+ requestData.State = 1
+ }
+ saveData := commonus.MapOut()
+ saveData["dc_state"] = requestData.State
+ saveData["dc_time"] = time.Now().Unix()
+ var eiteAssEssStateInfo assessmentmodel.DutyContent
+ if requestData.IsDel != 1 {
+ isTrue, dutyErr := eiteDutyInfoCont(requestData.Id, eiteAssEssStateInfo, saveData)
+ if isTrue != true {
+ response.Result(103, dutyErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ } else {
+ if requestData.State == 3 {
+ archiveInfoErr := global.GVA_DB_Performanceappraisal.Where("ai_id = ?", requestData.Id).Delete(&eiteAssEssStateInfo).Error
+ if archiveInfoErr != nil {
+ response.Result(104, requestData, "删除失败!", c)
+ return
+ }
+ response.Result(0, requestData, "删除成功!", c)
+ } else {
+ isTrue, saveErr := eiteDutyInfoCont(requestData.Id, eiteAssEssStateInfo, saveData)
+ if isTrue != true {
+ response.Result(105, saveErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ }
+ }
+}
+
+//获取职责类别内容
+func GetDutyInfoCont(id int64) (isTrue bool, ContInfo assessmentmodel.DutyContent) {
+ isTrue = false
+ err := global.GVA_DB_Performanceappraisal.Where("dc_id = ?", id).First(&ContInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
diff --git a/gin_server_admin/api/v1/assessment/dutytype.go b/gin_server_admin/api/v1/assessment/dutytype.go
new file mode 100644
index 0000000..892dbf0
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/dutytype.go
@@ -0,0 +1,159 @@
+package assessment
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
+)
+
+//职责考核
+type DutyHandle struct{}
+
+//字符串ID
+type OutIdStruct struct {
+ OutId string `json:"outId"`
+}
+
+//职责类别查询参数
+type dutyClassRequest struct {
+ commonus.PageSetLimt
+ OutIdStruct
+ Title string `json:"title"`
+ State int `json:"state"`
+}
+
+//职责类别输出
+type dutyClassOutput struct {
+ assessmentmodel.DutyClass
+ OutIdStruct
+}
+
+//职责类别添加
+type dutyClassAdd struct {
+ Title string `json:"title"`
+}
+
+//职责类别修改
+type dutyClassEite struct {
+ commonus.SetId
+ dutyClassAdd
+}
+
+//状态修改
+type dutyClassState struct {
+ commonus.SetId
+ State int `json:"state"` // 状态
+ IsDel int `json:"isdel"` // 是否强制删除
+}
+
+//考核项目查询参数
+type assessRequest struct {
+ commonus.PageSetLimt
+ ParentId int64 `json:"parentId"` //父级
+ Title string `json:"title"`
+ State int `json:"state"`
+}
+
+//考核项目输出
+type assessOutput struct {
+ assessmentmodel.AssessMentitems
+ OutIdStruct
+ ParentIdStr string `json:"parentIdStr"` //部门ID
+ ParentTitle string `json:"parentTitle"`
+}
+
+//添加考核项目内容
+type addAssEssInfo struct {
+ dutyClassAdd
+ Content string `json:"content"`
+ ParentId string `json:"parentId"` //父级
+}
+
+//修改考核项目内容
+type eiteAssEssCont struct {
+ commonus.SetId
+ dutyClassAdd
+ Content string `json:"content"`
+ ParentId string `json:"parentId"` //父级
+}
+
+//具体职责查询
+type dutyRequest struct {
+ commonus.PageSetLimt
+ ParentId int64 `json:"parentId"` //父级
+ Title string `json:"title"`
+ State int `json:"state"`
+ AssEssType int `json:"assesstype"`
+ AssEssUserId string `json:"assessuserid"`
+}
+
+//具体职责输出
+type dutyOutput struct {
+ assessmentmodel.DutyContent
+ OutIdStruct
+
+ ParentIdStr string `json:"parentIdStr"` //部门ID
+ ParentTitle string `json:"parentTitle"`
+}
+
+//添加具体职责
+type addDutyContent struct {
+ dutyClassAdd
+ Type int `json:"type"`
+ ParentId string `json:"parentId"` //父级
+ UserId string `json:"userid"`
+}
+
+//编辑具体项目
+type eiteDutyCont struct {
+ commonus.SetId
+ dutyClassAdd
+ Type int `json:"type"`
+ ParentId string `json:"parentId"` //父级
+ UserId string `json:"userid"`
+}
+
+//部门具体职责
+type specificDutyRequest struct {
+ commonus.PageSetLimt
+ DepartmentId string `json:"departmentId"` //部门ID
+}
+
+//部门具体职责输出
+type specificDutyOut struct {
+ assessmentmodel.DepartDuty
+ OutIdStruct
+ ParentId string `json:"parentId"` //部门
+ ParentTitle string `json:"parentTitle"`
+
+ ClassIdStr string `json:"classIdStr"` //考核类别
+ ClassTitle string `json:"classTitle"`
+
+ AssEssIdStr string `json:"assessIdStr"` //考核项目
+ AssEssTitle string `json:"assessTitle"`
+
+ DutyIdStr string `json:"duryIdStr"` //具体职责
+ DutyTitle string `json:"duryTitle"`
+
+ GroupTitle string `json:"groupTitle"` //集团
+}
+
+//添加部门具体职责
+type addSpecificDutyCont struct {
+ ParentId string `json:"parentId"` //部门ID
+ ClassId string `json:"classId"` //考核类别
+ AssEssId string `json:"assessId"` //考核项目
+ DutyId string `json:"dutyId"` //具体职责
+ Score int64 `json:"score"` //分数
+ Group int64 `json:"group"`
+}
+
+//编辑部门具体职责
+type eiteSpecificDutyCont struct {
+ commonus.SetId
+ ParentId string `json:"parentId"` //部门ID
+ ClassId string `json:"classId"` //考核类别
+ AssEssId string `json:"assessId"` //考核项目
+ DutyId string `json:"dutyId"` //具体职责
+ Score int64 `json:"score"` //分数
+ Group int64 `json:"group"`
+}
diff --git a/gin_server_admin/api/v1/assessment/enter.go b/gin_server_admin/api/v1/assessment/enter.go
new file mode 100644
index 0000000..7ec3503
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/enter.go
@@ -0,0 +1,5 @@
+package assessment
+
+type ApiGroup struct {
+ DutyHandle
+}
diff --git a/gin_server_admin/api/v1/assessment/specificduty.go b/gin_server_admin/api/v1/assessment/specificduty.go
new file mode 100644
index 0000000..d916690
--- /dev/null
+++ b/gin_server_admin/api/v1/assessment/specificduty.go
@@ -0,0 +1,381 @@
+package assessment
+
+import (
+ "strconv"
+ "time"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/assessmentmodel"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/testpage"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/wechat"
+ "github.com/gin-gonic/gin"
+)
+
+//具体部门职责
+func (d *DutyHandle) SpecificDutyList(c *gin.Context) {
+ var requestData specificDutyRequest
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ // response.Result(101, err, "参数错误!请重新提交!", c)
+ // return
+ }
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+
+ gormDb := global.GVA_DB_Performanceappraisal.Model(&assessmentmodel.DepartDuty{})
+ if requestData.DepartmentId != "" {
+ departId, departErr := strconv.ParseInt(requestData.DepartmentId, 10, 64)
+ if departErr == nil {
+ gormDb = gormDb.Where("`de_partid` = ?", departId)
+ }
+
+ }
+
+ var total int64
+ totalErr := gormDb.Count(&total).Error
+ if totalErr != nil {
+ total = 0
+ }
+
+ var dutyList []assessmentmodel.DepartDuty
+ dutyListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Find(&dutyList).Error
+ if dutyListerr != nil {
+ response.Result(103, dutyListerr, "数据获取失败!", c)
+ return
+ }
+ var dutyListCont []specificDutyOut
+ for _, val := range dutyList {
+ var dutyCont specificDutyOut
+
+ dutyCont.Id = val.Id
+ dutyCont.Title = val.Title
+ dutyCont.State = val.State
+ dutyCont.Time = val.Time
+ dutyCont.PartId = val.PartId
+ dutyCont.ClassId = val.ClassId
+ dutyCont.AssessId = val.AssessId
+ dutyCont.DutyId = val.DutyId
+ dutyCont.Rescore = val.Rescore
+ dutyCont.OutId = strconv.FormatInt(val.Id, 10)
+
+ //职责分类
+ dutyCont.ClassIdStr = strconv.FormatInt(val.ClassId, 10)
+ isTrue, classCont := GetDutyClassCont(val.ClassId)
+ if isTrue == true {
+ dutyCont.ClassTitle = classCont.Title
+ }
+ //职责项目
+ dutyCont.AssEssIdStr = strconv.FormatInt(val.AssessId, 10)
+ isTrueAssEss, assessCont := GetAssEssCont(val.AssessId)
+ if isTrueAssEss == true {
+ dutyCont.AssEssTitle = assessCont.Title
+ }
+ //具体职责
+ dutyCont.DutyIdStr = strconv.FormatInt(val.DutyId, 10)
+ isTrueDuty, dutyContInfo := GetDutyInfoCont(val.DutyId)
+ if isTrueDuty == true {
+ dutyCont.DutyTitle = dutyContInfo.Title
+ }
+
+ isTrueGroup, groupCont := GetGroupCont(val.Group)
+ if isTrueGroup == true {
+ dutyCont.GroupTitle = groupCont.Name
+ }
+
+ //具体职责
+ dutyCont.ParentId = strconv.FormatInt(val.PartId, 10)
+ isTrueBranFact, branFactCont := GetBranchFactory(val.PartId)
+ if isTrueBranFact == true {
+ dutyCont.ParentTitle = branFactCont.Name
+ }
+
+ dutyListCont = append(dutyListCont, dutyCont)
+ }
+ countSum := len(dutyListCont)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, dutyListCont)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//添加具体职责
+func (d *DutyHandle) AddSpecificDutyInfo(c *gin.Context) {
+ var requestData addSpecificDutyCont
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ var parentId, classId, assessId, dutyId int64
+ if requestData.ParentId == "" {
+ response.Result(102, err, "请指定归属于被考核部门", c)
+ return
+ } else {
+ parentId, _ = strconv.ParseInt(requestData.ParentId, 10, 64)
+ }
+ if requestData.ClassId == "" {
+ response.Result(103, err, "请指定考核类别", c)
+ return
+ } else {
+ classId, _ = strconv.ParseInt(requestData.ClassId, 10, 64)
+ }
+ if requestData.AssEssId == "" {
+ response.Result(104, err, "请指定考核项目", c)
+ return
+ } else {
+ assessId, _ = strconv.ParseInt(requestData.AssEssId, 10, 64)
+ }
+ if requestData.DutyId == "" {
+ response.Result(105, err, "请指定考核具体职责", c)
+ return
+ } else {
+ dutyId, _ = strconv.ParseInt(requestData.DutyId, 10, 64)
+ }
+ if requestData.Score < 1 {
+ response.Result(106, err, "请指定该具体职责参考分值", c)
+ return
+ }
+ var ScoreAll int64
+ var specDutyInfo assessmentmodel.DepartDuty
+
+ scoreErr := global.GVA_DB_Performanceappraisal.Model(&specDutyInfo).Where("`de_partid` = ?", parentId).Pluck("COALESCE(SUM(de_rescore), 0) as rescore", &ScoreAll).Error
+ if scoreErr != nil {
+ ScoreAll = 0
+ }
+ if ScoreAll+requestData.Score > 100 {
+ response.Result(107, err, "该部门的总分值超过100。请重新写入该考核项目参考分值!", c)
+ return
+ }
+ if requestData.Group == 0 {
+ requestData.Group = 3
+ }
+ specDutyInfo.Id = commonus.GetFileNumberEs()
+ specDutyInfo.Title = ""
+ specDutyInfo.State = 1
+ specDutyInfo.Time = time.Now().Unix()
+ specDutyInfo.PartId = parentId
+ specDutyInfo.ClassId = classId
+ specDutyInfo.AssessId = assessId
+ specDutyInfo.DutyId = dutyId
+ specDutyInfo.Rescore = requestData.Score
+ specDutyInfo.Group = requestData.Group
+ dutyInfoErr := global.GVA_DB_Performanceappraisal.Create(&specDutyInfo).Error
+ if dutyInfoErr != nil {
+ response.Result(108, specDutyInfo, "数据写入失败!", c)
+ } else {
+ response.Result(0, specDutyInfo, "数据写入成功!", c)
+ }
+}
+
+//获取部门具体考核项目
+func (d *DutyHandle) GetSpecDutyCont(c *gin.Context) {
+ var requestData commonus.SetId
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ var dutyOutInfo specificDutyOut
+ inFoErr := global.GVA_DB_Performanceappraisal.Where("`de_id` = ?", requestData.Id).First(&dutyOutInfo).Error
+ if inFoErr != nil {
+ response.Result(103, inFoErr, "数据查询失败!", c)
+ return
+ }
+ dutyOutInfo.OutId = strconv.FormatInt(dutyOutInfo.Id, 10)
+ //职责分类
+ dutyOutInfo.ClassIdStr = strconv.FormatInt(dutyOutInfo.ClassId, 10)
+ isTrue, classCont := GetDutyClassCont(dutyOutInfo.ClassId)
+ if isTrue == true {
+ dutyOutInfo.ClassTitle = classCont.Title
+ }
+ //职责项目
+ dutyOutInfo.AssEssIdStr = strconv.FormatInt(dutyOutInfo.AssessId, 10)
+ isTrueAssEss, assessCont := GetAssEssCont(dutyOutInfo.AssessId)
+ if isTrueAssEss == true {
+ dutyOutInfo.AssEssTitle = assessCont.Title
+ }
+ //具体职责
+ dutyOutInfo.DutyIdStr = strconv.FormatInt(dutyOutInfo.DutyId, 10)
+ isTrueDuty, dutyCont := GetDutyInfoCont(dutyOutInfo.DutyId)
+ if isTrueDuty == true {
+ dutyOutInfo.DutyTitle = dutyCont.Title
+ }
+
+ isTrueGroup, groupCont := GetGroupCont(dutyOutInfo.Group)
+ if isTrueGroup == true {
+ dutyOutInfo.GroupTitle = groupCont.Name
+ }
+
+ //具体职责
+ dutyOutInfo.ParentId = strconv.FormatInt(dutyOutInfo.PartId, 10)
+ isTrueBranFact, branFactCont := GetBranchFactory(dutyOutInfo.PartId)
+ if isTrueBranFact == true {
+ dutyOutInfo.ParentTitle = branFactCont.Name
+ }
+
+ response.Result(0, dutyOutInfo, "数据查询成功!", c)
+}
+
+//获取集团信息
+func GetGroupCont(id int64) (isTrue bool, ContInfo wechat.GroupForm) {
+ isTrue = false
+ err := global.GVA_DB_WatchDate.Where("g_id = ?", id).First(&ContInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
+
+//获得分厂名称
+func GetBranchFactory(id int64) (isTrue bool, ContInfo testpage.BranchFactory) {
+ isTrue = false
+ err := global.GVA_DB_Master.Where("bf_id = ?", id).First(&ContInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
+
+//编辑具体内容
+func (d *DutyHandle) EiteSpecFicDutyInfo(c *gin.Context) {
+ var requestData eiteSpecificDutyCont
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ saveData := commonus.MapOut()
+
+ var parentId, classId, assessId, dutyId int64
+ if requestData.ParentId != "" {
+ parentId, _ = strconv.ParseInt(requestData.ParentId, 10, 64)
+ saveData["de_partid"] = parentId
+ }
+ if requestData.ClassId != "" {
+ classId, _ = strconv.ParseInt(requestData.ClassId, 10, 64)
+ saveData["de_class"] = classId
+ }
+ if requestData.AssEssId != "" {
+ assessId, _ = strconv.ParseInt(requestData.AssEssId, 10, 64)
+ saveData["de_assess"] = assessId
+ }
+ if requestData.DutyId != "" {
+ dutyId, _ = strconv.ParseInt(requestData.DutyId, 10, 64)
+ saveData["de_duty"] = dutyId
+ }
+ if requestData.Score > 0 {
+ var ScoreAll int64
+ var specDutyInfo assessmentmodel.DepartDuty
+
+ scoreErr := global.GVA_DB_Performanceappraisal.Model(&specDutyInfo).Where("`de_partid` = ?", parentId).Pluck("COALESCE(SUM(de_rescore), 0) as rescore", &ScoreAll).Error
+ if scoreErr != nil {
+ ScoreAll = 0
+ }
+ if ScoreAll+requestData.Score > 100 {
+ response.Result(107, err, "该部门的总分值超过100。请重新写入该考核项目参考分值!", c)
+ return
+ }
+ saveData["de_rescore"] = requestData.Score
+ }
+
+ if requestData.Group != 0 {
+ saveData["de_group"] = requestData.Group
+ }
+
+ saveData["de_time"] = time.Now().Unix()
+ isTrue, isErr := eiteSpecificDutyInfoCont(requestData.Id, saveData)
+ if isTrue != true {
+ response.Result(104, isErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, saveData, "修改成功!", c)
+
+}
+
+//编辑具体职责内容
+func eiteSpecificDutyInfoCont(saveId int64, saveData map[string]interface{}) (isTrue bool, dutyClassInfoErr error) {
+ var modelInfo assessmentmodel.DepartDuty
+ isTrue = false
+ dutyClassInfoErr = global.GVA_DB_Performanceappraisal.Model(&modelInfo).Where("de_id = ?", saveId).Updates(saveData).Error
+ if dutyClassInfoErr != nil {
+ return
+ }
+ isTrue = true
+ return
+}
+
+//修改考核项目的状态
+func (d *DutyHandle) EiteSpecficDutyState(c *gin.Context) {
+ var requestData dutyClassState
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ response.Result(101, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.Id == 0 && requestData.OutId == "" {
+ response.Result(102, err, "参数错误!请重新提交!", c)
+ return
+ }
+ if requestData.OutId != "" {
+ idInt, inIntErr := strconv.ParseInt(requestData.OutId, 10, 64)
+ if inIntErr == nil {
+ requestData.Id = idInt
+ }
+ }
+ if requestData.State == 0 {
+ requestData.State = 1
+ }
+ saveData := commonus.MapOut()
+ saveData["de_satte"] = requestData.State
+ saveData["de_time"] = time.Now().Unix()
+ var eiteAssEssStateInfo assessmentmodel.DepartDuty
+ if requestData.IsDel != 1 {
+ isTrue, dutyErr := eiteSpecificDutyInfoCont(requestData.Id, saveData)
+ if isTrue != true {
+ response.Result(103, dutyErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ } else {
+ if requestData.State == 3 {
+ archiveInfoErr := global.GVA_DB_Performanceappraisal.Where("de_id = ?", requestData.Id).Delete(&eiteAssEssStateInfo).Error
+ if archiveInfoErr != nil {
+ response.Result(104, requestData, "删除失败!", c)
+ return
+ }
+ response.Result(0, requestData, "删除成功!", c)
+ } else {
+ isTrue, saveErr := eiteSpecificDutyInfoCont(requestData.Id, saveData)
+ if isTrue != true {
+ response.Result(105, saveErr, "修改失败!", c)
+ return
+ }
+ response.Result(0, requestData, "修改成功!", c)
+ }
+ }
+}
diff --git a/gin_server_admin/api/v1/custom/customhandle.go b/gin_server_admin/api/v1/custom/customhandle.go
new file mode 100644
index 0000000..5f27753
--- /dev/null
+++ b/gin_server_admin/api/v1/custom/customhandle.go
@@ -0,0 +1,208 @@
+package custom
+
+import (
+ "encoding/json"
+ "strconv"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/staff"
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/systemuser"
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
+ "github.com/flipped-aurora/gin-vue-admin/server/utils"
+ "github.com/flipped-aurora/gin-vue-admin/server/utils/redishandel"
+
+ "github.com/gin-gonic/gin"
+)
+
+//自定义登录
+func (cu *CustomHandle) CustomLogin(c *gin.Context) {
+ var l systemReq.Login
+ _ = c.ShouldBindJSON(&l)
+ if err := utils.Verify(l, utils.LoginVerify); err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ userAgent := c.Request.Header.Get("User-Agent")
+ // store
+ // if store.Verify(l.CaptchaId, l.Captcha, true) {
+ userErr, user := staff.GetUserWork(l.Username, l.Password)
+ if userErr != true {
+ // // global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Any("err", err))
+ response.Result(101, userErr, "登陆失败! 用户名不存在或者密码错误!!", c)
+ return
+ } else {
+ if user.State == 2 {
+ response.Result(102, userErr, "登陆失败! 该账号已经被禁用!", c)
+ return
+ }
+ if user.State == 3 {
+ response.Result(102, userErr, "登陆失败! 该账号不存在!", c)
+ return
+ }
+ if user.HireSet != 1 {
+ response.Result(102, userErr, "登陆失败! 该员工已经离职!", c)
+ return
+ }
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userAgent)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+
+ sha1Str := user.KeyStr + user.Number + user.Password + md5Token
+ sha1Token := commonus.Sha1Encryption(sha1Str)
+
+ saveData := commonus.MapOut()
+ saveData["key"] = user.KeyStr
+ saveData["token"] = sha1Token
+ saveData["userinfo"] = user
+
+ redisClient := redishandel.RunRedis()
+ redisClient.SetRedisTime(10800)
+ writeRedisData := map[string]interface{}{
+ "userkey": user.KeyStr,
+ "usernumber": user.Number,
+ "userpwd": user.Password,
+ "usertoken": sha1Token,
+ }
+
+ global.GVA_INDEX_USERKEY = user.Key
+
+ redisClient.HashMsetAdd("system:Identification_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+user.KeyStr, writeRedisData)
+
+ userInfo := commonus.MapOut()
+ userInfo["id"] = user.Id
+ userInfo["number"] = user.Number
+ userInfo["departmentid"] = user.DepartmentId
+ userInfo["workshopid"] = user.WorkshopId
+ userInfo["postid"] = user.PostId
+ userInfo["key"] = user.Key
+ userInfo["group"] = user.Group
+ userInfo["tema"] = user.Tema
+ userInfo["workwechatid"] = user.WorkWechatId
+ userInfo["wechatid"] = user.WechatId
+ userInfo["name"] = user.Name
+ userInfo["nickname"] = user.NickName
+
+ redisUserClient := redishandel.RunRedis()
+ redisUserClient.SetRedisTime(0)
+ redisUserClient.HashMsetAdd("system:userContent_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+user.KeyStr, userInfo)
+ // // b.tokenNext(c, *user)
+ response.Result(0, saveData, "登录成功!", c)
+ }
+ // } else {
+ // response.FailWithMessage("验证码错误", c)
+ // }
+}
+
+//自定义登录
+func (cu *CustomHandle) SystemLogin(c *gin.Context) {
+ var l systemReq.Login
+ _ = c.ShouldBindJSON(&l)
+ if err := utils.Verify(l, utils.LoginVerify); err != nil {
+ response.FailWithMessage(err.Error(), c)
+ return
+ }
+ userAgent := c.Request.Header.Get("User-Agent")
+ // store
+ // if store.Verify(l.CaptchaId, l.Captcha, true) {
+ userErr, user := systemuser.GetSysAdminLoginInfo(l.Username, l.Password)
+ if userErr != true {
+ // // global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Any("err", err))
+ response.Result(101, userErr, "登陆失败! 用户名不存在或者密码错误!!", c)
+ return
+ } else {
+ if user.State == 2 {
+ response.Result(102, userErr, "登陆失败! 该账号已经被禁用!", c)
+ return
+ }
+ if user.State == 3 {
+ response.Result(102, userErr, "登陆失败! 该账号不存在!", c)
+ return
+ }
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userAgent)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+
+ sha1Str := user.KeyStr + user.Name + user.PassWord + md5Token
+ sha1Token := commonus.Sha1Encryption(sha1Str)
+
+ saveData := commonus.MapOut()
+ saveData["key"] = user.KeyStr
+ saveData["token"] = sha1Token
+ saveData["userinfo"] = user
+
+ redisClient := redishandel.RunRedis()
+ redisClient.SetRedisTime(10800)
+ writeRedisData := map[string]interface{}{
+ "userkey": user.KeyStr,
+ "usernumber": user.Name,
+ "userpwd": user.PassWord,
+ "usertoken": sha1Token,
+ "jurisdiction": user.Jurisdiction,
+ "menuOper": user.MenuOper,
+ "wand": user.Wand,
+ }
+ redisClient.HashMsetAdd("system:SystemIdentification_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+user.KeyStr, writeRedisData)
+
+ adminRedisData := map[string]interface{}{
+ "userkey": user.KeyStr,
+ "usernumber": user.Name,
+ "userpwd": user.PassWord,
+ "usertoken": sha1Token,
+ "jurisdiction": user.Jurisdiction,
+ "menuOper": user.MenuOper,
+ "wand": user.Wand,
+ "name": user.NameAttr,
+ "groupname": user.GroupName,
+ "group": user.Group,
+ "attribute": user.Attribute,
+ "branchfactoryname": user.BranchFactoryName,
+ "role": user.Role,
+ "roleName": user.RoleName,
+ }
+ redisAdminClient := redishandel.RunRedis()
+ redisAdminClient.SetRedisTime(0)
+ redisAdminClient.HashMsetAdd("system:SystemAdminInfo_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+user.KeyStr, adminRedisData)
+
+ global.GVA_ADMIN_USERKEY = user.Key
+ // // b.tokenNext(c, *user)
+ var surisdictionStr []string
+ var surisdictionInt []int64
+ jsonErr := json.Unmarshal([]byte(user.Jurisdiction), &surisdictionStr)
+ if jsonErr == nil {
+ for _, jurVal := range surisdictionStr {
+ jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64)
+ if jurValErr == nil {
+ surisdictionInt = append(surisdictionInt, jurValInt)
+ }
+
+ }
+
+ }
+ global.Gva_Authority_Authentication = surisdictionInt
+ var menuOperStr []string
+ var menuOperInts []int64
+ jsonErrSun := json.Unmarshal([]byte(user.MenuOper), &menuOperStr)
+ if jsonErrSun == nil {
+ for _, menuOperVal := range menuOperStr {
+ menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
+ if menuOperErr == nil {
+ menuOperInts = append(menuOperInts, menuOperInt)
+ }
+
+ }
+ }
+ global.Gva_Authority_Authentication_Subsidiary = menuOperInts
+ saveData["Jurisdiction"] = global.Gva_Authority_Authentication
+ saveData["MenuOper"] = global.Gva_Authority_Authentication_Subsidiary
+
+ // saveData["jsonErr"] = jsonErr
+ // saveData["jsonErrSun"] = jsonErrSun
+
+ response.Result(0, saveData, "登录成功!", c)
+ }
+ // } else {
+ // response.FailWithMessage("验证码错误", c)
+ // }
+}
diff --git a/gin_server_admin/api/v1/custom/customtype.go b/gin_server_admin/api/v1/custom/customtype.go
new file mode 100644
index 0000000..dea43ac
--- /dev/null
+++ b/gin_server_admin/api/v1/custom/customtype.go
@@ -0,0 +1,7 @@
+package custom
+
+import "github.com/mojocn/base64Captcha"
+
+var store = base64Captcha.DefaultMemStore
+
+type CustomHandle struct{}
diff --git a/gin_server_admin/api/v1/custom/enter.go b/gin_server_admin/api/v1/custom/enter.go
new file mode 100644
index 0000000..81d00ee
--- /dev/null
+++ b/gin_server_admin/api/v1/custom/enter.go
@@ -0,0 +1,5 @@
+package custom
+
+type ApiGroup struct {
+ CustomHandle
+}
diff --git a/gin_server_admin/api/v1/enter.go b/gin_server_admin/api/v1/enter.go
index b35adc9..0e8d4b0 100644
--- a/gin_server_admin/api/v1/enter.go
+++ b/gin_server_admin/api/v1/enter.go
@@ -2,13 +2,17 @@ package v1
import (
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/archiveapi"
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/assessment"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/autocode"
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/custom"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/examination"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/example"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/examtestpage"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/fileuploaddownload"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/shiyan"
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/staff"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/system"
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/systemuser"
"github.com/flipped-aurora/gin-vue-admin/server/api/v1/wechatcallback"
)
@@ -22,6 +26,10 @@ type ApiGroup struct {
ArchiveApi archiveapi.ApiGroup
FileUploadOrDownloadApi fileuploaddownload.ApiGroup
ExamQuestions examination.ApiGroup
+ DutyHandleApi assessment.ApiGroup
+ StaffApi staff.ApiGroup
+ CustomApi custom.ApiGroup
+ SystemApi systemuser.ApiGroup
}
var ApiGroupApp = new(ApiGroup)
diff --git a/gin_server_admin/api/v1/staff/enter.go b/gin_server_admin/api/v1/staff/enter.go
new file mode 100644
index 0000000..0de295f
--- /dev/null
+++ b/gin_server_admin/api/v1/staff/enter.go
@@ -0,0 +1,5 @@
+package staff
+
+type ApiGroup struct {
+ StaffPeople
+}
diff --git a/gin_server_admin/api/v1/staff/staffpeople.go b/gin_server_admin/api/v1/staff/staffpeople.go
new file mode 100644
index 0000000..b02590b
--- /dev/null
+++ b/gin_server_admin/api/v1/staff/staffpeople.go
@@ -0,0 +1,210 @@
+package staff
+
+import (
+ "strconv"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/assessment"
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/testpage"
+ "github.com/gin-gonic/gin"
+)
+
+//员工
+
+type StaffPeople struct{}
+
+func (s *StaffPeople) Index(c *gin.Context) {
+ outPut := commonus.MapOut()
+ response.Result(0, outPut, "获取成功", c)
+}
+
+//获得员工列表
+func (s *StaffPeople) StaffList(c *gin.Context) {
+ var requestData staffRequest
+ err := c.ShouldBindJSON(&requestData)
+ if err != nil {
+ // response.Result(101, err, "参数错误!请重新提交!", c)
+ // return
+ }
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+
+ gormDb := global.GVA_DB_Master.Model(&testpage.WorkMan{}).Select("worker_man.*,worker_man_data.*").Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key")
+
+ if requestData.GroupId != 0 {
+ gormDb = gormDb.Where("`wm_group` = ?", requestData.GroupId)
+ }
+
+ if requestData.BranchFactoryId != 0 {
+ gormDb = gormDb.Where("`wm_bf_id` = ?", requestData.BranchFactoryId)
+ }
+ if requestData.PostId != 0 {
+ gormDb = gormDb.Where("`wm_ws_id` = ?", requestData.PostId)
+ }
+ if requestData.JobId != 0 {
+ gormDb = gormDb.Where("`wm_pt_id` = ?", requestData.JobId)
+ }
+
+ if requestData.UserName != "" {
+ gormDb = gormDb.Where("wmd_name LIKE ?", "%"+requestData.UserName+"%")
+ }
+
+ if requestData.State != 0 {
+ gormDb = gormDb.Where("`wm_set` = ?", requestData.State)
+ } else {
+ gormDb = gormDb.Where("`wm_set` IN ?", []int{1, 2})
+ }
+
+ var total int64
+ totalErr := gormDb.Count(&total).Error
+ if totalErr != nil {
+ total = 0
+ }
+ var staffList []testpage.PersonalDetails
+ staffListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Order("wm_id desc").Find(&staffList).Error
+ if staffListerr != nil {
+ response.Result(103, staffListerr, "数据获取失败!", c)
+ return
+ }
+ var staffMap []staffOutInfo
+ for _, val := range staffList {
+ var staffInfo staffOutInfo
+
+ staffInfo.Id = val.Id
+
+ staffInfo.Number = val.Number
+ staffInfo.Password = val.Password
+ staffInfo.DepartmentId = val.DepartmentId
+ staffInfo.WorkshopId = val.WorkshopId
+ staffInfo.PostId = val.PostId
+ staffInfo.Key = val.Key
+ staffInfo.State = val.State
+ staffInfo.HireSet = val.HireSet
+ staffInfo.Time = val.Time
+ staffInfo.EiteTime = val.EiteTime
+ staffInfo.UserId = val.UserId
+ staffInfo.QuitTime = val.QuitTime
+ staffInfo.Group = val.Group
+ staffInfo.Soptcheck = val.Soptcheck
+ staffInfo.Tema = val.Tema
+ staffInfo.IsOne = val.IsOne
+ staffInfo.WorkWechatId = val.WorkWechatId
+ staffInfo.WechatId = val.WechatId
+
+ staffInfo.KeyAttr = val.KeyAttr
+ staffInfo.Name = val.Name
+ staffInfo.Gender = val.Gender
+ staffInfo.Age = val.Age
+ staffInfo.Tel = val.Tel
+ staffInfo.Category = val.Category
+ staffInfo.CertificatesType = val.CertificatesType
+ staffInfo.CertificatesNum = val.CertificatesNum
+ staffInfo.Birthday = val.Birthday
+ staffInfo.EntryTime = val.EntryTime
+ staffInfo.QuitTimeAttr = val.QuitTimeAttr
+ staffInfo.EiteTimeAttr = val.EiteTimeAttr
+ staffInfo.Addrest = val.Addrest
+ staffInfo.Icon = val.Icon
+ staffInfo.NickName = val.NickName
+
+ staffInfo.KeyStr = strconv.FormatInt(val.Key, 10)
+
+ isTrueBranFact, branFactCont := assessment.GetBranchFactory(val.DepartmentId)
+ if isTrueBranFact == true {
+ staffInfo.BranchFactory = branFactCont.Name
+ }
+ isTrueGroup, groupCont := assessment.GetGroupCont(val.Group)
+ if isTrueGroup == true {
+ staffInfo.GroupTitle = groupCont.Name
+ }
+
+ isTrueWork, workCont := commonus.GetWorkShopSection(val.WorkshopId)
+ if isTrueWork == true {
+ staffInfo.PostTitle = workCont.Name
+ }
+
+ staffMap = append(staffMap, staffInfo)
+ }
+ countSum := len(staffMap)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, staffMap)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//通过账号密码获取用户信息
+func GetUserWork(userName, userPwd string) (isTrue bool, staffInfo staffOutInfo) {
+ isTrue = false
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userPwd)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+ var userInfo testpage.PersonalDetails
+ userErr := global.GVA_DB_Master.Model(&testpage.WorkMan{}).Select("worker_man.*,worker_man_data.*").Joins("left join worker_man_data on worker_man_data.wmd_key = worker_man.wm_key").Where("`wm_number` = ? AND `wm_pwd` = ?", userName, md5Token).First(&userInfo).Error
+
+ if userErr != nil {
+ return
+ }
+ // var staffInfo staffOutInfo
+ // fmt.Printf("------->%v\n", userInfo.Id)
+ staffInfo.Id = userInfo.Id
+
+ staffInfo.Number = userInfo.Number
+ staffInfo.Password = userInfo.Password
+ staffInfo.DepartmentId = userInfo.DepartmentId
+ staffInfo.WorkshopId = userInfo.WorkshopId
+ staffInfo.PostId = userInfo.PostId
+ staffInfo.Key = userInfo.Key
+ staffInfo.State = userInfo.State
+ staffInfo.HireSet = userInfo.HireSet
+ staffInfo.Time = userInfo.Time
+ staffInfo.EiteTime = userInfo.EiteTime
+ staffInfo.UserId = userInfo.UserId
+ staffInfo.QuitTime = userInfo.QuitTime
+ staffInfo.Group = userInfo.Group
+ staffInfo.Soptcheck = userInfo.Soptcheck
+ staffInfo.Tema = userInfo.Tema
+ staffInfo.IsOne = userInfo.IsOne
+ staffInfo.WorkWechatId = userInfo.WorkWechatId
+ staffInfo.WechatId = userInfo.WechatId
+
+ staffInfo.KeyAttr = userInfo.KeyAttr
+ staffInfo.Name = userInfo.Name
+ staffInfo.Gender = userInfo.Gender
+ staffInfo.Age = userInfo.Age
+ staffInfo.Tel = userInfo.Tel
+ staffInfo.Category = userInfo.Category
+ staffInfo.CertificatesType = userInfo.CertificatesType
+ staffInfo.CertificatesNum = userInfo.CertificatesNum
+ staffInfo.Birthday = userInfo.Birthday
+ staffInfo.EntryTime = userInfo.EntryTime
+ staffInfo.QuitTimeAttr = userInfo.QuitTimeAttr
+ staffInfo.EiteTimeAttr = userInfo.EiteTimeAttr
+ staffInfo.Addrest = userInfo.Addrest
+ staffInfo.Icon = userInfo.Icon
+ staffInfo.NickName = userInfo.NickName
+
+ staffInfo.KeyStr = strconv.FormatInt(userInfo.Key, 10)
+
+ isTrueBranFact, branFactCont := assessment.GetBranchFactory(userInfo.DepartmentId)
+ if isTrueBranFact == true {
+ staffInfo.BranchFactory = branFactCont.Name
+ }
+ isTrueGroup, groupCont := assessment.GetGroupCont(userInfo.Group)
+ if isTrueGroup == true {
+ staffInfo.GroupTitle = groupCont.Name
+ }
+
+ isTrueWork, workCont := commonus.GetWorkShopSection(userInfo.WorkshopId)
+ if isTrueWork == true {
+ staffInfo.PostTitle = workCont.Name
+ }
+ isTrue = true
+
+ // fmt.Printf("&&&&&&&&&&&>%v\n", staffInfo)
+ return
+}
diff --git a/gin_server_admin/api/v1/staff/stafftype.go b/gin_server_admin/api/v1/staff/stafftype.go
new file mode 100644
index 0000000..8ad955f
--- /dev/null
+++ b/gin_server_admin/api/v1/staff/stafftype.go
@@ -0,0 +1,27 @@
+package staff
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/testpage"
+)
+
+type staffRequest struct {
+ commonus.PageSetLimt
+ GroupId int `json:"groupId"`
+ BranchFactoryId int `json:"branchFactoryId"`
+ PostId int `json:"postId"`
+ JobId int `json:"jobId"`
+ State int `json:"state"`
+ UserName string `json:"username"`
+}
+
+//输出员工信息
+type staffOutInfo struct {
+ testpage.PersonalDetails
+ KeyStr string `json:"keystr"`
+ GroupTitle string `json:"grouptitle"`
+ BranchFactory string `json:"branchFactory"`
+ PostTitle string `json:"postTitle"`
+ JobTitle string `json:"jobTitle"`
+ TemaTitle string `json:"temaTitle"`
+}
diff --git a/gin_server_admin/api/v1/systemuser/adminrole.go b/gin_server_admin/api/v1/systemuser/adminrole.go
new file mode 100644
index 0000000..6244eb9
--- /dev/null
+++ b/gin_server_admin/api/v1/systemuser/adminrole.go
@@ -0,0 +1,24 @@
+package systemuser
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/systemuser"
+ "github.com/gin-gonic/gin"
+)
+
+//角色相关
+
+/*
+角色列表
+*/
+func (s *SystemRoleApi) SystemRoleList(c *gin.Context) {}
+
+//获取角色详细内容
+func GetAdminRoleInfo(id int64) (isTrue bool, adminRoleInfo systemuser.SystemRole) {
+ isTrue = false
+ err := global.GVA_DB_Master.Where("r_id = ?", id).First(&adminRoleInfo).Error
+ if err == nil {
+ isTrue = true
+ }
+ return
+}
diff --git a/gin_server_admin/api/v1/systemuser/enter.go b/gin_server_admin/api/v1/systemuser/enter.go
new file mode 100644
index 0000000..785906a
--- /dev/null
+++ b/gin_server_admin/api/v1/systemuser/enter.go
@@ -0,0 +1,7 @@
+package systemuser
+
+type ApiGroup struct {
+ SystemUserApi
+ SystemRoleApi
+ SysTemMenuApi
+}
diff --git a/gin_server_admin/api/v1/systemuser/systemmenu.go b/gin_server_admin/api/v1/systemuser/systemmenu.go
new file mode 100644
index 0000000..f5f4f8f
--- /dev/null
+++ b/gin_server_admin/api/v1/systemuser/systemmenu.go
@@ -0,0 +1,78 @@
+package systemuser
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/systemuser"
+ "github.com/gin-gonic/gin"
+)
+
+//菜单相关
+func (s *SysTemMenuApi) SystemMenuList(c *gin.Context) {
+ // response.Result(101, global.Gva_Authority_Authentication, "数据获取失败!", c)
+ var systemMenuList []systemuser.SystemMenu
+ menuOperErr := global.GVA_DB_Master.Where("`m_steat` IN ?", []int{1, 2}).Order("m_id desc").Find(&systemMenuList).Error
+ if menuOperErr != nil {
+ response.Result(101, menuOperErr, "数据获取失败!", c)
+ return
+ }
+ systemListMenu := GetMenuThree(1, 0, systemMenuList)
+ response.Result(0, systemListMenu, "数据获取成功!", c)
+}
+
+//递归无限树
+func GetMenuThree(jurisd int, parentId int64, threeData []systemuser.SystemMenu) []SystemMenuThree {
+ treeList := []SystemMenuThree{}
+ for _, v := range threeData {
+ if v.ParentId == parentId {
+ child := GetMenuThree(jurisd, v.Id, threeData)
+ node := SystemMenuThree{
+ Id: v.Id,
+ Title: v.Title,
+ State: v.State,
+ ParentId: v.ParentId,
+ ApiUrl: v.ApiUrl,
+ Time: v.Time,
+ EiteTime: v.EiteTime,
+ UserId: v.UserId,
+ Sort: v.Sort,
+ }
+ isTrue, menuOper := MenuOperation(jurisd, v.Id)
+ if isTrue == true {
+ node.MenuOperation = menuOper
+ }
+ node.Child = child
+ treeList = append(treeList, node)
+ }
+ }
+ return treeList
+}
+
+//获取菜单操作项目
+func MenuOperation(jurisd int, menuId int64) (isTrue bool, operation []systemuser.MenuOperation) {
+ isTrue = false
+ if jurisd != 1 {
+ operErr := global.GVA_DB_Master.Where("`menu_id` = ? AND oper_id IN ?", menuId, global.Gva_Authority_Authentication).Order("oper_id desc").Find(&operation).Error
+ if operErr == nil {
+ isTrue = true
+ }
+ } else {
+ operErr := global.GVA_DB_Master.Where("`menu_id` = ?", menuId).Order("oper_id desc").Find(&operation).Error
+ if operErr == nil {
+ isTrue = true
+ }
+ }
+ return
+}
+
+//获取左侧菜单栏
+func (s *SysTemMenuApi) GetMenu(c *gin.Context) {
+ var systemMenuList []systemuser.SystemMenu
+ menuOperErr := global.GVA_DB_Master.Where("`m_steat` IN ? AND m_id IN ?", []int{1, 2}, global.Gva_Authority_Authentication_Subsidiary).Order("m_id desc").Find(&systemMenuList).Error
+ if menuOperErr != nil {
+ response.Result(101, menuOperErr, "数据获取失败!", c)
+ return
+ }
+ systemListMenu := GetMenuThree(2, 0, systemMenuList)
+ response.Result(0, systemListMenu, "数据获取成功!", c)
+}
diff --git a/gin_server_admin/api/v1/systemuser/userhandle.go b/gin_server_admin/api/v1/systemuser/userhandle.go
new file mode 100644
index 0000000..d33cb03
--- /dev/null
+++ b/gin_server_admin/api/v1/systemuser/userhandle.go
@@ -0,0 +1,155 @@
+package systemuser
+
+import (
+ "strconv"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/api/v1/assessment"
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/systemuser"
+ "github.com/gin-gonic/gin"
+)
+
+//系统相关
+func (s *SystemUserApi) Index(c *gin.Context) {
+ outPut := commonus.MapOut()
+ response.Result(0, outPut, "获取成功", c)
+}
+
+//管理员列表
+func (s *SystemUserApi) AdminList(c *gin.Context) {
+ var requestData adminRequest
+ c.ShouldBindJSON(&requestData)
+ if requestData.PageSize == 0 {
+ requestData.PageSize = 20
+ }
+ if requestData.Page <= 0 {
+ requestData.Page = 1
+ }
+ offSetPage := commonus.CalculatePages(requestData.Page, requestData.PageSize)
+ gormDb := global.GVA_DB_Master.Model(&systemuser.SystemUser{}).Select("system_user.*,system_user_attribute.*").Joins("left join system_user_attribute on system_user.u_key = system_user_attribute.ua_id")
+
+ if requestData.GroupId != 0 {
+ gormDb = gormDb.Where("`u_group` = ?", requestData.GroupId)
+ }
+
+ if requestData.BranchFactoryId != 0 {
+ gormDb = gormDb.Where("`u_attribute` = ?", requestData.BranchFactoryId)
+ }
+
+ if requestData.RoleId != 0 {
+ gormDb = gormDb.Where("`u_role` = ?", requestData.RoleId)
+ }
+
+ if requestData.State != 0 {
+ gormDb = gormDb.Where("`u_set` = ?", requestData.State)
+ } else {
+ gormDb = gormDb.Where("`u_set` IN ?", []int{1, 2})
+ }
+
+ if requestData.UserName != "" {
+ gormDb = gormDb.Where("(`u_name` LIKE ? OR `ua_name` LIKE ?)", "%"+requestData.UserName+"%", "%"+requestData.UserName+"%")
+ }
+ var total int64
+ totalErr := gormDb.Count(&total).Error
+ if totalErr != nil {
+ total = 0
+ }
+ var systemAdminList []systemuser.SystemAdminDetails
+ systemAdminListerr := gormDb.Limit(requestData.PageSize).Offset(offSetPage).Order("u_id desc").Find(&systemAdminList).Error
+ if systemAdminListerr != nil {
+ response.Result(101, systemAdminListerr, "数据获取失败!", c)
+ return
+ }
+ var sysAdminList []adminOutInfo
+ for _, val := range systemAdminList {
+ var sysAdminInfo adminOutInfo
+ sysAdminInfo.Id = val.Id
+ sysAdminInfo.Name = val.Name
+ sysAdminInfo.PassWord = val.PassWord
+ sysAdminInfo.Role = val.Role
+ sysAdminInfo.State = val.State
+ sysAdminInfo.Attribute = val.Attribute
+ sysAdminInfo.Time = val.Time
+ sysAdminInfo.EiteTime = val.EiteTime
+ sysAdminInfo.Key = val.Key
+ sysAdminInfo.Group = val.Group
+ sysAdminInfo.Wand = val.Wand
+ sysAdminInfo.IdAttr = val.IdAttr
+ sysAdminInfo.NameAttr = val.NameAttr
+ sysAdminInfo.Tel = val.Tel
+ sysAdminInfo.TimeAttr = val.TimeAttr
+
+ isTrueGroup, groupCont := assessment.GetGroupCont(val.Group)
+ if isTrueGroup == true {
+ sysAdminInfo.GroupName = groupCont.Name
+ }
+ isTrueBranFact, branFactCont := assessment.GetBranchFactory(val.Attribute)
+ if isTrueBranFact == true {
+ sysAdminInfo.BranchFactoryName = branFactCont.Name
+ }
+
+ isTrueRole, adminRoleCont := GetAdminRoleInfo(val.Role)
+ if isTrueRole == true {
+ sysAdminInfo.RoleName = adminRoleCont.Title
+ sysAdminInfo.Jurisdiction = adminRoleCont.Jurisdiction
+ sysAdminInfo.MenuOper = adminRoleCont.MenuOper
+ sysAdminInfo.Wand = adminRoleCont.Wand
+ }
+ sysAdminInfo.KeyStr = strconv.FormatInt(val.Key, 10)
+
+ sysAdminList = append(sysAdminList, sysAdminInfo)
+ }
+ countSum := len(sysAdminList)
+ printData := commonus.OutPutList(total, int64(countSum), requestData.Page, requestData.PageSize, sysAdminList)
+ response.Result(0, printData, "查询成功!", c)
+}
+
+//获取管理员详细内容登录
+func GetSysAdminLoginInfo(userName, userPwd string) (isTrue bool, sysAdminInfo adminOutInfo) {
+ isTrue = false
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userPwd)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+ var userInfo systemuser.SystemAdminDetails
+ userErr := global.GVA_DB_Master.Model(&systemuser.SystemUser{}).Select("system_user.*,system_user_attribute.*").Joins("left join system_user_attribute on system_user.u_key = system_user_attribute.ua_id").Where("`u_name` = ? AND `u_password` = ?", userName, md5Token).First(&userInfo).Error
+ if userErr != nil {
+ return
+ }
+ sysAdminInfo.Id = userInfo.Id
+ sysAdminInfo.Name = userInfo.Name
+ sysAdminInfo.PassWord = userInfo.PassWord
+ sysAdminInfo.Role = userInfo.Role
+ sysAdminInfo.State = userInfo.State
+ sysAdminInfo.Attribute = userInfo.Attribute
+ sysAdminInfo.Time = userInfo.Time
+ sysAdminInfo.EiteTime = userInfo.EiteTime
+ sysAdminInfo.Key = userInfo.Key
+ sysAdminInfo.Group = userInfo.Group
+ sysAdminInfo.Wand = userInfo.Wand
+ sysAdminInfo.IdAttr = userInfo.IdAttr
+ sysAdminInfo.NameAttr = userInfo.NameAttr
+ sysAdminInfo.Tel = userInfo.Tel
+ sysAdminInfo.TimeAttr = userInfo.TimeAttr
+
+ isTrueGroup, groupCont := assessment.GetGroupCont(userInfo.Group)
+ if isTrueGroup == true {
+ sysAdminInfo.GroupName = groupCont.Name
+ }
+ isTrueBranFact, branFactCont := assessment.GetBranchFactory(userInfo.Attribute)
+ if isTrueBranFact == true {
+ sysAdminInfo.BranchFactoryName = branFactCont.Name
+ }
+
+ isTrueRole, adminRoleCont := GetAdminRoleInfo(userInfo.Role)
+ if isTrueRole == true {
+ sysAdminInfo.RoleName = adminRoleCont.Title
+ sysAdminInfo.Jurisdiction = adminRoleCont.Jurisdiction
+ sysAdminInfo.MenuOper = adminRoleCont.MenuOper
+ sysAdminInfo.Wand = adminRoleCont.Wand
+ }
+ sysAdminInfo.KeyStr = strconv.FormatInt(userInfo.Key, 10)
+ isTrue = true
+ return
+}
diff --git a/gin_server_admin/api/v1/systemuser/usertype.go b/gin_server_admin/api/v1/systemuser/usertype.go
new file mode 100644
index 0000000..2c9851e
--- /dev/null
+++ b/gin_server_admin/api/v1/systemuser/usertype.go
@@ -0,0 +1,51 @@
+package systemuser
+
+import (
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/systemuser"
+)
+
+type SystemUserApi struct{}
+
+//管理员列表查询
+type adminRequest struct {
+ commonus.PageSetLimt
+ GroupId int `json:"groupId"`
+ BranchFactoryId int `json:"branchFactoryId"`
+ RoleId int `json:"roleId"`
+ State int `json:"state"`
+ UserName string `json:"username"`
+}
+
+//管理员输出
+type adminOutInfo struct {
+ systemuser.SystemAdminDetails
+ RoleName string `json:"roleName"`
+ GroupName string `json:"groupName"`
+ BranchFactoryName string `json:"branchFactoryName"`
+ KeyStr string `json:"keyStr"`
+ Jurisdiction string `json:"jurisdiction"`
+ MenuOper string `json:"menuoper"`
+ Wand int `json:"wand"`
+}
+
+//角色相关
+type SystemRoleApi struct{}
+
+//菜单相关
+type SysTemMenuApi struct{}
+
+//菜单递给
+type SystemMenuThree struct {
+ Id int64 `json:"id"`
+ Title string `json:"title"`
+ State int `json:"state"`
+ ParentId int64 `json:"parentId"`
+ ApiUrl string `json:"apiUrl"`
+ Time int64 `json:"time"`
+ EiteTime int64 `json:"eiteTime"`
+ UserId int64 `json:"userId"`
+ Sort int `json:"sort"`
+ Child []SystemMenuThree `json:"child"`
+ MenuOperation []systemuser.MenuOperation `json:"menuOperation"`
+}
diff --git a/gin_server_admin/commonus/md5Sub.go b/gin_server_admin/commonus/md5Sub.go
index d7d16d7..7187a22 100644
--- a/gin_server_admin/commonus/md5Sub.go
+++ b/gin_server_admin/commonus/md5Sub.go
@@ -3,6 +3,8 @@ package commonus
import (
"crypto/md5"
"crypto/rand"
+ "crypto/sha1"
+ "encoding/hex"
"fmt"
"math/big"
"strconv"
@@ -84,3 +86,10 @@ func (m *Md5Encryption) Md5EncryptionInit(code string) {
m.AppKey = global.GVA_CONFIG.MyConfig.AppKey
m.Code = code
}
+
+//sha1算法
+func Sha1Encryption(str string) string {
+ sha1 := sha1.New()
+ sha1.Write([]byte(str))
+ return hex.EncodeToString(sha1.Sum(nil))
+}
diff --git a/gin_server_admin/commonus/publichaneld.go b/gin_server_admin/commonus/publichaneld.go
index 611e8a9..7be45d7 100644
--- a/gin_server_admin/commonus/publichaneld.go
+++ b/gin_server_admin/commonus/publichaneld.go
@@ -581,3 +581,14 @@ func JudgeHttpOrHttps(urlStr string) (isTrue bool) {
}
return
}
+
+//获取工段信息
+func GetWorkShopSection(id int64) (isTrue bool, workShopesStruct testpage.WorkShopsection) { //工段表结构
+ isTrue = false
+ err := global.GVA_DB_Master.Where("ws_id = ?", id).First(&workShopesStruct).Error //获取工段信息
+ if err != nil {
+ return
+ }
+ isTrue = true
+ return
+}
diff --git a/gin_server_admin/commonus/weChatDateType.go b/gin_server_admin/commonus/weChatDateType.go
index 4637e82..c8b62e2 100644
--- a/gin_server_admin/commonus/weChatDateType.go
+++ b/gin_server_admin/commonus/weChatDateType.go
@@ -356,3 +356,36 @@ type RegionalRiskLevel struct {
RiskText string `json:"riskText"` //风险名称
RiskLevel int `json:"riskLevel"` //风险等级 0:无;1:低风险;2:中低风险;3:中风险;4:中高风险;5:高风险
}
+
+//自定义登录鉴权
+type MyCustomLogonIdentify struct {
+ UserKey string `json:"userkey"`
+ UserNumber string `json:"usernumber"`
+ UserPwd string `json:"userpwd"`
+ UserToken string `json:"usertoken"`
+}
+
+func (m *MyCustomLogonIdentify) MyCustomLogonIdentifyInit() {
+ m.UserKey = ""
+ m.UserNumber = ""
+ m.UserPwd = ""
+ m.UserToken = ""
+}
+
+//自定义后台登录鉴权
+type MyCustomAdminLogonIdentify struct {
+ UserKey string `json:"userkey"`
+ UserNumber string `json:"usernumber"`
+ UserPwd string `json:"userpwd"`
+ UserToken string `json:"usertoken"`
+ Jurisdiction string `json:"jurisdiction"`
+ MenuOper string `json:"menuoper"`
+ Wand string `json:"wand"`
+}
+
+func (m *MyCustomAdminLogonIdentify) MyCustomAdminLogonIdentifyInit() {
+ m.UserKey = ""
+ m.UserNumber = ""
+ m.UserPwd = ""
+ m.UserToken = ""
+}
diff --git a/gin_server_admin/config.yaml b/gin_server_admin/config.yaml
index ee3382a..f17b16f 100644
--- a/gin_server_admin/config.yaml
+++ b/gin_server_admin/config.yaml
@@ -277,6 +277,19 @@ mysqlApprovalProcess:
log-mode: false
log-zap: ""
+ #绩效考核数据库
+mysqlPerformanceappraisal:
+ path: '127.0.0.1:3306'
+ config: 'charset=utf8mb4&parseTime=True&loc=Local'
+ db-name: 'performanceappraisal'
+ username: 'root'
+ password: 'root'
+ max-idle-conns: 100
+ max-open-conns: 1500
+ log-mode: false
+ log-zap: ""
+
+
#企业微信相关设置
workwechatid:
companyid: 'ww02f310301953277a' #企业ID
diff --git a/gin_server_admin/config/config.go b/gin_server_admin/config/config.go
index f428afe..29ec105 100644
--- a/gin_server_admin/config/config.go
+++ b/gin_server_admin/config/config.go
@@ -14,17 +14,18 @@ type Server struct {
// gorm
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
//其他数据库配置
- MysqlMaster Mysql `mapstructure:"mysqlMaster" json:"mysqlMaster" yaml:"mysqlMaster"`
- MysqlBookDate Mysql `mapstructure:"mysqlBookDate" json:"mysqlBookDate" yaml:"mysqlBookDate"`
- MysqlWatchDate Mysql `mapstructure:"mysqlWatchDate" json:"mysqlWatchDate" yaml:"mysqlWatchDate"`
- MysqlErrorSubjectDate Mysql `mapstructure:"mysqlErrorSubjectDate" json:"mysqlErrorSubjectDate" yaml:"mysqlErrorSubjectDate"`
- MysqlMyTestDate Mysql `mapstructure:"mysqlMyTestDate" json:"mysqlMyTestDate" yaml:"mysqlMyTestDate"`
- MysqlBooImgkDate Mysql `mapstructure:"mysqlBooImgkDate" json:"mysqlBooImgkDate" yaml:"mysqlBooImgkDate"`
- MysqlIntegralDate Mysql `mapstructure:"mysqlIntegralDate" json:"mysqlIntegralDate" yaml:"mysqlIntegralDate"`
- MysqlQADate Mysql `mapstructure:"mysqlQADate" json:"mysqlQADate" yaml:"mysqlQADate"`
- MysqlBillboardDate Mysql `mapstructure:"mysqlBillboardDate" json:"mysqlBillboardDate" yaml:"mysqlBillboardDate"`
- MysqlHealthReportDate Mysql `mapstructure:"mysqlHealthReportDate" json:"mysqlHealthReportDate" yaml:"mysqlHealthReportDate"`
- MysqlApprovalProcess Mysql `mapstructure:"mysqlApprovalProcess" json:"mysqlApprovalProcess" yaml:"mysqlApprovalProcess"`
+ MysqlMaster Mysql `mapstructure:"mysqlMaster" json:"mysqlMaster" yaml:"mysqlMaster"`
+ MysqlBookDate Mysql `mapstructure:"mysqlBookDate" json:"mysqlBookDate" yaml:"mysqlBookDate"`
+ MysqlWatchDate Mysql `mapstructure:"mysqlWatchDate" json:"mysqlWatchDate" yaml:"mysqlWatchDate"`
+ MysqlErrorSubjectDate Mysql `mapstructure:"mysqlErrorSubjectDate" json:"mysqlErrorSubjectDate" yaml:"mysqlErrorSubjectDate"`
+ MysqlMyTestDate Mysql `mapstructure:"mysqlMyTestDate" json:"mysqlMyTestDate" yaml:"mysqlMyTestDate"`
+ MysqlBooImgkDate Mysql `mapstructure:"mysqlBooImgkDate" json:"mysqlBooImgkDate" yaml:"mysqlBooImgkDate"`
+ MysqlIntegralDate Mysql `mapstructure:"mysqlIntegralDate" json:"mysqlIntegralDate" yaml:"mysqlIntegralDate"`
+ MysqlQADate Mysql `mapstructure:"mysqlQADate" json:"mysqlQADate" yaml:"mysqlQADate"`
+ MysqlBillboardDate Mysql `mapstructure:"mysqlBillboardDate" json:"mysqlBillboardDate" yaml:"mysqlBillboardDate"`
+ MysqlHealthReportDate Mysql `mapstructure:"mysqlHealthReportDate" json:"mysqlHealthReportDate" yaml:"mysqlHealthReportDate"`
+ MysqlApprovalProcess Mysql `mapstructure:"mysqlApprovalProcess" json:"mysqlApprovalProcess" yaml:"mysqlApprovalProcess"`
+ MysqlPerformanceappraisal Mysql `mapstructure:"mysqlPerformanceappraisal" json:"mysqlPerformanceappraisal" yaml:"mysqlPerformanceappraisal"`
// oss
Local Local `mapstructure:"local" json:"local" yaml:"local"`
diff --git a/gin_server_admin/global/global.go b/gin_server_admin/global/global.go
index 7f59061..bfc4e81 100644
--- a/gin_server_admin/global/global.go
+++ b/gin_server_admin/global/global.go
@@ -28,18 +28,24 @@ var (
BlackCache local_cache.Cache
//其他数据库配置
- GVA_DB_Master *gorm.DB
- GVA_DB_BookDate *gorm.DB
- GVA_DB_WatchDate *gorm.DB
- GVA_DB_ErrorSubjectDate *gorm.DB
- GVA_DB_MyTestDate *gorm.DB
- GVA_DB_BooImgkDate *gorm.DB
- GVA_DB_IntegralDate *gorm.DB
- GVA_DB_QADate *gorm.DB
- GVA_DB_BillboardDate *gorm.DB
- GVA_DB_HealthReport *gorm.DB
- GVA_DB_ApprovalProcess *gorm.DB
+ GVA_DB_Master *gorm.DB
+ GVA_DB_BookDate *gorm.DB
+ GVA_DB_WatchDate *gorm.DB
+ GVA_DB_ErrorSubjectDate *gorm.DB
+ GVA_DB_MyTestDate *gorm.DB
+ GVA_DB_BooImgkDate *gorm.DB
+ GVA_DB_IntegralDate *gorm.DB
+ GVA_DB_QADate *gorm.DB
+ GVA_DB_BillboardDate *gorm.DB
+ GVA_DB_HealthReport *gorm.DB
+ GVA_DB_ApprovalProcess *gorm.DB
+ GVA_DB_Performanceappraisal *gorm.DB
//个人配置
// GVA_MyConfig config.MyConfig
+ //鉴权
+ GVA_INDEX_USERKEY int64
+ GVA_ADMIN_USERKEY int64
+ Gva_Authority_Authentication []int64
+ Gva_Authority_Authentication_Subsidiary []int64
)
diff --git a/gin_server_admin/initialize/gorm.go b/gin_server_admin/initialize/gorm.go
index 1a4536c..793bf7b 100644
--- a/gin_server_admin/initialize/gorm.go
+++ b/gin_server_admin/initialize/gorm.go
@@ -154,6 +154,8 @@ func GormMysqlChange(setDataBaseName string) *gorm.DB {
m = global.GVA_CONFIG.MysqlHealthReportDate
case "mysqlApprovalProcess":
m = global.GVA_CONFIG.MysqlApprovalProcess
+ case "mysqlPerformanceappraisal":
+ m = global.GVA_CONFIG.MysqlPerformanceappraisal
default:
m = global.GVA_CONFIG.Mysql
}
diff --git a/gin_server_admin/initialize/router.go b/gin_server_admin/initialize/router.go
index f108e8e..7d9f88f 100644
--- a/gin_server_admin/initialize/router.go
+++ b/gin_server_admin/initialize/router.go
@@ -53,6 +53,10 @@ func Routers() *gin.Engine {
examtions := router.RouterGroupApp.ExamQuest.ExamRouter //考试相关
Questions := router.RouterGroupApp.ExamQuest.QuestionsRouter //试题相关
+ dutyAssEss := router.RouterGroupApp.DutyAssEssRout.AssessmentRouter //考核相关
+
+ staffMan := router.RouterGroupApp.StaffRouter.StaffRouter //员工相关操作
+
PublicGroup := Router.Group("")
{
PublicGroup.GET("/", func(c *gin.Context) {
@@ -80,11 +84,17 @@ func Routers() *gin.Engine {
fileUpDownApi.InitGroupRouter(PublicGroup) //文档上传与下载
examtions.InitGroupRouter(PublicGroup) //考试相关
- Questions.InitGroupRouter(PublicGroup) //试题相关
+ // Questions.InitGroupRouter(PublicGroup) //试题相关
+
+ dutyAssEss.InitAssessmentRouter(PublicGroup) //数据考核
+
+ // staffMan.InitStaffRouter(PublicGroup) //员工相关操作
+
}
PrivateGroup := Router.Group("")
PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
{
+
systemRouter.InitApiRouter(PrivateGroup) // 注册功能api路由
systemRouter.InitJwtRouter(PrivateGroup) // jwt相关路由
systemRouter.InitUserRouter(PrivateGroup) // 注册用户路由
@@ -100,6 +110,7 @@ func Routers() *gin.Engine {
exampleRouter.InitExcelRouter(PrivateGroup) // 表格导入导出
exampleRouter.InitCustomerRouter(PrivateGroup) // 客户路由
+ // staffMan.InitStaffRouter(PrivateGroup) //员工相关操作
// groupHandleRouter.InitGroupRouter(PrivateGroup) //集团架构
// groupHandleRouter.InitHealthReporRouter(PrivateGroup) //健康上报
@@ -108,6 +119,22 @@ func Routers() *gin.Engine {
// Code generated by github.com/flipped-aurora/gin-vue-admin/server End; DO NOT EDIT.
}
+ //自定义登录验证
+ MyCustomPrivateGroup := Router.Group("")
+ MyCustomPrivateGroup.Use(middleware.MyAuthentication()).Use(middleware.MyCasbinHandler())
+ {
+ staffMan.InitStaffRouter(MyCustomPrivateGroup) //员工相关操作
+
+ dutyAssEss.InitDutyHandelRouter(MyCustomPrivateGroup) //前端数据考核
+ }
+ //自定义后台登录
+ MyCustomSystemGroup := Router.Group("")
+ MyCustomSystemGroup.Use(middleware.SystemAuthentication()).Use(middleware.MyCasbinHandler())
+ {
+ Questions.InitGroupRouter(MyCustomSystemGroup) //试题相关
+ systemRouter.InitSystemAdminRouter(MyCustomSystemGroup) //系统管理员
+ }
+
InstallPlugin(PublicGroup, PrivateGroup) // 安装插件
global.GVA_LOG.Info("router register success")
diff --git a/gin_server_admin/main.go b/gin_server_admin/main.go
index 490aed9..3729efd 100644
--- a/gin_server_admin/main.go
+++ b/gin_server_admin/main.go
@@ -79,6 +79,10 @@ func main() {
if global.GVA_DB_ApprovalProcess != nil {
fmt.Printf("%v==>数据库mysqlApprovalProcess初始化成功\n", global.GVA_DB_ApprovalProcess)
}
+ global.GVA_DB_Performanceappraisal = initialize.GormMysqlChange("mysqlPerformanceappraisal")
+ if global.GVA_DB_Performanceappraisal != nil {
+ fmt.Printf("%v==>数据库mysqlApprovalProcess初始化成功\n", global.GVA_DB_Performanceappraisal)
+ }
// fmt.Printf("jkskd => %v===>%v----->%v\n", global.GVA_CONFIG.MyConfig.AppKey, global.GVA_CONFIG.MyConfig.Visit, global.GVA_CONFIG)
// fmt.Printf("%v===>%v----->%v\n", global.GVA_CONFIG.WorkWechatIds, global.GVA_CONFIG.WorkWechatSchools, global.GVA_CONFIG.WorkWechatMailLists)MysqlHealthReportDate
core.RunWindowsServer()
diff --git a/gin_server_admin/middleware/myjwt.go b/gin_server_admin/middleware/myjwt.go
new file mode 100644
index 0000000..587d66d
--- /dev/null
+++ b/gin_server_admin/middleware/myjwt.go
@@ -0,0 +1,179 @@
+package middleware
+
+import (
+ "encoding/json"
+ "strconv"
+
+ "github.com/flipped-aurora/gin-vue-admin/server/commonus"
+ "github.com/flipped-aurora/gin-vue-admin/server/global"
+ "github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
+ "github.com/flipped-aurora/gin-vue-admin/server/service"
+ "github.com/flipped-aurora/gin-vue-admin/server/utils/redishandel"
+ "github.com/gin-gonic/gin"
+ "github.com/mitchellh/mapstructure"
+)
+
+//鉴权
+func MyAuthentication() gin.HandlerFunc {
+ return func(c *gin.Context) {
+ userKey := c.Request.Header.Get("user-key")
+ userToken := c.Request.Header.Get("user-token")
+ userAgent := c.Request.Header.Get("User-Agent")
+
+ if userKey == "" || userToken == "" || userAgent == "" {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 1}, "未登录或非法访问", c)
+ c.Abort()
+ return
+ }
+
+ redisClient := redishandel.RunRedis()
+ tokenInfo, isTrues := redisClient.HashGetAll("system:Identification_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKey)
+ var myCustomIdentify commonus.MyCustomLogonIdentify
+ if isTrues != true {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 2}, "您的帐户异地登陆或令牌失效", c)
+ c.Abort()
+ return
+ } else {
+ tokenErr := mapstructure.Decode(tokenInfo, &myCustomIdentify)
+ if tokenErr != nil {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 2}, "您的帐户异地登陆或令牌失效", c)
+ c.Abort()
+ return
+ }
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userAgent)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+ sha1Str := myCustomIdentify.UserKey + myCustomIdentify.UserNumber + myCustomIdentify.UserPwd + md5Token
+ sha1Token := commonus.Sha1Encryption(sha1Str)
+ // fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent)
+ if sha1Token != userToken {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 3}, "授权已过期", c)
+ c.Abort()
+ return
+ }
+ }
+ redisClient.SetRedisTime(10800)
+ writeRedisData := map[string]interface{}{
+ "userkey": myCustomIdentify.UserKey,
+ "usernumber": myCustomIdentify.UserNumber,
+ "userpwd": myCustomIdentify.UserPwd,
+ "usertoken": myCustomIdentify.UserToken,
+ }
+ redisClient.HashMsetAdd("system:Identification_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+userKey, writeRedisData)
+ c.Next()
+ }
+}
+
+var mycasbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
+
+// 拦截器
+func MyCasbinHandler() gin.HandlerFunc {
+ return func(c *gin.Context) {
+ // waitUse, _ := utils.GetClaims(c)
+ // 获取请求的URI
+ // obj := c.Request.URL.RequestURI()
+ // 获取请求方法
+ // act := c.Request.Method
+ // 获取用户的角色
+ // sub := waitUse.AuthorityId
+ // e := mycasbinService.Casbin()
+ // 判断策略中是否存在
+ // success, _ := e.Enforce(sub, obj, act)
+
+ // fmt.Printf("=====>%v===========>%v===========>%v===========>%v\n", e, obj, act, e)
+
+ // if global.GVA_CONFIG.System.Env == "develop" || success {
+ // c.Next()
+ // } else {
+ // response.FailWithDetailed(gin.H{}, "权限不足", c)
+ // c.Abort()
+ // return
+ // }
+ }
+}
+
+func SystemAuthentication() gin.HandlerFunc {
+ return func(c *gin.Context) {
+ userKey := c.Request.Header.Get("user-key")
+ userToken := c.Request.Header.Get("user-token")
+ userAgent := c.Request.Header.Get("User-Agent")
+
+ if userKey == "" || userToken == "" || userAgent == "" {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 101}, "未登录或非法访问", c)
+ c.Abort()
+ return
+ }
+ redisClient := redishandel.RunRedis()
+ tokenInfo, isTrues := redisClient.HashGetAll("system:SystemIdentification_" + global.GVA_CONFIG.RedisPrefix.Alias + "_" + userKey)
+ var myCustomIdentify commonus.MyCustomAdminLogonIdentify
+ if isTrues != true {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 102}, "您的帐户异地登陆或令牌失效", c)
+ c.Abort()
+ return
+ } else {
+ tokenErr := mapstructure.Decode(tokenInfo, &myCustomIdentify)
+ if tokenErr != nil {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 103, "tokenErr": tokenErr}, "您的帐户异地登陆或令牌失效", c)
+ c.Abort()
+ return
+ }
+ var md5JiaMi commonus.Md5Encryption
+ md5JiaMi.Md5EncryptionInit(userAgent)
+ md5Token := md5JiaMi.Md5EncryptionAlgorithm()
+ sha1Str := myCustomIdentify.UserKey + myCustomIdentify.UserNumber + myCustomIdentify.UserPwd + md5Token
+ sha1Token := commonus.Sha1Encryption(sha1Str)
+ // fmt.Printf("token=========>%v---->%v---->%v\n", md5Token, sha1Token, userAgent)
+ if sha1Token != userToken {
+ response.FailWithDetailed(gin.H{"reload": true, "code": 104}, "授权已过期", c)
+ c.Abort()
+ return
+ }
+ }
+ redisClient.SetRedisTime(10800)
+ writeRedisData := map[string]interface{}{
+ "userkey": myCustomIdentify.UserKey,
+ "usernumber": myCustomIdentify.UserNumber,
+ "userpwd": myCustomIdentify.UserPwd,
+ "usertoken": myCustomIdentify.UserToken,
+ "jurisdiction": myCustomIdentify.Jurisdiction,
+ "menuOper": myCustomIdentify.MenuOper,
+ "wand": myCustomIdentify.Wand,
+ }
+ var surisdictionStr []string
+ var surisdictionInt []int64
+ jsonErr := json.Unmarshal([]byte(myCustomIdentify.Jurisdiction), &surisdictionStr)
+ if jsonErr == nil {
+ for _, jurVal := range surisdictionStr {
+ jurValInt, jurValErr := strconv.ParseInt(jurVal, 10, 64)
+ if jurValErr == nil {
+ surisdictionInt = append(surisdictionInt, jurValInt)
+ }
+
+ }
+
+ }
+ global.Gva_Authority_Authentication = surisdictionInt
+ var menuOperStr []string
+ var menuOperInts []int64
+ jsonErrSun := json.Unmarshal([]byte(myCustomIdentify.MenuOper), &menuOperStr)
+ if jsonErrSun == nil {
+ for _, menuOperVal := range menuOperStr {
+ menuOperInt, menuOperErr := strconv.ParseInt(menuOperVal, 10, 64)
+ if menuOperErr == nil {
+ menuOperInts = append(menuOperInts, menuOperInt)
+ }
+
+ }
+ }
+ global.Gva_Authority_Authentication_Subsidiary = menuOperInts
+ redisClient.HashMsetAdd("system:SystemIdentification_"+global.GVA_CONFIG.RedisPrefix.Alias+"_"+userKey, writeRedisData)
+ c.Next()
+ }
+}
+
+// 拦截器
+func SystemCasbinHandler() gin.HandlerFunc {
+ return func(c *gin.Context) {
+
+ }
+}
diff --git a/gin_server_admin/model/assessmentmodel/dutyclass.go b/gin_server_admin/model/assessmentmodel/dutyclass.go
new file mode 100644
index 0000000..a00acf8
--- /dev/null
+++ b/gin_server_admin/model/assessmentmodel/dutyclass.go
@@ -0,0 +1,65 @@
+package assessmentmodel
+
+//职责类别
+type DutyClass struct {
+ Id int64 `json:"id" gorm:"column:id;type:bigint(20) unsigned;not null;comment:Id"`
+ Title string `json:"title" gorm:"column:title;type:varchar(255);comment:职责类别名称"`
+ Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:职能部门;2:生产部门)"`
+ Weight int `json:"weight" gorm:"column:weight;type:int(3) unsigned;default:0;not null;comment:权重比例"`
+ Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态"`
+}
+
+func (DutyClass *DutyClass) TableName() string {
+ return "dutyclass"
+}
+
+//履职考核表
+type DepartDuty struct {
+ Id int64 `json:"id" gorm:"column:de_id;type:bigint(20) unsigned;not null;comment:Id"`
+ Title string `json:"title" gorm:"column:de_title;type:varchar(255);comment:考核名称"`
+ State int `json:"state" gorm:"column:de_satte;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
+ Time int64 `json:"time" gorm:"column:de_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ PartId int64 `json:"partId" gorm:"column:de_partid;type:bigint(20) unsigned;default:0;not null;comment:部门ID"`
+ ClassId int64 `json:"classId" gorm:"column:de_class;type:bigint(20) unsigned;default:0;not null;comment:考核类别"`
+ AssessId int64 `json:"assessId" gorm:"column:de_assess;type:bigint(20) unsigned;default:0;not null;comment:考核项目"`
+ DutyId int64 `json:"dutyId" gorm:"column:de_duty;type:bigint(20) unsigned;default:0;not null;comment:具体职责"`
+ Rescore int64 `json:"rescore" gorm:"column:de_rescore;type:int(3) unsigned;default:0;not null;comment:参考分值"`
+ Group int64 `json:"group" gorm:"column:de_group;type:int(3) unsigned;default:0;not null;comment:集团"`
+}
+
+func (DepartDuty *DepartDuty) TableName() string {
+ return "departduty"
+}
+
+//职责详情
+type DutyContent struct {
+ Id int64 `json:"id" gorm:"column:dc_id;type:bigint(20) unsigned;not null;comment:Id"`
+ Title string `json:"title" gorm:"column:dc_title;type:text;comment:具体职责"`
+ Time int64 `json:"time" gorm:"column:dc_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ State int `json:"state" gorm:"column:dc_state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
+ PartId int64 `json:"partId" gorm:"column:dc_parent;type:bigint(20) unsigned;default:0;not null;comment:父级"`
+ UserType int `json:"userType" gorm:"column:dc_user_type;type:tinyint(1) unsigned;default:1;not null;comment:考核部门类型(1:指定人;2:指定部门)"`
+ UserDump int64 `json:"userDump" gorm:"column:dc_user_dump;type:bigint(20) unsigned;default:0;not null;comment:考核人执行人"`
+ Dump int64 `json:"dump" gorm:"column:dc_dump;type:bigint(20) unsigned;default:0;not null;comment:考核执行部门"`
+}
+
+func (DutyContent *DutyContent) TableName() string {
+ return "dutycontent"
+}
+
+//考核项目
+type AssessMentitems struct {
+ Id int64 `json:"id" gorm:"column:ai_id;type:bigint(20) unsigned;not null;comment:Id"`
+ Title string `json:"title" gorm:"column:ai_title;type:varchar(255);comment:考核类别"`
+ Weight int `json:"weight" gorm:"column:ai_weight;type:int(3) unsigned;default:0;not null;comment:权重比例"`
+ Fraction int `json:"fraction" gorm:"column:ai_fraction;type:int(3) unsigned;default:0;not null;comment:分数"`
+ Content string `json:"content" gorm:"column:ai_content;type:text;comment:说明"`
+ PartId int64 `json:"partId" gorm:"column:ai_parent;type:bigint(20) unsigned;default:0;not null;comment:父级"`
+ Time int64 `json:"time" gorm:"column:ai_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ State int `json:"state" gorm:"column:ai_state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
+}
+
+func (AssessMentitems *AssessMentitems) TableName() string {
+ return "assessmentitems"
+}
diff --git a/gin_server_admin/model/systemuser/systemmenu.go b/gin_server_admin/model/systemuser/systemmenu.go
new file mode 100644
index 0000000..6ab9536
--- /dev/null
+++ b/gin_server_admin/model/systemuser/systemmenu.go
@@ -0,0 +1,35 @@
+package systemuser
+
+//菜单
+type SystemMenu struct {
+ Id int64 `json:"id" gorm:"column:m_id;type:bigint(20) unsigned;not null;comment:ID"`
+ Title string `json:"title" gorm:"column:m_title;type:varchar(255);not null;comment:菜单名称"`
+ State int `json:"state" gorm:"column:m_steat;type:tinyint(1) unsigned;default:1;not null;comment:是否启用(1:启用;2:禁用;3:删除)"`
+ ParentId int64 `json:"parentId" gorm:"column:m_parent;type:bigint(30) unsigned;default:0;not null;comment:'父级(顶级:0)"`
+ ApiUrl string `json:"apiUrl" gorm:"column:m_url;type:varchar(255);not null;comment:地址"`
+ Time int64 `json:"time" gorm:"column:m_time;type:bigint(30) unsigned;default:0;not null;comment:创建时间"`
+ EiteTime int64 `json:"eiteTime" gorm:"column:m_eite_time;type:bigint(30) unsigned;default:0;not null;comment:修改时间"`
+ UserId int64 `json:"userId" gorm:"column:m_user_id;type:bigint(20) unsigned;not null;default:0;comment:写入人"`
+ Sort int `json:"sort" gorm:"column:m_sort;type:tinyint(3) unsigned;default:0;not null;comment:排序"`
+}
+
+func (SystemMenu *SystemMenu) TableName() string {
+ return "system_menu"
+}
+
+//菜单功能
+type MenuOperation struct {
+ OperId int64 `json:"operId" gorm:"column:oper_id;type:bigint(20) unsigned;not null;comment:功能ID"`
+ MenuId int64 `json:"menuId" gorm:"column:menu_id;type:bigint(20) unsigned;not null;default:0;comment:菜单id"`
+ OperTitle string `json:"operTitle" gorm:"column:oper_title;type:varchar(255);not null;comment:操作名称"`
+}
+
+func (MenuOperation *MenuOperation) TableName() string {
+ return "menu_operation"
+}
+
+//菜单管理
+type SystemMenuOperation struct {
+ SystemMenu
+ MenuOperation
+}
diff --git a/gin_server_admin/model/systemuser/systemrole.go b/gin_server_admin/model/systemuser/systemrole.go
new file mode 100644
index 0000000..465a426
--- /dev/null
+++ b/gin_server_admin/model/systemuser/systemrole.go
@@ -0,0 +1,19 @@
+package systemuser
+
+type SystemRole struct {
+ Id int64 `json:"id" gorm:"column:r_id;type:bigint(20) unsigned;not null;comment:Id"`
+ Title string `json:"title" gorm:"column:r_title;type:varchar(36);not null;comment:角色名称"`
+ State int `json:"state" gorm:"column:r_set;type:tinyint(1) unsigned;default:1;not null;comment:是否启用(1:启用;2:禁用;3:删除)"`
+ Attribute int64 `json:"attribute" gorm:"column:r_attribute;type:bigint(20) unsigned;default:0;not null;comment:属性"`
+ Gode int `json:"gode" gorm:"column:r_gode;type:tinyint(1) unsigned;default:1;not null;comment:继承属性(1:系统管理员;2:分厂管理员)"`
+ Time int64 `json:"time" gorm:"column:r_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ UserId int64 `json:"userId" gorm:"column:r_user_id;type:bigint(50) unsigned;default:0;not null;comment:写入人"`
+ Jurisdiction string `json:"jurisdiction" gorm:"column:r_jurisdiction;type:text;not null;comment:权限"`
+ MenuOper string `json:"menuoper" gorm:"column:r_menu_oper;type:text;not null;comment:权限"`
+ Wand int `json:"wand" gorm:"column:r_wand;type:tinyint(2) unsigned;default:0;not null;comment:权杖"`
+ Group int64 `json:"group" gorm:"column:r_group;type:bigint(20) unsigned;not null;default:3;comment:归属集团"`
+}
+
+func (SystemRole *SystemRole) TableName() string {
+ return "system_role"
+}
diff --git a/gin_server_admin/model/systemuser/systemuser.go b/gin_server_admin/model/systemuser/systemuser.go
index c67929e..8bf6c6c 100644
--- a/gin_server_admin/model/systemuser/systemuser.go
+++ b/gin_server_admin/model/systemuser/systemuser.go
@@ -36,10 +36,10 @@ func (SystemUser *SystemUser) GetInfo(whereMap map[string]interface{}) (isTrue b
//系统管理员属性资料
type SystemUserAttribute struct {
- Id int64 `json:"id" gorm:"column:ua_id;type:bigint(50) unsigned;not null;comment:Id"`
- Name string `json:"name" gorm:"column:ua_name;type:varchar(20);not null;comment:姓名"`
- Tel string `json:"tel" gorm:"column:ua_tel;type:varchar(30);not null;default:0;comment:电话"`
- Time int64 `json:"time" gorm:"column:ua_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
+ IdAttr int64 `json:"id" gorm:"column:ua_id;type:bigint(50) unsigned;not null;comment:Id"`
+ NameAttr string `json:"name" gorm:"column:ua_name;type:varchar(20);not null;comment:姓名"`
+ Tel string `json:"tel" gorm:"column:ua_tel;type:varchar(30);not null;default:0;comment:电话"`
+ TimeAttr int64 `json:"time" gorm:"column:ua_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
}
func (SystemUserAttribute *SystemUserAttribute) TableName() string {
@@ -58,3 +58,9 @@ func (SystemUser *SystemUserAttribute) GetInfo(whereMap map[string]interface{})
}
return
}
+
+//管理员详细信息
+type SystemAdminDetails struct {
+ SystemUser
+ SystemUserAttribute
+}
diff --git a/gin_server_admin/model/testpage/myuser.go b/gin_server_admin/model/testpage/myuser.go
index abc96f2..d963194 100644
--- a/gin_server_admin/model/testpage/myuser.go
+++ b/gin_server_admin/model/testpage/myuser.go
@@ -55,3 +55,19 @@ type PersonalDetails struct {
WorkMan
WorkManAttribute
}
+
+//Redis身份识别
+type RedisUserInfo struct {
+ Id string `json:"id"`
+ Number string `json:"number"`
+ DepartmentId string `json:"departmentid"`
+ WorkshopId string `json:"workshopid"`
+ PostId string `json:"postid"`
+ Key string `json:"key"`
+ Group string `json:"group"`
+ Tema string `json:"tema"`
+ WorkWechatId string `json:"workwechatid"`
+ WechatId string `json:"wechatid"`
+ Name string `json:"name"`
+ NickName string `json:"nickname"`
+}
diff --git a/gin_server_admin/router/assessment/assessmentrouter.go b/gin_server_admin/router/assessment/assessmentrouter.go
new file mode 100644
index 0000000..fa2fd5e
--- /dev/null
+++ b/gin_server_admin/router/assessment/assessmentrouter.go
@@ -0,0 +1,56 @@
+package assessment
+
+import (
+ v2 "github.com/flipped-aurora/gin-vue-admin/server/api/index"
+ v1 "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
+ "github.com/gin-gonic/gin"
+)
+
+type AssessmentRouter struct{}
+
+func (s *AssessmentRouter) InitAssessmentRouter(Router *gin.RouterGroup) {
+ dutyCodeRouter := Router.Group("duty")
+ var authorityApi = v1.ApiGroupApp.DutyHandleApi.DutyHandle
+ {
+ dutyCodeRouter.POST("/", authorityApi.Index) // 入口
+ dutyCodeRouter.POST("", authorityApi.Index) // 入口
+ dutyCodeRouter.GET("/", authorityApi.Index) // 入口
+ dutyCodeRouter.GET("", authorityApi.Index) // 入口
+ dutyCodeRouter.POST("dutyclasslist", authorityApi.DutyClassList) // 考核类别
+ dutyCodeRouter.POST("adddutyclass", authorityApi.AddDutyClass) // 添加考核类别
+ dutyCodeRouter.POST("getdutyclassinfo", authorityApi.GetDutyClassInfo) // 查询考核类别详情
+ dutyCodeRouter.POST("eitedutyclassinfo", authorityApi.EiteDutyClassInfo) // 编辑考核类别
+ dutyCodeRouter.POST("statedutyclass", authorityApi.StateDutyClass) // 编辑考核类别状态或删除
+
+ dutyCodeRouter.POST("assessList", authorityApi.AssEssList) // 考核项目列表
+ dutyCodeRouter.POST("addassessinfo", authorityApi.AddAssEssInfo) // 添加考核项目
+ dutyCodeRouter.POST("getassessinfo", authorityApi.GetAssEssInfo) // 获取考核项目详情
+ dutyCodeRouter.POST("eiteassessinfo", authorityApi.EiteAssEssInfo) // 修改考核项目详情
+ dutyCodeRouter.POST("eiteassessstate", authorityApi.EiteAssEssState) // 修改状态或删除考核项目
+
+ dutyCodeRouter.POST("dutylist", authorityApi.DutyList) // 具体职责列表
+ dutyCodeRouter.POST("adddutyinfo", authorityApi.AddDutyInfo) // 添加具体职责
+ dutyCodeRouter.POST("getdutyinfo", authorityApi.GetDutyInfo) // 获取具体职责详情
+ dutyCodeRouter.POST("eitedutyinfo", authorityApi.EiteDutyInfor) // 修改具体职责详情
+ dutyCodeRouter.POST("eitedutystate", authorityApi.EiteDutyState) // 修改状态或删除具体职责
+
+ dutyCodeRouter.POST("specdutylist", authorityApi.SpecificDutyList) // 具体部门考核项目列表
+ dutyCodeRouter.POST("addspecdutyinfo", authorityApi.AddSpecificDutyInfo) // 添加具体部门考核项目
+ dutyCodeRouter.POST("getspecdutyinfo", authorityApi.GetSpecDutyCont) // 获取具体部门考核项目详情
+ dutyCodeRouter.POST("eitespecdutyinfo", authorityApi.EiteSpecFicDutyInfo) // 修改具体部门考核项目详情
+ dutyCodeRouter.POST("eitespecdutystate", authorityApi.EiteSpecficDutyState) // 修改状态或删除具体部门考核项目
+
+ }
+
+}
+
+func (s *AssessmentRouter) InitDutyHandelRouter(Router *gin.RouterGroup) {
+ dutyIndexCodeRouter := Router.Group("dutys")
+ var authorityIndexApi = v2.ApiGroupApp.AssessMentApi.Assessment
+ {
+ dutyIndexCodeRouter.POST("/", authorityIndexApi.Index) // 入口
+ dutyIndexCodeRouter.POST("", authorityIndexApi.Index) // 入口
+ dutyIndexCodeRouter.GET("/", authorityIndexApi.Index) // 入口
+ dutyIndexCodeRouter.GET("", authorityIndexApi.Index) // 入口
+ }
+}
diff --git a/gin_server_admin/router/assessment/enter.go b/gin_server_admin/router/assessment/enter.go
new file mode 100644
index 0000000..0c66005
--- /dev/null
+++ b/gin_server_admin/router/assessment/enter.go
@@ -0,0 +1,5 @@
+package assessment
+
+type RouterGroup struct {
+ AssessmentRouter
+}
diff --git a/gin_server_admin/router/enter.go b/gin_server_admin/router/enter.go
index 040ecf6..be5b822 100644
--- a/gin_server_admin/router/enter.go
+++ b/gin_server_admin/router/enter.go
@@ -2,11 +2,13 @@ package router
import (
"github.com/flipped-aurora/gin-vue-admin/server/router/archive"
+ "github.com/flipped-aurora/gin-vue-admin/server/router/assessment"
"github.com/flipped-aurora/gin-vue-admin/server/router/autocode"
"github.com/flipped-aurora/gin-vue-admin/server/router/example"
"github.com/flipped-aurora/gin-vue-admin/server/router/examrouter"
"github.com/flipped-aurora/gin-vue-admin/server/router/examtestpage"
"github.com/flipped-aurora/gin-vue-admin/server/router/shiyan"
+ "github.com/flipped-aurora/gin-vue-admin/server/router/staffrouter"
"github.com/flipped-aurora/gin-vue-admin/server/router/system"
"github.com/flipped-aurora/gin-vue-admin/server/router/uploaddownload"
"github.com/flipped-aurora/gin-vue-admin/server/router/wechatcallbackrouter"
@@ -22,6 +24,8 @@ type RouterGroup struct {
ArchiveStructApi archive.RouterGroup
FileUpDownLoad uploaddownload.RouterGroup //文件上传下载
ExamQuest examrouter.RouterGroup
+ DutyAssEssRout assessment.RouterGroup
+ StaffRouter staffrouter.RouterGroup
}
var RouterGroupApp = new(RouterGroup)
diff --git a/gin_server_admin/router/staffrouter/enter.go b/gin_server_admin/router/staffrouter/enter.go
new file mode 100644
index 0000000..0cea788
--- /dev/null
+++ b/gin_server_admin/router/staffrouter/enter.go
@@ -0,0 +1,5 @@
+package staffrouter
+
+type RouterGroup struct {
+ StaffRouter
+}
diff --git a/gin_server_admin/router/staffrouter/people.go b/gin_server_admin/router/staffrouter/people.go
new file mode 100644
index 0000000..08eba1b
--- /dev/null
+++ b/gin_server_admin/router/staffrouter/people.go
@@ -0,0 +1,21 @@
+package staffrouter
+
+import (
+ v1 "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
+ "github.com/gin-gonic/gin"
+)
+
+type StaffRouter struct{}
+
+func (s *StaffRouter) InitStaffRouter(Router *gin.RouterGroup) {
+ staffRouter := Router.Group("staff")
+ var authorityApi = v1.ApiGroupApp.StaffApi.StaffPeople
+ {
+ staffRouter.POST("", authorityApi.Index) //员工档案入口
+ staffRouter.POST("/", authorityApi.Index) //员工档案入口
+ staffRouter.GET("", authorityApi.Index) //员工档案入口
+ staffRouter.GET("/", authorityApi.Index) //员工档案入口
+
+ staffRouter.POST("/stafflist", authorityApi.StaffList) //员工列表
+ }
+}
diff --git a/gin_server_admin/router/system/enter.go b/gin_server_admin/router/system/enter.go
index 6231e77..ab0ad68 100644
--- a/gin_server_admin/router/system/enter.go
+++ b/gin_server_admin/router/system/enter.go
@@ -14,4 +14,5 @@ type RouterGroup struct {
OperationRecordRouter
SysRouter
UserRouter
+ AdminUserApi
}
diff --git a/gin_server_admin/router/system/sys_admin.go b/gin_server_admin/router/system/sys_admin.go
new file mode 100644
index 0000000..693b4ba
--- /dev/null
+++ b/gin_server_admin/router/system/sys_admin.go
@@ -0,0 +1,35 @@
+package system
+
+import (
+ v1 "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
+ "github.com/gin-gonic/gin"
+)
+
+type AdminUserApi struct{}
+
+func (a *AdminUserApi) InitSystemAdminRouter(Router *gin.RouterGroup) {
+ adminRouter := Router.Group("systemadmin")
+ var authorityApi = v1.ApiGroupApp.SystemApi.SystemUserApi
+ {
+ adminRouter.POST("", authorityApi.Index) //系统管理员档案入口
+ adminRouter.POST("/", authorityApi.Index) //系统管理员档案入口
+ adminRouter.GET("", authorityApi.Index) //系统管理员档案入口
+ adminRouter.GET("/", authorityApi.Index) //系统管理员档案入口
+
+ adminRouter.POST("/adminlist", authorityApi.AdminList) //系统管理员列表
+ }
+ //角色相关
+ roleRouter := Router.Group("systemrole")
+ var roleApi = v1.ApiGroupApp.SystemApi.SystemRoleApi
+ {
+ roleRouter.POST("/systemrolelist", roleApi.SystemRoleList) //系统管理员角色列表
+ }
+ //菜单相关
+ muneRouter := Router.Group("systemmenu")
+ var systemMuneApi = v1.ApiGroupApp.SystemApi.SysTemMenuApi
+ {
+ muneRouter.POST("/systemmenulist", systemMuneApi.SystemMenuList) //系统菜单列表
+
+ muneRouter.POST("/getmenu", systemMuneApi.GetMenu) //获取系统做出菜单
+ }
+}
diff --git a/gin_server_admin/router/system/sys_base.go b/gin_server_admin/router/system/sys_base.go
index fa8cb34..c367c57 100644
--- a/gin_server_admin/router/system/sys_base.go
+++ b/gin_server_admin/router/system/sys_base.go
@@ -11,9 +11,13 @@ type BaseRouter struct {
func (s *BaseRouter) InitBaseRouter(Router *gin.RouterGroup) (R gin.IRoutes) {
baseRouter := Router.Group("base")
var baseApi = v1.ApiGroupApp.SystemApiGroup.BaseApi
+ var customApi = v1.ApiGroupApp.CustomApi.CustomHandle
{
baseRouter.POST("login", baseApi.Login)
baseRouter.POST("captcha", baseApi.Captcha)
+ //自定义登录
+ baseRouter.POST("mylogin", customApi.CustomLogin)
+ baseRouter.POST("mysystemlogin", customApi.SystemLogin)
}
return baseRouter
}
diff --git a/web/src/view/language/CustomTranslate.js b/web/src/view/language/CustomTranslate.js
new file mode 100644
index 0000000..dd07022
--- /dev/null
+++ b/web/src/view/language/CustomTranslate.js
@@ -0,0 +1,20 @@
+import translate from './translate';
+
+
+export default function customTranslate(template, replacements) {
+ replacements = replacements || {};
+
+ // Translate
+ template = translate[template] || template;
+
+ // Replace
+ return template.replace(/{([^}]+)}/g, function(_, key) {
+
+ var str=replacements[key];
+ if(translate[replacements[key]]!=null&&translate[replacements[key]]!='undefined'){
+ str=translate[replacements[key]];
+ }
+ return str || '{' + key + '}';
+
+ });
+}
\ No newline at end of file
diff --git a/web/src/view/language/translate.js b/web/src/view/language/translate.js
new file mode 100644
index 0000000..620892d
--- /dev/null
+++ b/web/src/view/language/translate.js
@@ -0,0 +1,256 @@
+export default {
+ 'Activate the global connect tool': '激活全局连接工具',
+ 'Append {type}': '添加 {type}',
+ 'Add Lane above': '在上面添加道',
+ 'Divide into two Lanes': '分割成两个道',
+ 'Divide into three Lanes': '分割成三个道',
+ 'Add Lane below': '在下面添加道',
+ 'Append compensation activity': '追加补偿活动',
+ 'Change type': '修改类型',
+ 'Connect using Association': '使用关联连接',
+ 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
+ 'Connect using DataInputAssociation': '使用数据输入关联连接',
+ 'Remove': '移除',
+ 'Activate the hand tool': '激活抓手工具',
+ 'Activate the lasso tool': '激活套索工具',
+ 'Activate the create/remove space tool': '激活创建/删除空间工具',
+ 'Create expanded SubProcess': '创建扩展子过程',
+ 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
+ 'Create Pool/Participant': '创建池/参与者',
+ 'Create Group':'创建组',
+ 'Parallel Multi Instance': '并行多重事件',
+ 'Sequential Multi Instance': '时序多重事件',
+ 'DataObjectReference': '数据对象参考',
+ 'DataStoreReference': '数据存储参考',
+ 'Loop': '循环',
+ 'Ad-hoc': '即席',
+ 'Create {type}': '创建 {type}',
+ 'Task': '任务',
+ 'Send Task': '发送任务',
+ 'Receive Task': '接收任务',
+ 'User Task': '用户任务',
+ 'Manual Task': '手工任务',
+ 'Business Rule Task': '业务规则任务',
+ 'Service Task': '服务任务',
+ 'Script Task': '脚本任务',
+ 'Call Activity': '调用活动',
+ 'Sub Process (collapsed)': '子流程(折叠的)',
+ 'Sub Process (expanded)': '子流程(展开的)',
+ 'Start Event': '开始事件',
+ 'StartEvent': '开始事件',
+ 'Intermediate Throw Event': '中间事件',
+ 'End Event': '结束事件',
+ 'EndEvent': '结束事件',
+ 'Create Gateway': '创建网关',
+ 'Create ExclusiveGateway': '创建互斥网关',
+ 'Create ParallelGateway': '创建并行网关',
+ 'Create InclusiveGateway': '创建相容网关',
+ 'Create ComplexGateway': '创建复杂网关',
+ 'Create EventbasedGateway': '创建事件网关',
+ 'Create Intermediate/Boundary Event': '创建中间/边界事件',
+ 'Message Start Event': '消息开始事件',
+ 'Timer Start Event': '定时开始事件',
+ 'Conditional Start Event': '条件开始事件',
+ 'Signal Start Event': '信号开始事件',
+ 'Error Start Event': '错误开始事件',
+ 'Escalation Start Event': '升级开始事件',
+ 'Compensation Start Event': '补偿开始事件',
+ 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
+ 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
+ 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
+ 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
+ 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
+ 'Message Intermediate Catch Event': '消息中间捕获事件',
+ 'Message Intermediate Throw Event': '消息中间抛出事件',
+ 'Timer Intermediate Catch Event': '定时中间捕获事件',
+ 'Escalation Intermediate Throw Event': '升级中间抛出事件',
+ 'Conditional Intermediate Catch Event': '条件中间捕获事件',
+ 'Link Intermediate Catch Event': '链接中间捕获事件',
+ 'Link Intermediate Throw Event': '链接中间抛出事件',
+ 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
+ 'Signal Intermediate Catch Event': '信号中间捕获事件',
+ 'Signal Intermediate Throw Event': '信号中间抛出事件',
+ 'Message End Event': '消息结束事件',
+ 'Escalation End Event': '定时结束事件',
+ 'Error End Event': '错误结束事件',
+ 'Cancel End Event': '取消结束事件',
+ 'Compensation End Event': '补偿结束事件',
+ 'Signal End Event': '信号结束事件',
+ 'Terminate End Event': '终止结束事件',
+ 'Message Boundary Event': '消息边界事件',
+ 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
+ 'Timer Boundary Event': '定时边界事件',
+ 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
+ 'Escalation Boundary Event': '升级边界事件',
+ 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
+ 'Conditional Boundary Event': '条件边界事件',
+ 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
+ 'Error Boundary Event': '错误边界事件',
+ 'Cancel Boundary Event': '取消边界事件',
+ 'Signal Boundary Event': '信号边界事件',
+ 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
+ 'Compensation Boundary Event': '补偿边界事件',
+ 'Exclusive Gateway': '互斥网关',
+ 'Parallel Gateway': '并行网关',
+ 'Inclusive Gateway': '相容网关',
+ 'Complex Gateway': '复杂网关',
+ 'Event based Gateway': '事件网关',
+ 'Transaction': '转运',
+ 'Sub Process': '子流程',
+ 'Event Sub Process': '事件子流程',
+ 'Collapsed Pool': '折叠池',
+ 'Expanded Pool': '展开池',
+
+ // Errors
+ 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
+ 'no shape type specified': '没有指定的形状类型',
+ 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
+ 'out of bounds release': 'out of bounds release',
+ 'more than {count} child lanes': '子道大于{count} ',
+ 'element required': '元素不能为空',
+ 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
+ 'no diagram to display': '没有可展示的流程图',
+ 'no process or collaboration to display': '没有可展示的流程/协作',
+ 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
+ 'already rendered {element}': '{element} 已被渲染',
+ 'failed to import {element}': '导入{element}失败',
+ 'Id must be a valid QName.':'编号必须以字母或下划线开头',
+ 'Element must have an unique id.':'元素必须具有唯一的id',
+
+ //属性面板的参数
+ 'Id': '编号',
+ 'Name': '名称',
+ 'General': '常规',
+ 'Details': '详情',
+ 'Message Name': '消息名称',
+ 'Message': '消息',
+ 'Initiator': '创建者',
+ 'Asynchronous Continuations': '持续异步',
+ 'Asynchronous Before': '异步前',
+ 'Asynchronous After': '异步后',
+ 'Job Configuration': '工作配置',
+ 'Exclusive': '排除',
+ 'Job Priority': '工作优先级',
+ 'Retry Time Cycle': '重试时间周期',
+ 'Documentation': '文档',
+ 'Element Documentation': '元素文档',
+ 'History Configuration': '历史配置',
+ 'History Time To Live': '历史的生存时间',
+ 'Forms': '表单',
+ 'Form Key': '表单key',
+ 'Form Fields': '表单字段',
+ 'Business Key': '业务key',
+ 'Form Field': '表单字段',
+ 'ID': '编号',
+ 'Type': '类型',
+ 'Label': '名称',
+ 'Default Value': '默认值',
+ 'Validation': '校验',
+ 'Add Constraint': '添加约束',
+ 'Config': '配置',
+ 'Properties': '属性',
+ 'Add Property': '添加属性',
+ 'Value': '值',
+ 'Listeners': '监听器',
+ 'Execution Listener': '执行监听',
+ 'Event Type': '事件类型',
+ 'Listener Type': '监听器类型',
+ 'Java Class': 'Java类',
+ 'Expression': '表达式',
+ 'Must provide a value': '必须提供一个值',
+ 'Delegate Expression': '代理表达式',
+ 'Script': '脚本',
+ 'Script Format': '脚本格式',
+ 'Script Type': '脚本类型',
+ 'Inline Script': '内联脚本',
+ 'External Script': '外部脚本',
+ 'Resource': '资源',
+ 'Field Injection': '字段注入',
+ 'Extensions': '扩展',
+ 'Input/Output': '输入/输出',
+ 'Input Parameters': '输入参数',
+ 'Output Parameters': '输出参数',
+ 'Parameters': '参数',
+ 'Output Parameter': '输出参数',
+ 'Timer Definition Type': '定时器定义类型',
+ 'Timer Definition': '定时器定义',
+ 'Date': '日期',
+ 'Duration': '持续',
+ 'Cycle': '循环',
+ 'Signal': '信号',
+ 'Signal Name': '信号名称',
+ 'Escalation': '升级',
+ 'Error': '错误',
+ 'Link Name': '链接名称',
+ 'Condition': '条件名称',
+ 'Variable Name': '变量名称',
+ 'Variable Event': '变量事件',
+ 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
+ 'Wait for Completion': '等待完成',
+ 'Activity Ref': '活动参考',
+ 'Version Tag': '版本标签',
+ 'Executable': '可执行文件',
+ 'External Task Configuration': '扩展任务配置',
+ 'Task Priority': '任务优先级',
+ 'External': '外部',
+ 'Connector': '连接器',
+ 'Must configure Connector': '必须配置连接器',
+ 'Connector Id': '连接器编号',
+ 'Implementation': '实现方式',
+ 'Field Injections': '字段注入',
+ 'Fields': '字段',
+ 'Result Variable': '结果变量',
+ 'Topic': '主题',
+ 'Configure Connector': '配置连接器',
+ 'Input Parameter': '输入参数',
+ 'Assignee': '代理人',
+ 'Candidate Users': '候选用户',
+ 'Candidate Groups': '候选组',
+ 'Due Date': '到期时间',
+ 'Follow Up Date': '跟踪日期',
+ 'Priority': '优先级',
+ 'The follow up date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
+ 'The due date as an EL expression (e.g. ${someDate} or an ISO date (e.g. 2015-06-26T09:54:00)': '跟踪日期必须符合EL表达式,如: ${someDate} ,或者一个ISO标准日期,如:2015-06-26T09:54:00',
+ 'Variables': '变量',
+ 'Create DataObjectReference': '创建数据对象',
+ 'Create Task': '创建任务',
+ 'Create SendTask': '创建发送任务',
+ 'Create ReceiveTask': '创建接收任务',
+ 'Create UserTask': '创建用户任务',
+ 'Create ManualTask': '创建手工任务',
+ 'Create BusinessRuleTask': '创建业务规则任务',
+ 'Create ServiceTask': '创建服务任务',
+ 'Create ScriptTask': '创建脚本任务',
+ 'Create CallActivityTask': '创建调用活动',
+ 'Create SubProcessCollapsed': '创建子流程(折叠的)',
+ 'Create SubProcessExpanded': '创建子流程(展开的)',
+ 'Create StartEvent': '创建开始事件',
+ 'Create EndEvent': '创建结束事件',
+ 'Create DataStoreReference': '创建数据存储引用',
+ 'Tasklist Configuration': '任务列表配置',
+ 'Candidate Starter Configuration': '候选启动程序配置',
+ 'Candidate Starter Groups': '候选启动组',
+ 'Candidate Starter Users': '候选启动器用户',
+ 'Specify more than one group as a comma separated list.':'将多个组指定为逗号分隔的列表。',
+ 'Specify more than one user as a comma separated list.':'将多个用户指定为逗号分隔的列表。',
+ 'This maps to the process definition key.':'映射到流程定义键。',
+ 'Startable':'可启动',
+ 'TextAnnotation':'文本批注',
+ 'Append Intermediate/Boundary Event':'追加中间/边界事件',
+ 'Append EndEvent':'附加事件',
+ 'Append Gateway':'附加网关',
+ 'Append Task':'追加任务',
+ 'Parameter must have a name':'参数必须有名称',
+ 'CallActivity Type':'调用活动类型',
+ 'In Mapping':'在映射中',
+ 'Out Mapping':'输出映射',
+ 'Case Ref':'参考案例',
+ 'Binding':'捆绑',
+ 'Tenant Id':'机构ID',
+ 'deployment':'调度。',
+ 'Source':'来源',
+ 'Target':'目标',
+ 'Mapping must have a source':'映射必须有一个源',
+ 'Mapping must have a target':'映射必须有一个目标',
+ 'Task Listener':'任务侦听器',
+ };
\ No newline at end of file
diff --git a/web/src/view/personnel/index.vue b/web/src/view/personnel/index.vue
index b35921d..40c8aaa 100644
--- a/web/src/view/personnel/index.vue
+++ b/web/src/view/personnel/index.vue
@@ -1,15 +1,209 @@
-
- 人事管理
+
+
+ xml数据
+ 撤销
+ 恢复
+ 下载
+
+ 导入
+
+
+
-
-
\ No newline at end of file