AdminPanelController.groovy
上传用户:steveyhw
上传日期:2019-05-13
资源大小:307k
文件大小:4k
源码类别:

PlugIns编程

开发平台:

Java

  1. class AdminPanelController {
  2.     def index = { redirect(action:list,params:params) }
  3.     def allowedMethods = [list:['GET','POST'], check:['GET','POST'], statistical:['GET','POST'],showCheckinfo:['GET','POST']]
  4.     def list = {
  5.         
  6.         render(view:'main')
  7.     }
  8.     def rosterList = {
  9.         //需要审核的值勤信息
  10.         if(!params.max) params.max = '2'
  11.         if(!params.sort)params.sort = 'id'
  12.         if(!params.offset)params.offset = '0'
  13.         if(!params.order)params.order = 'asc'
  14.         
  15.        def results = Roster.findAll("from Roster r where r.rosState like :rosState and  r.rosDel like :_rosDelState order by ${params.sort} ${params.order} ",
  16.                 [rosState:'%'+0+'%',_rosDelState:'%'+0+'%'],[max:Integer.parseInt(params.max),offset:Integer.parseInt(params.offset)])
  17.         params.count=Roster.findAll("from Roster r where r.rosState like :rosState and r.rosDel like :_rosDelState order by ${params.sort} ${params.order} ",
  18.                 [rosState:'%'+0+'%',_rosDelState:'%'+0+'%']).size()
  19.         render(view:'rostercheck',model:[rosterList:results])
  20.     }
  21.     //审核值勤申请
  22.       def rosterCheck = {
  23.           
  24.           if(params.state){
  25.               def roster = Roster.get(params.id)
  26.               if(params.state=="Agree"){
  27.               roster.rosState = '1'
  28.               roster.save()
  29.               println   roster.rosState
  30.               }else if(params.state=="Disagree"){
  31.               roster.rosState = '2'
  32.               roster.save()
  33.               println   roster.rosState   
  34.               }
  35.            }
  36.           render('')  
  37.       }
  38.        //显示值勤申请信息
  39.     def showRosterCheckinfo = {
  40.          def roster = Roster.get( params.id )
  41.         if(!roster) {
  42.             flash.message = "roster.not.found"
  43.             flash.args = [params.id]
  44.             flash.defaultMessage = "Roster not found with id ${params.id}"
  45.             redirect(action:rosterList)
  46.         }
  47.         else {
  48.             render(view:'rostercheckinfo',model:[roster:roster])
  49.         }
  50.     }
  51.     def applicatList = {
  52.         //需要审核的申请信息
  53.         if(!params.max) params.max = '2'
  54.         if(!params.sort)params.sort = 'id'
  55.         if(!params.offset)params.offset = '0'
  56.         if(!params.order)params.order = 'asc'        
  57.        def results = Applicat.findAll("from Applicat a where a.appState = :appState and a.appDel like :_appDelState order by ${params.sort} ${params.order} ",
  58.                [appState:Code.findByCodValue1('waitCheck'),_appDelState:'%'+0+'%'],[max:Integer.parseInt(params.max),offset:Integer.parseInt(params.offset)])
  59.        params.count=Applicat.findAll("from Applicat a where a.appState = :appState and a.appDel like :_appDelState order by ${params.sort} ${params.order} ",
  60.                [appState:Code.findByCodValue1('waitCheck'),_appDelState:'%'+0+'%']).size()
  61.         render(view:'applicatcheck',model:[applicatList:results])
  62.     }
  63.     //显示申请信息
  64.     def showApplicatCheckinfo = {
  65.          def applicat = Applicat.get( params.id )
  66.         if(!applicat) {
  67.             flash.message = "applicat.not.found"
  68.             flash.args = [params.id]
  69.             flash.defaultMessage = "Applicat not found with id ${params.id}"
  70.             redirect(action:applicatList)
  71.         }
  72.         else {
  73.             render(view:'applicatcheckinfo',model:[applicat:applicat])
  74.         }
  75.     }
  76.      // 审核申请
  77.     def applicatCheck = {
  78.         if(params.state){
  79.             def applicat = Applicat.get(params.id)
  80.             if(params.state=="Agree"){
  81.             applicat.appState = Code.findByCodValue1('checkSuccess')
  82.             applicat.save()
  83.             println   applicat.appState
  84.             }else if(params.state=="Disagree"){
  85.             applicat.appState = Code.findByCodValue1('checkFailure')
  86.             applicat.save()
  87.             println   applicat.appState
  88.             }
  89.          }
  90.         render('')
  91.     }
  92.         
  93.     def statistical = {
  94.         render(view:'statistical') 
  95.     }
  96. }