考勤
diff --git a/src/main/java/com/supwisdom/dlpay/atte/Test.java b/src/main/java/com/supwisdom/dlpay/atte/Test.java
new file mode 100644
index 0000000..af20887
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/Test.java
@@ -0,0 +1,5 @@
+package com.supwisdom.dlpay.atte;
+
+public class Test {
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDetailInfo.java b/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDetailInfo.java
new file mode 100644
index 0000000..d999a7d
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDetailInfo.java
@@ -0,0 +1,101 @@
+package com.supwisdom.dlpay.atte.bean;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class AtteDetailInfo {
+ private String custname;
+ private String custtypeid;
+ private String attedate;
+ private String remark;
+ @Id
+ private String atteno;
+ private int state;
+ private String cardno;
+ private String timeid;
+ private String deptcode;
+ private String oldstate;
+
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(String custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public String getAtteno() {
+ return atteno;
+ }
+
+ public void setAtteno(String atteno) {
+ this.atteno = atteno;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
+ public String getCardno() {
+ return cardno;
+ }
+
+ public void setCardno(String cardno) {
+ this.cardno = cardno;
+ }
+
+ public String getTimeid() {
+ return timeid;
+ }
+
+ public void setTimeid(String timeid) {
+ this.timeid = timeid;
+ }
+
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+
+ public String getOldstate() {
+ return oldstate;
+ }
+
+ public void setOldstate(String oldstate) {
+ this.oldstate = oldstate;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDtl.java b/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDtl.java
new file mode 100644
index 0000000..97747aa
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/bean/AtteDtl.java
@@ -0,0 +1,99 @@
+package com.supwisdom.dlpay.atte.bean;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+@Entity
+public class AtteDtl {
+ private String attedate;
+ private String attetime;
+ @Id
+ private String refno;
+ private String custname;
+ private String custid;
+ private Integer custtypeid;
+ private String devicename;
+ private String deviceid;
+ private String cardno;
+ private String deptcode;
+
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+
+ public String getAttetime() {
+ return attetime;
+ }
+
+ public void setAttetime(String attetime) {
+ this.attetime = attetime;
+ }
+
+ public String getRefno() {
+ return refno;
+ }
+
+ public void setRefno(String refno) {
+ this.refno = refno;
+ }
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getCustid() {
+ return custid;
+ }
+
+ public void setCustid(String custid) {
+ this.custid = custid;
+ }
+
+ public Integer getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(Integer custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+
+ public String getDevicename() {
+ return devicename;
+ }
+
+ public void setDevicename(String devicename) {
+ this.devicename = devicename;
+ }
+
+ public String getDeviceid() {
+ return deviceid;
+ }
+
+ public void setDeviceid(String deviceid) {
+ this.deviceid = deviceid;
+ }
+
+ public String getCardno() {
+ return cardno;
+ }
+
+ public void setCardno(String cardno) {
+ this.cardno = cardno;
+ }
+
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/bean/AttedtlSearchBean.java b/src/main/java/com/supwisdom/dlpay/atte/bean/AttedtlSearchBean.java
new file mode 100644
index 0000000..aba9081
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/bean/AttedtlSearchBean.java
@@ -0,0 +1,67 @@
+package com.supwisdom.dlpay.atte.bean;
+
+public class AttedtlSearchBean {
+ private String startdate;
+ private String enddate;
+ private String custname;
+ private String custtypeid;
+ private String cardno;
+ private String deptcode;
+ private String devname;
+
+ public String getStartdate() {
+ return startdate;
+ }
+
+ public void setStartdate(String startdate) {
+ this.startdate = startdate;
+ }
+
+ public String getEnddate() {
+ return enddate;
+ }
+
+ public void setEnddate(String enddate) {
+ this.enddate = enddate;
+ }
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(String custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+
+ public String getCardno() {
+ return cardno;
+ }
+
+ public void setCardno(String cardno) {
+ this.cardno = cardno;
+ }
+
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+
+ public String getDevname() {
+ return devname;
+ }
+
+ public void setDevname(String devname) {
+ this.devname = devname;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/bean/CustSearchBean.java b/src/main/java/com/supwisdom/dlpay/atte/bean/CustSearchBean.java
new file mode 100644
index 0000000..5247b29
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/bean/CustSearchBean.java
@@ -0,0 +1,40 @@
+package com.supwisdom.dlpay.atte.bean;
+
+public class CustSearchBean {
+ private String custtypeid;
+ private String deptcode;
+ private String custname;
+ private String attedate;
+
+ public String getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(String custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+
+ public String getCustname() {
+ return custname;
+ }
+
+ public void setCustname(String custname) {
+ this.custname = custname;
+ }
+
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java b/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java
new file mode 100644
index 0000000..432b416
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java
@@ -0,0 +1,809 @@
+package com.supwisdom.dlpay.atte.controller;
+
+import com.supwisdom.dlpay.atte.bean.AttedtlSearchBean;
+import com.supwisdom.dlpay.atte.domain.TAtteClass;
+import com.supwisdom.dlpay.atte.domain.TAtteDtl;
+import com.supwisdom.dlpay.atte.domain.TSeaCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.atte.service.AtteClassService;
+import com.supwisdom.dlpay.atte.service.CustseaService;
+import com.supwisdom.dlpay.atte.service.SeasonService;
+import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
+import com.supwisdom.dlpay.framework.domain.TOperator;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;
+import com.supwisdom.dlpay.ncmgr.domain.TNcDevice;
+import com.supwisdom.dlpay.ncmgr.domain.TNcTime;
+import com.supwisdom.dlpay.ncmgr.domain.TNcTimegrp;
+import com.supwisdom.dlpay.ncmgr.domain.TNcWeektime;
+import com.supwisdom.dlpay.ncmgr.service.NcService;
+import com.supwisdom.dlpay.system.domain.TCustType;
+import com.supwisdom.dlpay.system.domain.TDept;
+import com.supwisdom.dlpay.system.domain.TDictionaryId;
+import com.supwisdom.dlpay.system.page.Pagination;
+import com.supwisdom.dlpay.system.service.SystemService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Controller
+@RequestMapping("/atte")
+public class CustAtteController {
+
+ private static Logger log= LoggerFactory.getLogger(CustAtteController.class);
+
+ @Autowired
+ SeasonService seasonService;
+ @Autowired
+ NcService ncService;
+ @Autowired
+ CustseaService custseaService;
+ @Autowired
+ private SystemService systemService;
+ @Autowired
+ AtteClassService atteClassService;
+
+ @GetMapping("/rule/index")
+ public String seasonindex(){
+ return "atte/role/index";
+ }
+ /**
+ * 查询规则列表
+ */
+ @ResponseBody
+ @RequestMapping(value="/rule/list")
+ public Map loadseasonlist(HttpServletRequest request,
+ HttpServletResponse response,
+ @RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
+ @RequestParam(value = "season", required = true, defaultValue = "") String season,
+ @AuthenticationPrincipal TOperator operUser) {
+
+ Map map=new HashMap();
+ try {
+ Pagination page=null;
+ String opertype=operUser.getOpertype();
+ String deptcode=operUser.getDeptcode();
+ if (!StringUtil.isEmpty(opertype) &&(opertype.equals("S")||opertype.equals("P"))){
+ page=seasonService.getSeasonWithPage(season,null,pageNo,pageSize);
+ }else {
+
+ if(StringUtil.isEmpty(deptcode)){
+ deptcode="-1";
+ }
+ page=seasonService.getSeasonWithPage(season,deptcode,pageNo,pageSize);
+ }
+ List<TNcWeektime> weeklist=ncService.findAllNcWeekTime();
+ map.put("PageResult",page);
+ map.put("weeklist",weeklist);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+ List<TDept> deptlist=systemService.findAllDept();
+ map.put("deptlist",deptlist);
+ map.put("operator",operUser);
+ for(TDept dept:deptlist){
+ if(dept.getDeptcode().equals(operUser.getDeptcode())){
+ map.put("dept",dept);
+ }
+ }
+ }catch (Exception e) {
+ e.printStackTrace();
+ log.error("查询考勤规则失败:" + e.getMessage());
+ }
+ return map;
+ }
+ /**
+ * 获取规则信息
+ */
+ @ResponseBody
+ @RequestMapping("/loadSeasonForUpdate")
+ public Map loadSeasonForUpdate( @RequestParam(value = "sid") int id){
+ Map map=new HashMap();
+ try {
+ TSeason season=seasonService.getSeasonById(id);
+ map.put("season",season);
+ List<TNcWeektime> list=ncService.findAllNcWeekTime();
+ map.put("weekgrp",list);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ /**
+ * 添加考勤规则
+ */
+ @ResponseBody
+ @RequestMapping(value="/addSeason",method = {RequestMethod.POST})
+ public Map addSeason(@RequestBody TSeason postData,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+ try {
+ TSeason season=seasonService.findBySeason(postData.getSeason());
+ if(season==null){
+ int id=seasonService.getMaxSeasonId()+1;
+ TSeason newseason=new TSeason();
+ newseason.setAddtime(DateUtil.getNow());
+ newseason.setUpdatetime(DateUtil.getNow());
+ newseason.setId(id);
+ newseason.setWeekid(postData.getWeekid());
+ newseason.setSeason(postData.getSeason());
+ newseason.setDeptcode(postData.getDeptcode());
+ newseason.setCusttypeid(postData.getCusttypeid());
+ newseason.setStatus(2);
+ seasonService.saveSeason(newseason);
+ map.put("errStr", "");
+ }else{
+ map.put("errStr","规则名称已存在");
+ return map;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr", "添加规则失败!");
+ log.error("添加规则失败:" + e.getMessage());
+ }
+ return map;
+ }
+
+ /**
+ * 修改规则
+ */
+ @ResponseBody
+ @RequestMapping(value = "/updateSeason",method = {RequestMethod.POST})
+ public Map updateSeason(@RequestBody TSeason bean,
+ HttpServletRequest request) {
+ Map map=new HashMap();
+
+ try {
+ if(bean==null){
+ map.put("errStr","请选择规则");
+ return map;
+ }
+ TSeason temp=seasonService.findSeasonByIdAndName(bean.getId(),bean.getSeason());
+ if(temp!=null){
+ map.put("errStr","该规则名称已存在,请从新修改!");
+ return map;
+ }
+ TSeason open=seasonService.getOpenRule(bean.getCusttypeid()+"",bean.getDeptcode());
+ if(open!=null&&open.getId()!=bean.getId()){
+ map.put("errStr","所选部门,人员类别下存在已启用的规则!");
+ return map;
+ }
+ TSeason season=seasonService.getSeasonById(bean.getId());
+ season.setSeason(bean.getSeason());
+ season.setCusttypeid(bean.getCusttypeid());
+ season.setDeptcode(bean.getDeptcode());
+ season.setUpdatetime(DateUtil.getNow());
+ season.setWeekid(bean.getWeekid());
+ seasonService.updateSeason(season);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr","修改规则失败!");
+ log.error("修改规则失败信息:",e.getMessage());
+ }
+ return map;
+
+ }
+ /**
+ * 启用停用规则
+ */
+ @ResponseBody
+ @RequestMapping(value = "/stoporopenrule",method = {RequestMethod.POST})
+ public Map openOrStop(@RequestParam(value = "id") int id,
+ HttpServletRequest request) {
+ Map map=new HashMap();
+
+ try {
+ seasonService.stoporopen(id);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr","启用/停用考勤规则失败!");
+ log.error("启用/停用考勤规则:",e.getMessage());
+ }
+ return map;
+
+ }
+ /**
+ * 删除考勤规则
+ */
+ @ResponseBody
+ @RequestMapping(value="/deleteSeason",method = {RequestMethod.GET})
+ public Map deleteSeason(@RequestParam(value = "id") int id,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+ int flag=0;
+ String message="";
+ try {
+ seasonService.deleteSeason(id);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("删除考勤规则异常",e.getMessage());
+ message=e.getMessage();
+ flag=1;
+ }
+ map.put("flag",flag);
+ map.put("message", message);
+ return map;
+ }
+ /**
+ * 人员类别绑定时令页面
+ */
+ @GetMapping("/custsea/index")
+ public String custseaindex(){
+ return "atte/custsea/index";
+ }
+
+ /**
+ * 类别时令列表
+ */
+ @ResponseBody
+ @RequestMapping(value="/custsea/list")
+ public Map loadcustsealist(HttpServletRequest request,
+ HttpServletResponse response,
+ @RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
+ @RequestParam(value = "custtypename", required = true, defaultValue = "") String custtypename) {
+ Map map=new HashMap();
+
+ try {
+ Pagination page=null;
+ page=custseaService.getCustseaWithPage(custtypename,pageNo,pageSize);
+ map.put("PageResult",page);
+ List<TSeason> seasonlist=seasonService.findAllSeason();
+ map.put("seasonlist",seasonlist);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+ List<TDictionaryId> dicts = systemService.findTDictionaryByType(8);
+ map.put("dicts", dicts);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("查询客户类别时令列表错误:",e.getMessage());
+ }
+ return map;
+
+ }
+ /**
+ * 获取类别时令信息
+ */
+ @ResponseBody
+ @RequestMapping("/loadCustseaForUpdate")
+ public Map loadCustseaForUpdate( @RequestParam(value = "custtypeid") int custtypeid){
+ Map map=new HashMap();
+ try {
+ TSeaCusttype custsea=custseaService.getCustseaById(custtypeid);
+ map.put("custsea",custsea);
+ List<TSeason> seasonlist=seasonService.findAllSeason();
+ map.put("seasonlist",seasonlist);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+ /**
+ * 修改或添加 类别时令
+ */
+ @ResponseBody
+ @RequestMapping(value="/saveOrUpdateCustsea",method = {RequestMethod.GET})
+ public Map saveOrUpdateCustsea(@RequestParam(value = "id") int id,
+ @RequestParam(value = "custtypeid",defaultValue = "0") int custtypeid,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map = new HashMap();
+
+ try {
+ if (!custseaService.exist(custtypeid)){
+ TSeaCusttype newCustsea=new TSeaCusttype();
+ newCustsea.setCusttypeid(custtypeid);
+ newCustsea.setId(id);
+ newCustsea.setUpdatetime(DateUtil.getNow());
+ custseaService.saveCustsea(newCustsea);
+ }else{
+ TSeaCusttype oldCustsea=custseaService.getCustseaById(custtypeid);
+ oldCustsea.setId(id);
+ oldCustsea.setUpdatetime(DateUtil.getNow());
+ custseaService.updateCustsea(oldCustsea);
+ }
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr",e.getMessage());
+ }
+ return map;
+ }
+ /**
+ * 分配设备
+ */
+ @RequestMapping("/assign/index")
+ public String assginindex(Model model){
+ return "/season/index";
+ }
+ /**
+ * 查询设备
+ */
+ @ResponseBody
+ @RequestMapping(value = "/assign/devlist",method = {RequestMethod.GET})
+ public Map getAssignDev( @RequestParam(value = "ruleid") Integer ruleid,
+ @RequestParam(value = "devname") String devname,
+ @RequestParam(value = "devtype") String devtype,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+
+ try {
+ List<TNcDevice> list=custseaService.getAllCanAssign(ruleid,devname,devtype);
+ map.put("canassignlist",list);
+ List<TNcDevice> list1=custseaService.getAllDevByCusttype(ruleid);
+ map.put("hasassignlist",list1);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return map ;
+ }
+ /**
+ * 分配设备
+ */
+ @ResponseBody
+ @RequestMapping(value = "/assign/save",method = {RequestMethod.POST})
+ public Map saveDevCusttype(@RequestParam(value = "ruleid") String ruleid,
+ @RequestParam(value = "ids") String ids,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+
+ try {
+
+ custseaService.assignDevRule(ids,ruleid);
+ map.put("okFlag","1");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return map;
+ }
+ /**
+ * 考勤排班
+ */
+ @GetMapping("/class/index")
+ public String classindex(){
+ return "atte/class/index";
+ }
+
+ @ResponseBody
+ @RequestMapping("/class/list")
+ public Map loadClassList(HttpServletRequest request,
+ HttpServletResponse response,
+ @AuthenticationPrincipal TOperator operUser,
+ @RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
+ @RequestParam(value = "classname", required = true, defaultValue = "") String classname) {
+
+ Map map=new HashMap();
+
+ try {
+ Pagination page=null;
+ String opertype=operUser.getOpertype();
+ String deptcode=operUser.getDeptcode();
+ if (!StringUtil.isEmpty(opertype) &&(opertype.equals("S")||opertype.equals("P"))){
+ page=atteClassService.getClassWithPage(classname,null,pageNo,pageSize);
+ }else {
+
+ if(StringUtil.isEmpty(deptcode)){
+ deptcode="-1";
+ }
+ page=atteClassService.getClassWithPage(classname,deptcode,pageNo,pageSize);
+ }
+ map.put("PageResult",page);
+ map.put("errStr","");
+ List<TNcTimegrp> timegrplist = ncService.findAllNcTimeGrp();
+ map.put("timelist",timegrplist);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+ List<TDept> deptlist=systemService.findAllDept();
+ map.put("deptlist",deptlist);
+ map.put("operator",operUser);
+ for(TDept dept:deptlist){
+ if(dept.getDeptcode().equals(operUser.getDeptcode())){
+ map.put("dept",dept);
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr",e.getMessage());
+ }
+
+ return map;
+ }
+ /**
+ * 获取班次信息
+ */
+ @ResponseBody
+ @RequestMapping("/loadClassForUpdate")
+ public Map loadClassForUpdate( @RequestParam(value = "classid") Integer classid){
+ Map map=new HashMap();
+ try {
+ TAtteClass atteclass=atteClassService.getClassById(classid);
+ map.put("atteclass",atteclass);
+ }catch (Exception e) {
+ e.printStackTrace();
+ }
+ return map;
+ }
+
+ /**
+ * 添加班次
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping(value="/addClass",method = {RequestMethod.POST})
+ public Map addClass( @RequestParam(value = "classname") String classname,
+ @RequestParam(value = "workorno") int workorno,
+ @RequestParam(value = "startdate") String startdate,
+ @RequestParam(value = "enddate") String enddate,
+ @RequestParam(value = "timegrpid") Integer timegrpid,
+ @RequestParam(value = "deptcode") String deptcode,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map = new HashMap();
+ try {
+ TAtteClass old=atteClassService.getClassByName(classname);
+ if(old==null){
+ if(!atteClassService.canAddClass(deptcode,workorno,startdate,enddate,0)){
+ map.put("errStr","班次时间已存在");
+ return map;
+ }
+ TAtteClass atteClass=new TAtteClass();
+ atteClass.setClassid(1+atteClassService.getMaxClassid());
+ atteClass.setClassname(classname);
+ atteClass.setStartdate(startdate);
+ atteClass.setEnddate(enddate);
+ atteClass.setStatus(1);
+ atteClass.setTimegrpid(timegrpid);
+ atteClass.setUpdatetime(DateUtil.getNow());
+ atteClass.setWorkorno(workorno);
+ atteClass.setDeptcode(deptcode);
+ atteClassService.saveAtteClass(atteClass);
+ map.put("errStr","");
+ }else{
+ map.put("errStr","班次名称已存在");
+ return map;
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr",e.getMessage());
+ }
+ return map;
+ }
+
+ /**
+ * 修改班次
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping(value = "/updateClass",method = {RequestMethod.POST})
+ public Map updateClass(@RequestBody TAtteClass bean,
+ @RequestParam(value = "startdate") String startdate,
+ @RequestParam(value = "enddate") String enddate,
+ HttpServletRequest request) {
+ Map map=new HashMap();
+
+ try {
+ if(bean==null){
+ map.put("errStr","请选择班次!");
+ return map;
+ }
+ TAtteClass old=atteClassService.getClassByName(bean.getClassname());
+ if(old.getClassid()!=bean.getClassid()){
+ map.put("errStr","班次名称已存在!");
+ return map;
+ }
+ if(atteClassService.canAddClass(bean.getDeptcode(),bean.getWorkorno(),bean.getStartdate(),bean.getEnddate(),bean.getClassid())){
+ TAtteClass newclass=atteClassService.getClassById(bean.getClassid());
+ newclass.setWorkorno(bean.getWorkorno());
+ newclass.setStartdate(startdate);
+ newclass.setEnddate(enddate);
+ newclass.setTimegrpid(bean.getTimegrpid());
+ newclass.setUpdatetime(DateUtil.getNow());
+ newclass.setClassname(bean.getClassname());
+ newclass.setDeptcode(bean.getDeptcode());
+ atteClassService.updateClass(newclass);
+ }else{
+ map.put("errStr","班次时间存在!");
+ return map;
+ }
+
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr","修改班次失败!");
+ log.error("修改班次失败信息:",e.getMessage());
+ }
+ return map;
+
+ }
+ /**
+ * 获取排班的人员名单
+ *
+ * @param perName
+ * @param cardno
+ * @param bankcardno
+ * @return
+ */
+ @ResponseBody
+ @RequestMapping(value = "/getCustomerList", method = RequestMethod.POST)
+ public Map getCustomerList(@RequestParam(value = "classid", required = false, defaultValue = "0") Integer classid,
+ @RequestParam(value = "perName", required = false, defaultValue = "") String perName,
+ @RequestParam(value = "custtypeid", required = false, defaultValue = "") String custtypeid,
+ @RequestParam(value = "deptcode", required = false, defaultValue = "") String deptcode) {
+ Map map = new HashMap();
+ try {
+ TAtteClass atteClass=atteClassService.getClassById(classid);
+ List<TCustomerInfo> allcust=atteClassService.getAllCustomer(perName,atteClass.getDeptcode(),custtypeid);
+ List<TCustomerInfo> hasclasscust=atteClassService.hasClassCust(classid);
+ Boolean countIndex = false;
+ if (allcust.size() > 4000) {
+ countIndex = true;
+ }
+ allcust.removeAll(hasclasscust);
+ map.put("allcust",allcust);
+ map.put("hasclasscust",hasclasscust);
+ map.put("countIndex", countIndex);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("名单查询失败--" + e.getMessage());
+ }
+ return map;
+ }
+
+ /**
+ * 考勤排班
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping("/addCustClass")
+ public Map saveCustClass(@RequestParam(value = "idlist") List<String> custids,
+ @RequestParam(value = "classid") Integer classid,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+
+ try {
+ if(classid==null){
+ map.put("errStr","请选择班次!");
+ return map;
+ }
+ atteClassService.addClassCust(classid,custids);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr","添加班次人员异常!");
+ }
+
+ return map;
+ }
+ /**
+ * 删除班次
+ */
+ @ResponseBody
+ @RequestMapping(value="/deleteClass",method = {RequestMethod.POST})
+ public Map deleteClass(@RequestParam(value = "classid") int classid,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+ int flag=0;
+ String message="";
+ try {
+ atteClassService.deleteAtteClass(classid);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("删除班次异常",e.getMessage());
+ message=e.getMessage();
+ flag=1;
+ }
+ map.put("flag",flag);
+ map.put("message", message);
+ return map;
+ }
+
+
+ //手动生成考勤名单
+ @ResponseBody
+ @RequestMapping("/adddtlbyhand")
+ public Map adddtl(@RequestParam(value = "startdate") String startdate,
+ @RequestParam(value = "enddate") String enddate,
+ @AuthenticationPrincipal TOperator operUser,
+ HttpServletRequest request, HttpServletResponse response) {
+ Map map=new HashMap();
+ String opertype=operUser.getOpertype();
+ String deptcode=operUser.getDeptcode();
+ if (!StringUtil.isEmpty(opertype) &&(opertype.equals("S")||opertype.equals("P"))){
+ deptcode=null;
+ }else {
+ if(StringUtil.isEmpty(deptcode)){
+ deptcode="-1";
+ }
+ }
+ atteClassService.addBatchDtl(startdate,enddate,deptcode);
+ atteClassService.handleDtl(deptcode,startdate);
+ return map;
+ }
+
+ /**
+ * 考勤流水页面
+ * @param
+ */
+ @GetMapping("/dtl/index")
+ public String dtlindex(){
+ return "atte/dtl/index";
+ }
+
+ /**
+ * 考勤流水列表
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping(value="/dtl/list",method = {RequestMethod.POST})
+ public Map loadattedtllist(HttpServletRequest request,
+ HttpServletResponse response,
+ @AuthenticationPrincipal TOperator operUser,
+ @RequestBody AttedtlSearchBean searchBean,
+ @RequestParam(value = "startdate") String startdate,
+ @RequestParam(value = "enddate") String enddate,
+ @RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
+ ) {
+ Map map=new HashMap();
+
+ try {
+ String deptcode=operUser.getDeptcode();
+ String opertype=operUser.getOpertype();
+ if (!StringUtil.isEmpty(opertype) &&(opertype.equals("S")||opertype.equals("P"))){
+ deptcode=null;
+ }else {
+ if(StringUtil.isEmpty(deptcode)){
+ deptcode="-1";
+ }
+ }
+ searchBean.setDeptcode(deptcode);
+ searchBean.setStartdate(startdate);
+ searchBean.setEnddate(enddate);
+ Pagination page=null;
+ page=atteClassService.getDtlWithPage(searchBean,pageNo,pageSize);
+ map.put("PageResult",page);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+// List<TNcTime> timelist=ncService.findAllNcTime();
+// map.put("timelist",timelist);
+ List<TDept> deptlist=systemService.findAllDept();
+ map.put("deptlist",deptlist);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("查询考勤流水信息出错:",e.getMessage());
+ }
+ return map;
+
+ }
+
+
+
+ /**
+ * 考勤状态页面
+ * @param
+ */
+ @GetMapping("/timedtl/index")
+ public String timedtlindex(){
+ return "atte/timedtl/index";
+ }
+
+ /**
+ * 考勤明细列表
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping(value="/timedtl/list",method = {RequestMethod.POST})
+ public Map loadtimedtllist(HttpServletRequest request,
+ HttpServletResponse response,
+ @AuthenticationPrincipal TOperator operUser,
+ @RequestBody AttedtlSearchBean searchBean,
+ @RequestParam(value = "startdate") String startdate,
+ @RequestParam(value = "enddate") String enddate,
+ @RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
+ @RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
+ ) {
+ Map map=new HashMap();
+
+ try {
+ String opertype=operUser.getOpertype();
+ String deptcode=operUser.getDeptcode();
+ if (!StringUtil.isEmpty(opertype) &&(opertype.equals("S")||opertype.equals("P"))){
+ deptcode=null;
+ }else {
+
+ if(StringUtil.isEmpty(deptcode)){
+ deptcode="-1";
+ }
+ }
+ searchBean.setDeptcode(deptcode);
+ searchBean.setStartdate(startdate);
+ searchBean.setEnddate(enddate);
+ Pagination page=null;
+ page=atteClassService.getAtteDtlInfoWithPage(searchBean,pageNo,pageSize);
+ map.put("PageResult",page);
+ List<TCustType> custtypelist=systemService.findAllCusttype();
+ map.put("custtypelist",custtypelist);
+ List<TNcTime> timelist=ncService.findAllNcTime();
+ map.put("timelist",timelist);
+ List<TDept> deptlist=systemService.findAllDept();
+ map.put("deptlist",deptlist);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("查询考勤流水信息出错:",e.getMessage());
+ }
+ return map;
+
+ }
+
+ /**
+ * 修改考勤状态
+ * @param
+ */
+ @ResponseBody
+ @RequestMapping(value = "/updatetimeDtl",method = {RequestMethod.POST})
+ public Map updateState(@RequestParam(value = "atteno") String atteno,
+ @RequestParam(value = "state") Integer state,
+ @RequestParam(value = "remark",defaultValue = " ") String remark,
+ HttpServletRequest request) {
+ Map map=new HashMap();
+ try {
+ TAtteDtl dtl=atteClassService.getDtlByAtteno(atteno);
+ if(dtl==null){
+ map.put("errStr","请选择流水");
+ return map;
+ }
+ dtl.setUpdatetime(DateUtil.getNow());
+ dtl.setOldstate(dtl.getState());
+ dtl.setState(state);
+ dtl.setRemark(remark);
+ atteClassService.updateAtteDtl(dtl);
+ map.put("errStr","");
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr","修改考勤流水状态失败!");
+ log.error("修改考勤流水状态失败:",e.getMessage());
+ }
+ return map;
+
+ }
+
+ /**
+ * 请销假页面
+ * @param
+ */
+ @GetMapping("/app/index")
+ public String appindex(){
+ return "atte/app/appindex";
+ }
+
+
+ public static void main(String[] args) {
+ String s1=DateUtil.getNow("yyyyMMdd")+"140000";
+ String s2=DateUtil.getNow("yyyyMMdd")+"143000";
+ long dif=DateUtil.getInterval(s1,s2);
+ System.out.println(dif);
+ System.out.println((int)(dif/(1000*60)));
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/AtteClassDao.java b/src/main/java/com/supwisdom/dlpay/atte/dao/AtteClassDao.java
new file mode 100644
index 0000000..b717462
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/AtteClassDao.java
@@ -0,0 +1,64 @@
+package com.supwisdom.dlpay.atte.dao;
+
+import com.supwisdom.dlpay.atte.bean.AtteDtl;
+import com.supwisdom.dlpay.atte.bean.AttedtlSearchBean;
+import com.supwisdom.dlpay.atte.bean.CustSearchBean;
+import com.supwisdom.dlpay.atte.domain.TAtteClass;
+import com.supwisdom.dlpay.atte.domain.TAtteDtl;
+import com.supwisdom.dlpay.atte.domain.TClassCust;
+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;
+import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
+import com.supwisdom.dlpay.system.page.Pagination;
+
+import java.util.List;
+
+public interface AtteClassDao {
+ public Pagination getClassWithPage(String classname,String deptcode, int pageNo, int pageSize);
+
+ public TAtteClass getClassById(Integer classid);
+
+ public boolean saveAtteClass(TAtteClass atteClass);
+
+ public TAtteClass getClassByName(String classname);
+
+ public int getMaxClassid();
+
+ public boolean existClass(String deptcode,String startdate, String enddate, int workorno, int exceptid);
+
+ public boolean updateClass(TAtteClass atteClass);
+
+ List<TCustomerInfo> hasClassCust(int classid);
+
+ public TClassCust getByIdAndDate(String custid, String attedate);
+
+ public boolean delClassCustByClassid(Integer classid);
+
+ public boolean addClassCust(TClassCust bean);
+
+ public boolean delClassCust(TClassCust bean);
+
+ //获取考勤流水号
+ public String getAtteNo(String attedate);
+ //保存流水
+ public boolean saveAtteDtl(TAtteDtl dtl);
+ //
+ //获取排班人员
+ public List<TCustomerInfo> getAtteCust(CustSearchBean searchBean);
+ //获取考勤明细信息
+ public Pagination getAttedtlWithPage(AttedtlSearchBean searchBean,int pageNo,int pageSize);
+ //修改明细
+ public boolean updateAtteDtl(TAtteDtl dtl);
+ //
+ public TAtteDtl getDtlByAtteno(String atteno);
+ //获取人员信息
+ public List<TCustomerInfo> getCustInfo(CustSearchBean searchBean);
+
+ //获取流水
+ public Pagination getDtlWithPage(AttedtlSearchBean searchBean,int pageNo,int pageSize);
+ //流水
+ public List<AtteDtl> getDtlList(AttedtlSearchBean searchBean);
+ //删除流水
+ public boolean delAtteDtl(String attedate,String deptcode);
+ //明细
+ public List<TAtteDtl> getDetailList(String custid,String attedate);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/CustseaDao.java b/src/main/java/com/supwisdom/dlpay/atte/dao/CustseaDao.java
new file mode 100644
index 0000000..de1cfb3
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/CustseaDao.java
@@ -0,0 +1,29 @@
+package com.supwisdom.dlpay.atte.dao;
+
+import com.supwisdom.dlpay.atte.domain.TDevCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeaCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.ncmgr.domain.TNcDevice;
+import com.supwisdom.dlpay.system.page.Pagination;
+
+import java.util.List;
+
+public interface CustseaDao {
+ public Pagination getCustseaWithPage(String custtypename, int pageNo, int pageSize);
+
+ public TSeaCusttype getCustseaById(Integer custtypeid);
+
+ public boolean updateCustsea(TSeaCusttype tSeaCusttype);
+
+ public boolean saveCustsea(TSeaCusttype tSeaCusttype);
+
+ public boolean exist(Integer custtypeid);
+
+ public List<TNcDevice> getAllCanAssign(Integer ruleid,String devname,String devtype);
+
+ public List<TNcDevice> getAllDevByCusttype(Integer ruleid);
+
+ public boolean deleteDevRuleid(Integer ruleid);
+
+ public boolean addDevRuleid(TDevCusttype bean);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/SeasonDao.java b/src/main/java/com/supwisdom/dlpay/atte/dao/SeasonDao.java
new file mode 100644
index 0000000..8990c79
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/SeasonDao.java
@@ -0,0 +1,28 @@
+package com.supwisdom.dlpay.atte.dao;
+
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.system.page.Pagination;
+
+import java.util.List;
+
+public interface SeasonDao {
+ public Pagination getSeasonWithPage(String season,String deptcode, int pageNo, int pageSize);
+
+ public TSeason getSeasonById(Integer id);
+
+ public TSeason findBySeason(String season);
+
+ public boolean saveSeason(TSeason season);
+
+ public int getMaxSeasonId();
+
+ public TSeason getSeasonByIdAndName(Integer id,String season);
+
+ public boolean updateSeason(TSeason season);
+
+ public boolean deleteSeason(int id);
+
+ public List<TSeason> findAllSeason();
+
+ public TSeason getOpenRule(Integer custtypid,String deptcode);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteClassDaoImpl.java b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteClassDaoImpl.java
new file mode 100644
index 0000000..e332dd6
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteClassDaoImpl.java
@@ -0,0 +1,625 @@
+package com.supwisdom.dlpay.atte.dao.impl;
+
+import com.supwisdom.dlpay.atte.bean.AtteDetailInfo;
+import com.supwisdom.dlpay.atte.bean.AtteDtl;
+import com.supwisdom.dlpay.atte.bean.AttedtlSearchBean;
+import com.supwisdom.dlpay.atte.bean.CustSearchBean;
+import com.supwisdom.dlpay.atte.dao.AtteClassDao;
+import com.supwisdom.dlpay.atte.domain.TAtteClass;
+import com.supwisdom.dlpay.atte.domain.TAtteDtl;
+import com.supwisdom.dlpay.atte.domain.TClassCust;
+import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+@Service
+public class AtteClassDaoImpl implements AtteClassDao {
+ @PersistenceContext
+ EntityManager entityManager;
+
+ @Transactional
+ @Override
+ public Pagination getClassWithPage(String classname,String deptcode, int pageNo, int pageSize) {
+ String sql=" select bean from TAtteClass bean where bean.status=1 ";
+ if(!StringUtil.isEmpty(classname)){
+ sql+=" and bean.classname like :name ";
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+=" and bean.deptcode = :dcode ";
+ }
+ sql+=" order by bean.startdate desc";
+ TypedQuery<TAtteClass> query=entityManager.createQuery(sql,TAtteClass.class);
+ if(!StringUtil.isEmpty(classname)){
+ query.setParameter("name","%"+classname+"%");
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);
+ }
+ pageNo = pageNo <= 0 ? 1 : pageNo;
+ query.setFirstResult((pageNo - 1) * pageSize);
+ query.setMaxResults(pageSize);
+ Pagination page = new Pagination();
+ page.setPageNo(pageNo);
+ page.setPageSize(pageSize);
+ List<TAtteClass> list=query.getResultList();
+ page.setList(list);
+ int totalCount=getClassCount(classname,deptcode);
+ page.setTotalCount(totalCount);
+ return page;
+ }
+
+ public int getClassCount(String classname,String deptcode){
+ String sql=" select count(bean.classid) from TAtteClass bean where bean.status=1 ";
+ if(!StringUtil.isEmpty(classname)){
+ sql+=" and bean.classname like :name ";
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+=" and bean.deptcode = :dcode ";
+ }
+ Query query=entityManager.createQuery(sql);
+ if(!StringUtil.isEmpty(classname)){
+ query.setParameter("name","%"+classname+"%");
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);
+ }
+ List list=query.getResultList();
+ int cnt=0;
+ if(list!=null&&list.size()>0){
+ cnt=Integer.parseInt(list.get(0).toString());
+ }
+ return cnt;
+ }
+
+ @Transactional
+ @Override
+ public TAtteClass getClassById(Integer classid) {
+ String sql="select bean from TAtteClass bean where classid = :cid ";
+ if(classid!=null){
+ TypedQuery<TAtteClass> query=entityManager.createQuery(sql,TAtteClass.class);
+ query.setParameter("cid",classid);
+ List<TAtteClass> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ }
+ return null;
+ }
+ @Transactional
+ @Override
+ public boolean saveAtteClass(TAtteClass atteClass) {
+ boolean flag=false;
+
+ try {
+ entityManager.persist(atteClass);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public TAtteClass getClassByName(String classname) {
+ String sql=" select bean from TAtteClass bean where bean.status=1 ";
+ if(!StringUtil.isEmpty(classname)){
+ sql+=" and bean.classname = :name ";
+ TypedQuery<TAtteClass> query=entityManager.createQuery(sql,TAtteClass.class);
+ query.setParameter("name",classname);
+ List<TAtteClass> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ }
+ return null;
+ }
+ @Transactional
+ @Override
+ public int getMaxClassid() {
+ String sql=" select max(c.classid) from TAtteClass c";
+ Query query=entityManager.createQuery(sql);
+ Object object=query.getSingleResult();
+ if(object!=null){
+ return (int) object;
+ }
+ return 0;
+ }
+ @Transactional
+ @Override
+ public boolean existClass(String deptcode,String startdate, String enddate, int workorno,int exceptid) {
+ String sql=" select a from TAtteClass a where a.status=1 and a.deptcode=:dcode and a.workorno= :won and a.classid!=:expid ";
+ if(!StringUtil.isEmpty(startdate)&&!StringUtil.isEmpty(enddate)){
+ sql+=" and ( (:sdate between a.startdate and a.enddate) or (:edate between a.startdate and a.enddate) ";
+ sql+=" or (:sdate < a.startdate and :edate > a.enddate ) )";
+ TypedQuery<TAtteClass> query=entityManager.createQuery(sql,TAtteClass.class);
+ query.setParameter("sdate",startdate);
+ query.setParameter("edate",enddate);
+ query.setParameter("won",workorno);
+ query.setParameter("expid",exceptid);
+ query.setParameter("dcode",deptcode);
+ List<TAtteClass> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return true;
+ }
+ }
+ return false;
+ }
+ @Transactional
+ @Override
+ public boolean updateClass(TAtteClass atteClass) {
+ boolean flag=false;
+
+ try {
+ entityManager.merge(atteClass);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Transactional
+ @Override
+ public List<TCustomerInfo> hasClassCust(int classid) {
+ String sql = "select a.deptcode,a.custtypeid,a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from T_Customer a left join t_card b on a.custid = b.custid " +
+ " where a.status='1' and b.status='normal' and b.transtatus='normal' ";
+ sql+= " and exists (select * from t_class_cust t where t.classid = :cid and a.custid=t.custid ) ";
+ sql +=" order by b.cardno desc ";
+ Query query = entityManager.createNativeQuery(sql, TCustomerInfo.class);
+ query.setParameter("cid",classid);
+ List<TCustomerInfo> list = query.getResultList();
+ return list;
+ }
+ @Transactional
+ @Override
+ public TClassCust getByIdAndDate(String custid, String attedate) {
+ if(!StringUtil.isEmpty(custid)&&!StringUtil.isEmpty(attedate)){
+ String sql=" select bean from TClassCust bean where bean.custid=:cid and bean.attedate = :adate ";
+ TypedQuery<TClassCust> query=entityManager.createQuery(sql,TClassCust.class);
+ query.setParameter("cid", custid);
+ query.setParameter("adate",attedate);
+ List<TClassCust> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ }
+ return null;
+ }
+ @Transactional
+ @Override
+ public boolean delClassCustByClassid(Integer classid) {
+ if(classid!=null){
+ String sql=" delete from TClassCust where classid=:cid ";
+
+ try {
+ Query query=entityManager.createQuery(sql);
+ query.setParameter("cid",classid);
+ query.executeUpdate();
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ @Transactional
+ @Override
+ public boolean addClassCust(TClassCust bean) {
+ boolean flag=false;
+ try {
+ entityManager.persist(bean);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public boolean delClassCust(TClassCust bean) {
+ boolean flag=false;
+ try {
+ entityManager.remove(bean);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public String getAtteNo(String attedate) {
+ String sql=" select to_char(cast(nextval('seq_attedtl') as INTEGER),'FM000000') ";
+ Query query=entityManager.createNativeQuery(sql);
+ List list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ String atteno=attedate+list.get(0).toString();
+ return atteno;
+ }
+ return null;
+ }
+ @Transactional
+ @Override
+ public boolean saveAtteDtl(TAtteDtl dtl) {
+ boolean flag=false;
+ try {
+ entityManager.persist(dtl);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public List<TCustomerInfo> getAtteCust(CustSearchBean searchBean) {
+ String sql = "select a.deptcode,a.custtypeid,a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from T_Customer a left join t_card b on a.custid = b.custid " +
+ " where a.status='1' and b.status='normal' and b.transtatus='normal' ";
+ sql+=" and (EXISTS ( select * from t_atte_rule r where r.status=1 and r.deptcode=a.deptcode and r.custtypeid=cast(a.custtypeid as INTEGER) ) or a.custid in (select custid from t_class_cust where attedate=:adate ) ) ";
+ if (!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql +=" and a.deptcode = :dcode ";
+ }
+ sql +=" order by b.cardno desc ";
+ Query query = entityManager.createNativeQuery(sql, TCustomerInfo.class);
+ query.setParameter("adate",searchBean.getAttedate());
+ if (!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode", searchBean.getDeptcode());
+ }
+ List<TCustomerInfo> list = query.getResultList();
+ return list;
+ }
+
+ @Override
+ public Pagination getAttedtlWithPage(AttedtlSearchBean searchBean, int pageNo, int pageSize) {
+ StringBuffer sql=new StringBuffer();
+ sql.append(" select t.timeid,t.atteno,t.attedate,t.remark,c.custname,c.custtypeid,b.cardno,t.state,c.deptcode,t.oldstate from t_atte_dtl t left join t_customer c on t.custid=c.custid ");
+ sql.append(" left join t_card b on b.custid=t.custid where c.status='1' and b.status='normal' ");
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ sql.append(" and t.attedate between :sdate and :edate ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ sql.append(" and c.custname like :cname ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ sql.append(" and b.cardno like :cno ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql.append(" and c.custtypeid = :ctypeid ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql.append(" and c.deptcode = :dcode ");
+ }
+ sql.append(" order by t.atteno desc ");
+ Query query=entityManager.createNativeQuery(sql.toString(), AtteDetailInfo.class);
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ query.setParameter("sdate",searchBean.getStartdate());
+ query.setParameter("edate",searchBean.getEnddate());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("cname","%"+searchBean.getCustname()+"%");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ query.setParameter("cno",searchBean.getCardno());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid",searchBean.getCusttypeid());
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode",searchBean.getDeptcode());
+ }
+ pageNo = pageNo <= 0 ? 1 : pageNo;
+ query.setFirstResult((pageNo - 1) * pageSize);
+ query.setMaxResults(pageSize);
+ Pagination page = new Pagination();
+ page.setPageNo(pageNo);
+ page.setPageSize(pageSize);
+ List<AtteDetailInfo> list=query.getResultList();
+ page.setList(list);
+ int totalCount= getAttedtlCount(searchBean);
+ page.setTotalCount(totalCount);
+ return page;
+
+ }
+
+ public int getAttedtlCount(AttedtlSearchBean searchBean){
+ int result=0;
+ StringBuffer sql=new StringBuffer();
+ sql.append(" select count(t.atteno) from t_atte_dtl t left join t_customer c on t.custid=c.custid ");
+ sql.append(" left join t_card b on b.custid=t.custid where c.status='1' and b.status='normal' ");
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ sql.append(" and t.attedate between :sdate and :edate ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ sql.append(" and c.custname like :cname ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ sql.append(" and b.cardno like :cno ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql.append(" and c.custtypeid = :ctypeid ");
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql.append(" and c.deptcode = :dcode");
+ }
+ Query query=entityManager.createNativeQuery(sql.toString());
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ query.setParameter("sdate",searchBean.getStartdate());
+ query.setParameter("edate",searchBean.getEnddate());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("cname","%"+searchBean.getCustname()+"%");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ query.setParameter("cno",searchBean.getCardno());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid",searchBean.getCusttypeid());
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode",searchBean.getDeptcode());
+ }
+ Object object=query.getSingleResult();
+ if(object!=null){
+ result= Integer.parseInt(object.toString());
+ }
+ return result;
+ }
+
+ @Transactional
+ @Override
+ public boolean updateAtteDtl(TAtteDtl dtl) {
+ boolean flag=false;
+ try {
+ entityManager.merge(dtl);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Override
+ public TAtteDtl getDtlByAtteno(String atteno) {
+ if(StringUtil.isEmpty(atteno)){
+ return null;
+ }
+ String sql=" select bean from TAtteDtl bean where atteno = :ano ";
+ TypedQuery<TAtteDtl> query=entityManager.createQuery(sql,TAtteDtl.class);
+ query.setParameter("ano",atteno);
+ List<TAtteDtl> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Override
+ public List<TCustomerInfo> getCustInfo(CustSearchBean searchBean) {
+ String sql = "select a.deptcode,a.custtypeid,a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from T_Customer a left join t_card b on a.custid = b.custid " +
+ " where a.status='1' and b.status='normal' and b.transtatus='normal' ";
+ if (!StringUtil.isEmpty(searchBean.getCustname())){
+ sql += " and a.custname like :perName ";
+ }
+ if (!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql +=" and a.deptcode = :dcode ";
+ }
+ if (!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql +=" and a.custtypeid = :ctypeid ";
+ }
+ sql +=" order by b.cardno desc ";
+ Query query = entityManager.createNativeQuery(sql, TCustomerInfo.class);
+ if (!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("perName", "%"+searchBean.getCustname()+"%");
+ }
+ if (!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode", searchBean.getDeptcode());
+ }
+ if (!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid", searchBean.getCusttypeid());
+ }
+ List<TCustomerInfo> list = query.getResultList();
+ return list;
+ }
+
+ @Override
+ public Pagination getDtlWithPage(AttedtlSearchBean searchBean, int pageNo, int pageSize) {
+ String sql=" select v.transdate attedate,v.transtime attetime,v.doorseqno refno,v.custname,v.custid,c.custtypeid,d.devname devicename,d.deviceid,v.cardno,c.deptcode " ;
+ sql+=" from v_atte_dtl v left join t_nc_device d on cast( v.deviceid as INTEGER) = d.deviceid left join t_customer c on c.custid=v.custid where 1=1 ";
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ sql+=" and v.transdate between :sdate and :edate ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ sql+=" and v.custname like :cname ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql+=" and c.custtypeid = :ctypeid ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql+=" and c.deptcode = :dcode ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ sql+=" and d.devname like :dname";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ sql+=" and v.cardno like :cno ";
+ }
+ sql+=" order by v.doorseqno ";
+ Query query=entityManager.createNativeQuery(sql, AtteDtl.class);
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ query.setParameter("sdate",searchBean.getStartdate());
+ query.setParameter("edate",searchBean.getEnddate());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("cname","%"+searchBean.getCustname()+"%");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid",Integer.parseInt(searchBean.getCusttypeid()));
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode",searchBean.getDeptcode());
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ query.setParameter("dname",searchBean.getDevname());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ query.setParameter("cno",searchBean.getCardno());
+ }
+ pageNo = pageNo <= 0 ? 1 : pageNo;
+ query.setFirstResult((pageNo - 1) * pageSize);
+ query.setMaxResults(pageSize);
+ Pagination page = new Pagination();
+ page.setPageNo(pageNo);
+ page.setPageSize(pageSize);
+ List<AtteDtl> list=query.getResultList();
+ page.setList(list);
+ int totalCount= getDtlCount(searchBean);
+ page.setTotalCount(totalCount);
+ return page;
+ }
+
+ public int getDtlCount(AttedtlSearchBean searchBean){
+ String sql=" select v.transdate attedate,v.transtime attetime,v.doorseqno refno,v.custname,v.custid,c.custtypeid,d.devname devicename,d.deviceid,v.cardno,c.deptcode " ;
+ sql+=" from v_atte_dtl v left join t_nc_device d on cast( v.deviceid as INTEGER) = d.deviceid left join t_customer c on c.custid=v.custid where 1=1 ";
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ sql+=" and v.transdate between :sdate and :edate ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ sql+=" and v.custname like :cname ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql+=" and c.custtypeid = :ctypeid ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql+=" and c.deptcode = :dcode ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ sql+=" and d.devname like :dname";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ sql+=" and v.cardno like :cno ";
+ }
+ sql+=" order by v.doorseqno ";
+ Query query=entityManager.createNativeQuery(sql, AtteDtl.class);
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ query.setParameter("sdate",searchBean.getStartdate());
+ query.setParameter("edate",searchBean.getEnddate());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("cname","%"+searchBean.getCustname()+"%");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid",Integer.parseInt(searchBean.getCusttypeid()));
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode",searchBean.getDeptcode());
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ query.setParameter("dname",searchBean.getDevname());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ query.setParameter("cno",searchBean.getCardno());
+ }
+ List<AtteDtl> list=query.getResultList();
+ if(list!=null){
+ return list.size();
+ }
+ return 0;
+ }
+
+ @Override
+ public boolean delAtteDtl(String attedate, String deptcode) {
+ if(!StringUtil.isEmpty(attedate)){
+ String sql=" delete from t_atte_dtl t where t.attedate=:adate ";
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+=" and t.custid in (select c.custid from t_customer c where c.deptcode = :dcode )";
+ }
+ try {
+ Query query=entityManager.createNativeQuery(sql);
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);
+ }
+ query.setParameter("adate",attedate);
+ query.executeUpdate();
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public List<AtteDtl> getDtlList(AttedtlSearchBean searchBean) {
+ String sql=" select v.transdate attedate,v.transtime attetime,v.doorseqno refno,v.custname,v.custid,c.custtypeid,d.devname devicename,d.deviceid,v.cardno,c.deptcode " ;
+ sql+=" from v_atte_dtl v left join t_nc_device d on cast( v.deviceid as INTEGER) = d.deviceid left join t_customer c on c.custid=v.custid where 1=1 ";
+ sql+=" and exists (select DISTINCT r.deviceid from t_dev_rule r where r.deviceid=cast(v.deviceid as INTEGER) and r.ruleid in (select ar.id from t_atte_rule ar where ar.custtypeid=cast(c.custtypeid as INTEGER) and ar.deptcode=c.deptcode and ar.status=1 )) ";
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ sql+=" and v.transdate between :sdate and :edate ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ sql+=" and v.custname like :cname ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ sql+=" and c.custtypeid = :ctypeid ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ sql+=" and c.deptcode = :dcode ";
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ sql+=" and d.devname like :dname";
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ sql+=" and v.cardno like :cno ";
+ }
+ sql+=" order by v.doorseqno ";
+ Query query=entityManager.createNativeQuery(sql, AtteDtl.class);
+ if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
+ query.setParameter("sdate",searchBean.getStartdate());
+ query.setParameter("edate",searchBean.getEnddate());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCustname())){
+ query.setParameter("cname","%"+searchBean.getCustname()+"%");
+ }
+ if(!StringUtil.isEmpty(searchBean.getCusttypeid())){
+ query.setParameter("ctypeid",Integer.parseInt(searchBean.getCusttypeid()));
+ }
+ if(!StringUtil.isEmpty(searchBean.getDeptcode())){
+ query.setParameter("dcode",searchBean.getDeptcode());
+ }
+ if(!StringUtil.isEmpty(searchBean.getDevname())){
+ query.setParameter("dname",searchBean.getDevname());
+ }
+ if(!StringUtil.isEmpty(searchBean.getCardno())){
+ query.setParameter("cno",searchBean.getCardno());
+ }
+
+ List<AtteDtl> list=query.getResultList();
+
+ return list;
+ }
+
+ @Override
+ public List<TAtteDtl> getDetailList(String custid,String attedate) {
+ if(StringUtil.isEmpty(custid)||StringUtil.isEmpty(attedate)){
+ return null;
+ }
+ String sql=" select bean from TAtteDtl bean where bean.status=1 and bean.attedate= :adate and bean.custid= :cid ";
+
+ Query query=entityManager.createQuery(sql,TAtteDtl.class);
+ query.setParameter("adate",attedate);
+ query.setParameter("cid",custid);
+
+ List<TAtteDtl> list=query.getResultList();
+
+ return list;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/CustseaDaoImpl.java b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/CustseaDaoImpl.java
new file mode 100644
index 0000000..260bb29
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/CustseaDaoImpl.java
@@ -0,0 +1,184 @@
+package com.supwisdom.dlpay.atte.dao.impl;
+
+import com.supwisdom.dlpay.atte.dao.CustseaDao;
+import com.supwisdom.dlpay.atte.domain.TDevCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeaCusttype;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.ncmgr.domain.TNcDevice;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+@Repository
+public class CustseaDaoImpl implements CustseaDao {
+ @PersistenceContext
+ EntityManager entityManager;
+
+ @Transactional
+ @Override
+ public Pagination getCustseaWithPage(String custtypename, int pageNo, int pageSize) {
+ StringBuffer sql=new StringBuffer(" select c.custtypeid,t.id,t.updatetime from tb_custtype c left join t_sea_custtype t on c.custtypeid=t.custtypeid where 1=1 ");
+ if(!StringUtil.isEmpty(custtypename)){
+ sql.append(" and c.custtypename like :name ");
+ }
+ Query query=entityManager.createNativeQuery(sql.toString(), TSeaCusttype.class);
+ if (!StringUtil.isEmpty(custtypename)){
+ query.setParameter("name","%"+custtypename+"%");
+ }
+ pageNo = pageNo <= 0 ? 1 : pageNo;
+ query.setFirstResult((pageNo - 1) * pageSize);
+ query.setMaxResults(pageSize);
+ Pagination page = new Pagination();
+ page.setPageNo(pageNo);
+ page.setPageSize(pageSize);
+ List<TSeaCusttype> list=query.getResultList();
+ page.setList(list);
+ int totalCount=getCustseaCount(custtypename);
+ page.setTotalCount(totalCount);
+ return page;
+ }
+ private int getCustseaCount(String custtypename){
+ String sql=" select count(custtypeid) from tb_custtype where 1=1 ";
+ if (!StringUtil.isEmpty(custtypename)){
+ sql+=" and custtypename like :name ";
+ }
+ Query query=entityManager.createNativeQuery(sql);
+ if (!StringUtil.isEmpty(custtypename)){
+ query.setParameter("name","%"+custtypename+"%");
+ }
+ int cnt=0;
+ List list=query.getResultList();
+ if(list!=null && list.size()>0){
+ cnt=Integer.parseInt(list.get(0).toString());
+ }
+ return cnt;
+ }
+
+ @Transactional
+ @Override
+ public TSeaCusttype getCustseaById(Integer custtypeid) {
+ String sql=" select c.custtypeid,t.id,t.updatetime from tb_custtype c left join t_sea_custtype t on c.custtypeid=t.custtypeid where c.custtypeid=:cid ";
+ Query query=entityManager.createNativeQuery(sql,TSeaCusttype.class);
+ query.setParameter("cid",custtypeid);
+ List<TSeaCusttype> list=query.getResultList();
+ return list.size()==0?null:list.get(0);
+ }
+ @Transactional
+ @Override
+ public boolean updateCustsea(TSeaCusttype tSeaCusttype) {
+ boolean flag=false;
+
+ try {
+ entityManager.merge(tSeaCusttype);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Transactional
+ @Override
+ public boolean saveCustsea(TSeaCusttype tSeaCusttype) {
+ boolean flag=false;
+ try {
+ entityManager.persist(tSeaCusttype);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public boolean exist(Integer custtypeid) {
+ String sql=" select count(custtypeid) from t_sea_custtype where custtypeid=:sid ";
+ Query query=entityManager.createNativeQuery(sql);
+ query.setParameter("sid",custtypeid);
+ List list=query.getResultList();
+ int cnt=0;
+ if(list!=null&&list.size()>0){
+ cnt= Integer.parseInt(list.get(0).toString());
+ }
+ if(cnt>0){
+ return true;
+ }
+ return false;
+ }
+
+ @Transactional
+ @Override
+ public List<TNcDevice> getAllCanAssign(Integer ruleid,String devname,String devtype) {
+ String sql=" select * from t_nc_device c where c.operflag='A' and "+
+ " c.deviceid not in (select deviceid from t_dev_rule where ruleid= :rid ) ";
+ if(!StringUtil.isEmpty(devname)){
+ sql+= " and c.devname like :cname ";
+ }
+ if(!StringUtil.isEmpty(devtype)){
+ sql+=" and c.devtype = :ctype ";
+ }
+ sql+= " order by c.deviceid ";
+ Query query=entityManager.createNativeQuery(sql,TNcDevice.class);
+ query.setParameter("rid",ruleid);
+ if(!StringUtil.isEmpty(devname)){
+ query.setParameter("cname","%"+devname+"%");
+ }
+ if(!StringUtil.isEmpty(devtype)){
+ query.setParameter("ctype",devtype);
+ }
+ List<TNcDevice> list=query.getResultList();
+ return list;
+ }
+ @Transactional
+ @Override
+ public List<TNcDevice> getAllDevByCusttype(Integer ruleid) {
+ String sql=" select * from t_nc_device c left join t_dev_rule t on c.deviceid=t.deviceid where 1=1";
+ if (ruleid!=null){
+ sql+=" and t.ruleid = :typeid ";
+ }
+ sql+= " order by c.deviceid ";
+ Query query=entityManager.createNativeQuery(sql,TNcDevice.class);
+ if (ruleid!=null){
+ query.setParameter("typeid",ruleid);
+ }
+ List<TNcDevice> list=query.getResultList();
+ return list;
+ }
+
+ @Transactional
+ @Override
+ public boolean deleteDevRuleid(Integer ruleid) {
+ String sql=" delete from TDevCusttype where ruleid =:rid ";
+ if(ruleid!=null){
+
+ Query query= null;
+ try {
+ query = entityManager.createQuery(sql);
+ query.setParameter("rid",ruleid);
+ query.executeUpdate();
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return false;
+ }
+ @Transactional
+ @Override
+ public boolean addDevRuleid(TDevCusttype bean) {
+ boolean flag=false;
+ try {
+ entityManager.persist(bean);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/SeasondaoImpl.java b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/SeasondaoImpl.java
new file mode 100644
index 0000000..1c53280
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/SeasondaoImpl.java
@@ -0,0 +1,204 @@
+package com.supwisdom.dlpay.atte.dao.impl;
+
+import com.supwisdom.dlpay.atte.dao.SeasonDao;
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+@Repository
+public class SeasondaoImpl implements SeasonDao {
+ @PersistenceContext
+ EntityManager entityManager;
+
+ @Transactional
+ @Override
+ public Pagination getSeasonWithPage(String season,String deptcode, int pageNo, int pageSize) {
+ String sql=" select bean from TSeason bean where bean.status!=0 ";
+ if(!StringUtil.isEmpty(season)){
+ sql+= " and bean.season like :name ";
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+= " and bean.deptcode= :dcode ";
+ }
+ sql+=" order by bean.id ";
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+ if(!StringUtil.isEmpty(season)){
+ query.setParameter("name","%"+season+"%");
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);;
+ }
+ pageNo = pageNo <= 0 ? 1 : pageNo;
+ query.setFirstResult((pageNo - 1) * pageSize);
+ query.setMaxResults(pageSize);
+ Pagination page = new Pagination();
+ page.setPageNo(pageNo);
+ page.setPageSize(pageSize);
+ List<TSeason> list=query.getResultList();
+ page.setList(list);
+ int totalCount=getSeasonCount(season,deptcode);
+ page.setTotalCount(totalCount);
+ return page;
+ }
+
+ @Transactional
+ @Override
+ public TSeason getSeasonById(Integer id) {
+ String sql="select bean from TSeason bean where status!=0 and id = :sid";
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+ query.setParameter("sid",id);
+ List<TSeason> list=query.getResultList();
+ return list.size()==0?null:list.get(0);
+ }
+
+ private int getSeasonCount(String season,String deptcode){
+ String sql=" select count(bean.id) from TSeason bean where bean.status!=0 ";
+ if(!StringUtil.isEmpty(season)){
+ sql+= " and bean.season like :name ";
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+= " and bean.deptcode= :dcode ";
+ }
+ Query query = entityManager.createQuery(sql);
+ if(!StringUtil.isEmpty(season)){
+ query.setParameter("name","%"+season+"%");
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);;
+ }
+ int cnt = 0;
+ List list = query.getResultList();
+ if (list!=null && list.size()>0){
+ cnt = Integer.parseInt(list.get(0).toString());
+ }
+ return cnt;
+ }
+
+ @Transactional
+ @Override
+ public TSeason findBySeason(String season) {
+ String sql=" select bean from TSeason bean where bean.season=:name ";
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+ query.setParameter("name",season);
+ List<TSeason> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Transactional
+ @Override
+ public boolean saveSeason(TSeason season) {
+ boolean flag=false;
+ try {
+ entityManager.persist(season);
+ flag=true;
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Transactional
+ @Override
+ public int getMaxSeasonId() {
+ String sql=" select max(s.id) from TSeason s ";
+ Query query=entityManager.createQuery(sql);
+ Object result=query.getSingleResult();
+ if(result!=null){
+ return (int)result;
+ }
+ return 0;
+ }
+
+ @Transactional
+ @Override
+ public TSeason getSeasonByIdAndName(Integer id, String season) {
+ String sql="select bean from TSeason bean where 1=1 and id <>:sid ";
+ if (!StringUtil.isEmpty(season)){
+ sql+= " and bean.season = :name";
+ }
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+ query.setParameter("sid",id);
+ if(!StringUtil.isEmpty(season)){
+ query.setParameter("name",season);
+ }
+ List<TSeason> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+
+ @Transactional
+ @Override
+ public boolean updateSeason(TSeason season) {
+ boolean flag=false;
+
+ try {
+ entityManager.merge(season);
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+ @Transactional
+ @Override
+ public boolean deleteSeason(int id) {
+ boolean flag=false;
+
+ try {
+ String sql=" update t_atte_rule set status=0 where id = ?1 ";
+ Query query=entityManager.createNativeQuery(sql);
+ query.setParameter(1,id);
+ query.executeUpdate();
+ flag=true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return flag;
+ }
+
+ @Transactional
+ @Override
+ public List<TSeason> findAllSeason() {
+ String sql=" select bean from TSeason bean where status=1 ";
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+ List<TSeason> list=query.getResultList();
+ return list;
+ }
+ @Transactional
+ @Override
+ public TSeason getOpenRule(Integer custtypid, String deptcode) {
+ String sql=" select bean from TSeason bean where bean.status=1 ";
+ if(custtypid!=null){
+ sql+=" and bean.custtypeid =:ctypeid ";
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ sql+=" and bean.deptcode = :dcode";
+ }
+ TypedQuery<TSeason> query=entityManager.createQuery(sql,TSeason.class);
+
+ if(custtypid!=null){
+ query.setParameter("ctypeid",custtypid);
+ }
+ if(!StringUtil.isEmpty(deptcode)){
+ query.setParameter("dcode",deptcode);
+ }
+ List<TSeason> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return list.get(0);
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/ClassId.java b/src/main/java/com/supwisdom/dlpay/atte/domain/ClassId.java
new file mode 100644
index 0000000..7a13359
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/ClassId.java
@@ -0,0 +1,24 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import java.io.Serializable;
+
+public class ClassId implements Serializable {
+ private String custid;
+ private String attedate;
+
+ public String getCustid() {
+ return custid;
+ }
+
+ public void setCustid(String custid) {
+ this.custid = custid;
+ }
+
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/CustDev.java b/src/main/java/com/supwisdom/dlpay/atte/domain/CustDev.java
new file mode 100644
index 0000000..37e0728
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/CustDev.java
@@ -0,0 +1,24 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import java.io.Serializable;
+
+public class CustDev implements Serializable {
+ private Integer deviceid;
+ private Integer ruleid;
+
+ public Integer getDeviceid() {
+ return deviceid;
+ }
+
+ public void setDeviceid(Integer deviceid) {
+ this.deviceid = deviceid;
+ }
+
+ public Integer getRuleid() {
+ return ruleid;
+ }
+
+ public void setRuleid(Integer ruleid) {
+ this.ruleid = ruleid;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteClass.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteClass.java
new file mode 100644
index 0000000..43e8eca
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteClass.java
@@ -0,0 +1,95 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name="t_atte_class")
+public class TAtteClass {
+
+ private Integer classid;
+ private String classname;
+ private String startdate;
+ private String enddate;
+ private Integer status;
+ private Integer workorno;
+ private String updatetime;
+ private Integer timegrpid;
+ private String deptcode;
+
+ @Id
+ @Column(name="classid")
+ public Integer getClassid() {
+ return classid;
+ }
+
+ public void setClassid(Integer classid) {
+ this.classid = classid;
+ }
+ @Column(name="classname")
+ public String getClassname() {
+ return classname;
+ }
+
+ public void setClassname(String classname) {
+ this.classname = classname;
+ }
+ @Column(name="startdate")
+ public String getStartdate() {
+ return startdate;
+ }
+
+ public void setStartdate(String startdate) {
+ this.startdate = startdate;
+ }
+ @Column(name="enddate")
+ public String getEnddate() {
+ return enddate;
+ }
+
+ public void setEnddate(String enddate) {
+ this.enddate = enddate;
+ }
+ @Column(name="status")
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+ @Column(name="workorno")
+ public Integer getWorkorno() {
+ return workorno;
+ }
+
+ public void setWorkorno(Integer workorno) {
+ this.workorno = workorno;
+ }
+ @Column(name="updatetime")
+ public String getUpdatetime() {
+ return updatetime;
+ }
+
+ public void setUpdatetime(String updatetime) {
+ this.updatetime = updatetime;
+ }
+ @Column(name="timegrpid")
+ public Integer getTimegrpid() {
+ return timegrpid;
+ }
+
+ public void setTimegrpid(Integer timegrpid) {
+ this.timegrpid = timegrpid;
+ }
+
+ @Column(name="deptcode")
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteDtl.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteDtl.java
new file mode 100644
index 0000000..38a046e
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TAtteDtl.java
@@ -0,0 +1,106 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "t_atte_dtl")
+public class TAtteDtl {
+ private String atteno;
+ private String custid;
+ private String attedate;
+ private Integer timeid;
+ private Integer state;
+ private Integer status;
+ private String remark;
+ private Integer oldstate;
+ private String operid;
+ private String updatetime;
+
+
+ @Id
+ @Column(name = "atteno")
+ public String getAtteno() {
+ return atteno;
+ }
+
+ public void setAtteno(String atteno) {
+ this.atteno = atteno;
+ }
+ @Column(name = "custid")
+ public String getCustid() {
+ return custid;
+ }
+
+ public void setCustid(String custid) {
+ this.custid = custid;
+ }
+ @Column(name = "attedate")
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+ @Column(name = "timeid")
+ public Integer getTimeid() {
+ return timeid;
+ }
+
+ public void setTimeid(Integer timeid) {
+ this.timeid = timeid;
+ }
+ @Column(name = "state")
+ public Integer getState() {
+ return state;
+ }
+
+ public void setState(Integer state) {
+ this.state = state;
+ }
+ @Column(name = "status")
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+
+ @Column(name = "remark")
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+ @Column(name = "oldstate")
+ public Integer getOldstate() {
+ return oldstate;
+ }
+
+ public void setOldstate(Integer oldstate) {
+ this.oldstate = oldstate;
+ }
+ @Column(name = "operid")
+ public String getOperid() {
+ return operid;
+ }
+
+ public void setOperid(String operid) {
+ this.operid = operid;
+ }
+ @Column(name = "updatetime")
+ public String getUpdatetime() {
+ return updatetime;
+ }
+
+ public void setUpdatetime(String updatetime) {
+ this.updatetime = updatetime;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TClassCust.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TClassCust.java
new file mode 100644
index 0000000..493391f
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TClassCust.java
@@ -0,0 +1,39 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import javax.persistence.*;
+
+@Entity
+@Table(name="t_class_cust")
+@IdClass(ClassId.class)
+public class TClassCust {
+ private Integer classid;
+ private String custid;
+ private String attedate;
+
+ @Column(name="classid")
+ public Integer getClassid() {
+ return classid;
+ }
+
+ public void setClassid(Integer classid) {
+ this.classid = classid;
+ }
+ @Id
+ @Column(name="custid")
+ public String getCustid() {
+ return custid;
+ }
+
+ public void setCustid(String custid) {
+ this.custid = custid;
+ }
+ @Column(name="attedate")
+ public String getAttedate() {
+ return attedate;
+ }
+
+ public void setAttedate(String attedate) {
+ this.attedate = attedate;
+ }
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TDevCusttype.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TDevCusttype.java
new file mode 100644
index 0000000..42563d6
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TDevCusttype.java
@@ -0,0 +1,32 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import org.springframework.data.repository.cdi.Eager;
+
+import javax.persistence.*;
+
+@Entity
+@IdClass(CustDev.class)
+@Table(name="t_dev_rule")
+public class TDevCusttype {
+ private Integer ruleid;
+ private Integer deviceid;
+ @Id
+ @Column(name="ruleid")
+ public Integer getRuleid() {
+ return ruleid;
+ }
+
+ public void setRuleid(Integer ruleid) {
+ this.ruleid = ruleid;
+ }
+
+ @Id
+ @Column(name="deviceid")
+ public Integer getDeviceid() {
+ return deviceid;
+ }
+
+ public void setDeviceid(Integer deviceid) {
+ this.deviceid = deviceid;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TSeaCusttype.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TSeaCusttype.java
new file mode 100644
index 0000000..36b84e8
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TSeaCusttype.java
@@ -0,0 +1,40 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="t_sea_custtype")
+public class TSeaCusttype {
+ private Integer custtypeid;
+ private Integer id;
+ private String updatetime;
+
+ @Id
+ @Column(name = "custtypeid", unique = true, nullable = false)
+ public Integer getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(Integer custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+ @Column(name="id")
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+ @Column(name="updatetime")
+ public String getUpdatetime() {
+ return updatetime;
+ }
+
+ public void setUpdatetime(String updatetime) {
+ this.updatetime = updatetime;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/domain/TSeason.java b/src/main/java/com/supwisdom/dlpay/atte/domain/TSeason.java
new file mode 100644
index 0000000..7cea29a
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/domain/TSeason.java
@@ -0,0 +1,86 @@
+package com.supwisdom.dlpay.atte.domain;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import java.io.Serializable;
+
+@Entity
+@Table(name="t_atte_rule")
+public class TSeason implements Serializable {
+ private Integer id;
+ private String season;
+ private Integer weekid;
+ private Integer status;
+ private String addtime;
+ private String updatetime;
+ private Integer custtypeid;
+ private String deptcode;
+
+ @Id
+ @Column(name = "id", unique = true, nullable = false)
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+ @Column(name = "rulename")
+ public String getSeason() {
+ return season;
+ }
+
+ public void setSeason(String season) {
+ this.season = season;
+ }
+ @Column(name = "weekid", nullable = false)
+ public Integer getWeekid() {
+ return weekid;
+ }
+
+ public void setWeekid(Integer weekid) {
+ this.weekid = weekid;
+ }
+
+ public Integer getStatus() {
+ return status;
+ }
+
+ public void setStatus(Integer status) {
+ this.status = status;
+ }
+ @Column(name = "addtime")
+ public String getAddtime() {
+ return addtime;
+ }
+
+ public void setAddtime(String addtime) {
+ this.addtime = addtime;
+ }
+ @Column(name = "updatetime")
+ public String getUpdatetime() {
+ return updatetime;
+ }
+
+ public void setUpdatetime(String updatetime) {
+ this.updatetime = updatetime;
+ }
+ @Column(name="custtypeid")
+ public Integer getCusttypeid() {
+ return custtypeid;
+ }
+
+ public void setCusttypeid(Integer custtypeid) {
+ this.custtypeid = custtypeid;
+ }
+ @Column(name="deptcode")
+ public String getDeptcode() {
+ return deptcode;
+ }
+
+ public void setDeptcode(String deptcode) {
+ this.deptcode = deptcode;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java b/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java
new file mode 100644
index 0000000..5442097
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java
@@ -0,0 +1,78 @@
+package com.supwisdom.dlpay.atte.service;
+
+import com.supwisdom.dlpay.atte.bean.AtteDtl;
+import com.supwisdom.dlpay.atte.bean.AttedtlSearchBean;
+import com.supwisdom.dlpay.atte.domain.TAtteClass;
+import com.supwisdom.dlpay.atte.domain.TAtteDtl;
+import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+
+public interface AtteClassService {
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public Pagination getClassWithPage(String classname,String deptcode, int pageNo, int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TAtteClass getClassById(Integer classid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean saveAtteClass(TAtteClass atteClass);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TAtteClass getClassByName(String classname);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public int getMaxClassid();
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean canAddClass(String deptcode,int workorno,String startdate,String enddate,int exceptid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateClass(TAtteClass atteClass);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<TCustomerInfo> hasClassCust(Integer classid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<TCustomerInfo> getAllCustomer(String perName, String deptcode, String custtypeid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean addClassCust(Integer classid,List<String> custidlist);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean deleteAtteClass(Integer classid);
+
+ //生成考勤名单 attedate
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean createAtteDtl(String attedate,String deptcode);
+
+ //查询考勤明细信息
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public Pagination getAtteDtlInfoWithPage(AttedtlSearchBean searchBean,int pageNo,int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateAtteDtl(TAtteDtl dtl);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TAtteDtl getDtlByAtteno(String atteno);
+
+ //批量生产考勤名单
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean addBatchDtl(String startdate,String enddate,String deptcode);
+
+ //查询考勤流水信息
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public Pagination getDtlWithPage(AttedtlSearchBean searchBean,int pageNo,int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<AtteDtl> getDtlList(AttedtlSearchBean searchBean);
+
+ //处理考勤流水
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean handleDtl(String deptcode,String attedate);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/CustseaService.java b/src/main/java/com/supwisdom/dlpay/atte/service/CustseaService.java
new file mode 100644
index 0000000..20910a8
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/CustseaService.java
@@ -0,0 +1,39 @@
+package com.supwisdom.dlpay.atte.service;
+
+import com.supwisdom.dlpay.atte.domain.TSeaCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.ncmgr.domain.TNcDevice;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface CustseaService {
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public Pagination getCustseaWithPage(String custtypename, int pageNo, int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSeaCusttype getCustseaById(Integer custtypeid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateCustsea(TSeaCusttype tSeaCusttype);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean saveCustsea(TSeaCusttype tSeaCusttype);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean exist(Integer custtypeid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<TNcDevice> getAllCanAssign(Integer ruleid,String devname,String devtype);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<TNcDevice> getAllDevByCusttype(Integer ruleid);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public void assignDevRule(String ids,String ruleid);
+
+
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java b/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java
new file mode 100644
index 0000000..63d6202
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java
@@ -0,0 +1,43 @@
+package com.supwisdom.dlpay.atte.service;
+
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface SeasonService {
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public Pagination getSeasonWithPage(String season,String deptcode,int pageNo, int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSeason getSeasonById(Integer id);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSeason findBySeason(String season);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean saveSeason(TSeason season);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public int getMaxSeasonId();
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSeason findSeasonByIdAndName(Integer id,String season);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateSeason(TSeason season);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean deleteSeason(int id);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public List<TSeason> findAllSeason();
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean stoporopen(Integer id);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public TSeason getOpenRule(String custtypeid,String deptcode);
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteClassServiceImpl.java b/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteClassServiceImpl.java
new file mode 100644
index 0000000..02ae69b
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteClassServiceImpl.java
@@ -0,0 +1,380 @@
+package com.supwisdom.dlpay.atte.service.impl;
+
+import com.supwisdom.dlpay.atte.bean.AtteDtl;
+import com.supwisdom.dlpay.atte.bean.AttedtlSearchBean;
+import com.supwisdom.dlpay.atte.bean.CustSearchBean;
+import com.supwisdom.dlpay.atte.dao.AtteClassDao;
+import com.supwisdom.dlpay.atte.dao.CustseaDao;
+import com.supwisdom.dlpay.atte.dao.SeasonDao;
+import com.supwisdom.dlpay.atte.domain.*;
+import com.supwisdom.dlpay.atte.service.AtteClassService;
+import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.mainservice.dao.CustomerDao;
+import com.supwisdom.dlpay.ncmgr.dao.NcTimeDao;
+import com.supwisdom.dlpay.ncmgr.dao.NcTimeGrpDao;
+import com.supwisdom.dlpay.ncmgr.dao.NcWeekTimeDao;
+import com.supwisdom.dlpay.ncmgr.domain.TNcTime;
+import com.supwisdom.dlpay.ncmgr.domain.TNcTimegrp;
+import com.supwisdom.dlpay.ncmgr.domain.TNcWeektime;
+import com.supwisdom.dlpay.system.domain.TCustType;
+import com.supwisdom.dlpay.system.page.Pagination;
+import com.supwisdom.dlpay.system.service.SystemService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class AtteClassServiceImpl implements AtteClassService {
+ @Autowired
+ AtteClassDao atteClassDao;
+ @Autowired
+ CustomerDao customerDao;
+ @Autowired
+ CustseaDao custseaDao;
+ @Autowired
+ SeasonDao seasonDao;
+ @Autowired
+ NcTimeGrpDao ncTimeGrpDao;
+ @Autowired
+ NcWeekTimeDao ncWeekTimeDao;
+ @Autowired
+ NcTimeDao ncTimeDao;
+ @Autowired
+ private SystemService systemService;
+
+ @Override
+ public Pagination getClassWithPage(String classname,String deptcode, int pageNo, int pageSize) {
+ return atteClassDao.getClassWithPage(classname,deptcode,pageNo,pageSize);
+ }
+
+ @Override
+ public TAtteClass getClassById(Integer classid) {
+ return atteClassDao.getClassById(classid);
+ }
+
+ @Override
+ public boolean saveAtteClass(TAtteClass atteClass) {
+ return atteClassDao.saveAtteClass(atteClass);
+ }
+
+ @Override
+ public TAtteClass getClassByName(String classname) {
+ return atteClassDao.getClassByName(classname);
+ }
+
+ @Override
+ public int getMaxClassid() {
+ return atteClassDao.getMaxClassid();
+ }
+
+ @Override
+ public boolean canAddClass(String deptcode,int workorno, String startdate, String enddate,int exceptid) {
+ if(StringUtil.isEmpty(startdate)||StringUtil.isEmpty(enddate)){
+ return false;
+ }
+ if(atteClassDao.existClass(deptcode,startdate,enddate,workorno,exceptid)){
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean updateClass(TAtteClass atteClass) {
+ return atteClassDao.updateClass(atteClass);
+ }
+
+ @Override
+ public List<TCustomerInfo> hasClassCust(Integer classid) {
+ if(classid==null){
+ return null;
+ }
+ return atteClassDao.hasClassCust(classid);
+ }
+
+ @Override
+ public List<TCustomerInfo> getAllCustomer(String perName, String deptcode, String custtypeid) {
+ CustSearchBean searchBean=new CustSearchBean();
+ searchBean.setCusttypeid(custtypeid);
+ searchBean.setDeptcode(deptcode);
+ searchBean.setCustname(perName);
+ return atteClassDao.getCustInfo(searchBean);
+ }
+
+ @Override
+ public boolean addClassCust(Integer classid, List<String> custidlist) {
+ TAtteClass atteClass=getClassById(classid);
+ if(atteClass==null){
+ return false;
+ }
+ atteClassDao.delClassCustByClassid(classid);
+ String sdate=atteClass.getStartdate();
+ String edate=atteClass.getEnddate();
+ Integer start=Integer.parseInt(sdate);
+ Integer end=Integer.parseInt(edate);
+ while (start<=end){
+ for (String custid:custidlist){
+ TClassCust oldbean=atteClassDao.getByIdAndDate(custid,sdate);
+ if(oldbean!=null){
+ atteClassDao.delClassCust(oldbean);
+ }
+ TClassCust newbean=new TClassCust();
+ newbean.setClassid(classid);
+ newbean.setAttedate(sdate);
+ newbean.setCustid(custid);
+ atteClassDao.addClassCust(newbean);
+ }
+ sdate= DateUtil.getNewDay(sdate,1);
+ start=Integer.parseInt(sdate);
+ }
+ atteClass.setUpdatetime(DateUtil.getNow());
+ atteClassDao.updateClass(atteClass);
+ return true;
+ }
+
+ @Override
+ public boolean deleteAtteClass(Integer classid) {
+ TAtteClass atteClass=atteClassDao.getClassById(classid);
+ if(atteClass==null){
+ return false;
+ }
+ atteClass.setStatus(0); // 1-正常 0-删除
+ atteClass.setUpdatetime(DateUtil.getNow());
+ atteClassDao.updateClass(atteClass); //删除班次
+ atteClassDao.delClassCustByClassid(classid); //删除班次绑定的人员
+ return true;
+ }
+
+
+ /**
+ * 生成考勤人员名单
+ */
+
+ @Override
+ public boolean createAtteDtl(String attedate,String deptcode) {
+ if(StringUtil.isEmpty(attedate)){
+ return false;
+ }
+ //删除原流水
+ atteClassDao.delAtteDtl(attedate,deptcode);
+ CustSearchBean searchBean=new CustSearchBean();
+ searchBean.setDeptcode(deptcode);
+ searchBean.setAttedate(attedate);
+ // 获取考勤人员
+ List<TCustomerInfo> custlist=atteClassDao.getAtteCust(searchBean);
+
+ for (TCustomerInfo cust:custlist){
+ TClassCust classCust=atteClassDao.getByIdAndDate(cust.getCustid(),attedate);
+ TNcTimegrp timegrp=null;
+ TAtteClass atteClass=null;
+ if(classCust==null){
+ // 无排班
+ Integer timegrpid=getTimegrp(cust,attedate);
+ if(timegrpid!=null){
+ timegrp=ncTimeGrpDao.findByTimeGrpId(timegrpid);
+ }
+ }else{
+
+ atteClass=atteClassDao.getClassById(classCust.getClassid());
+ if(atteClass!=null&&atteClass.getWorkorno()==1){
+ timegrp=ncTimeGrpDao.findByTimeGrpId(atteClass.getTimegrpid());
+ }
+
+ }
+
+ if(timegrp==null){
+ continue;
+ }
+ Map<Integer,Integer> map=new HashMap<>();
+ map.put(timegrp.getTimeid1(),timegrp.getTimeid1());
+ map.put(timegrp.getTimeid2(),timegrp.getTimeid2());
+ map.put(timegrp.getTimeid3(),timegrp.getTimeid3());
+ map.put(timegrp.getTimeid4(),timegrp.getTimeid4());
+ map.put(timegrp.getTimeid5(),timegrp.getTimeid5());
+ map.put(timegrp.getTimeid6(),timegrp.getTimeid6());
+ for(Integer timeid:map.keySet()){
+ if(timeid!=null){
+ TAtteDtl dtl=new TAtteDtl();
+ dtl.setAttedate(attedate);
+ dtl.setAtteno(atteClassDao.getAtteNo(attedate));
+ dtl.setCustid(cust.getCustid());
+ dtl.setState(0);
+ dtl.setStatus(1);
+ dtl.setTimeid(timeid);
+ dtl.setUpdatetime(DateUtil.getNow());
+ atteClassDao.saveAtteDtl(dtl);
+ }
+ }
+
+ }
+ return true;
+ }
+
+ private Integer getTimegrp(TCustomerInfo cust,String attedate){
+ Integer timegrpid=null;
+ if(cust.getCusttypeid()==null||StringUtil.isEmpty(cust.getDeptcode())){
+ return timegrpid;
+ }
+ TSeason season=seasonDao.getOpenRule(cust.getCusttypeid(),cust.getDeptcode());
+ if(season==null&&season.getWeekid()==null){
+ return timegrpid;
+ }
+ TNcWeektime weektime=ncWeekTimeDao.findByWeekTimeId(season.getWeekid());
+ if(weektime==null){
+ return timegrpid;
+ }
+ int weekday=DateUtil.getWeekday(attedate);
+ switch (weekday){
+ case 1:
+ timegrpid=weektime.getDay1grpid();
+ break;
+ case 2:
+ timegrpid=weektime.getDay2grpid();
+ break;
+ case 3:
+ timegrpid=weektime.getDay3grpid();
+ break;
+ case 4:
+ timegrpid=weektime.getDay4grpid();
+ break;
+ case 5:
+ timegrpid=weektime.getDay5grpid();
+ break;
+ case 6:
+ timegrpid=weektime.getDay6grpid();
+ break;
+ case 7:
+ timegrpid=weektime.getDay7grpid();
+ break;
+ default:
+ timegrpid=0;
+ break;
+ }
+ return timegrpid;
+
+ }
+
+ /** HHmmss
+ * 获取时差 (min)
+ *
+ */
+ public int getDiffMin(String starttime,String endtime){
+ String stime=DateUtil.getNow("yyyyMMdd")+starttime;
+ String etime=DateUtil.getNow("yyyyMMdd")+endtime;
+ long diff=DateUtil.getInterval(stime,etime); // 毫秒
+ int min= (int) (diff/(1000*60));
+ return min;
+ }
+
+ @Override
+ public Pagination getAtteDtlInfoWithPage(AttedtlSearchBean searchBean, int pageNo, int pageSize) {
+ return atteClassDao.getAttedtlWithPage(searchBean,pageNo,pageSize);
+ }
+
+ @Override
+ public boolean updateAtteDtl(TAtteDtl dtl) {
+ return atteClassDao.updateAtteDtl(dtl);
+ }
+
+ @Override
+ public TAtteDtl getDtlByAtteno(String atteno) {
+ return atteClassDao.getDtlByAtteno(atteno);
+ }
+
+
+ @Override
+ public boolean addBatchDtl(String startdate, String enddate, String deptcode) {
+ Integer start=Integer.parseInt(startdate);
+ Integer end=Integer.parseInt(enddate);
+ while (start<=end){
+ createAtteDtl(startdate,deptcode);
+ startdate= DateUtil.getNewDay(startdate,1);
+ start=Integer.parseInt(startdate);
+ }
+ return true;
+ }
+
+ @Override
+ public Pagination getDtlWithPage(AttedtlSearchBean searchBean, int pageNo, int pageSize) {
+ return atteClassDao.getDtlWithPage(searchBean,pageNo,pageSize);
+ }
+
+ @Override
+ public List<AtteDtl> getDtlList(AttedtlSearchBean searchBean) {
+ return atteClassDao.getDtlList(searchBean);
+ }
+
+ @Override
+ public boolean handleDtl(String deptcode, String attedate) {
+ AttedtlSearchBean searchBean=new AttedtlSearchBean();
+ searchBean.setDeptcode(deptcode);
+ searchBean.setStartdate(attedate);
+ searchBean.setEnddate(attedate);
+ List<AtteDtl> list=atteClassDao.getDtlList(searchBean);
+ for(AtteDtl dtl:list){
+ List<TAtteDtl> details=atteClassDao.getDetailList(dtl.getCustid(),attedate) ;
+ if(details!=null){
+ for(TAtteDtl detail:details){
+ int state=getState(detail.getTimeid(),dtl.getAttetime());
+ if(detail.getState()==0){
+ detail.setState(state);
+ detail.setUpdatetime(DateUtil.getNow());
+ atteClassDao.updateAtteDtl(detail);
+ }else if(detail.getState()==2&&state==1){
+ detail.setState(state);
+ detail.setUpdatetime(DateUtil.getNow());
+ atteClassDao.updateAtteDtl(detail);
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ // 判断流水状态 0-未打卡 1-正常 2-迟到/早退 3-请假
+ public int getState(Integer timeid,String attetime){
+ int flag=0;
+ TNcTime time=ncTimeDao.findByTimeId(timeid);
+ if(time==null){
+ return flag;
+ }
+ String btime=time.getBtime().replace(":","")+"00";
+ String etime=time.getEtime().replace(":","")+"00";
+ int bmin=getDiffMin(attetime,btime);
+ int emin=getDiffMin(attetime,etime);
+ if(time.getTimetype()==1){ //考到
+ if(bmin>0){ //
+ flag=0;
+ }else {
+ if(emin>0){
+ flag=1;
+ }else if(emin>-60){
+ flag=2;
+ }else{
+ flag=0;
+ }
+ }
+ }else if(time.getTimetype()==2){ //考离
+ if(bmin>60){
+ flag=0;
+ }else if(bmin<60&&bmin>0){
+ flag=2;
+ }else if(bmin<0&&emin>0){
+ flag=1;
+ }else{
+ flag=0;
+ }
+ }else{
+ if(bmin<0&&emin>0){
+ flag=1;
+ }else{
+ flag=0;
+ }
+ }
+ return flag;
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/impl/CustseaServiceImpl.java b/src/main/java/com/supwisdom/dlpay/atte/service/impl/CustseaServiceImpl.java
new file mode 100644
index 0000000..ca77501
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/CustseaServiceImpl.java
@@ -0,0 +1,71 @@
+package com.supwisdom.dlpay.atte.service.impl;
+
+import com.supwisdom.dlpay.atte.dao.CustseaDao;
+import com.supwisdom.dlpay.atte.domain.TDevCusttype;
+import com.supwisdom.dlpay.atte.domain.TSeaCusttype;
+import com.supwisdom.dlpay.atte.service.CustseaService;
+import com.supwisdom.dlpay.framework.util.StringUtil;
+import com.supwisdom.dlpay.ncmgr.domain.TNcDevice;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class CustseaServiceImpl implements CustseaService {
+ @Autowired
+ CustseaDao custseaDao;
+ @Override
+ public Pagination getCustseaWithPage(String custtypename, int pageNo, int pageSize) {
+ return custseaDao.getCustseaWithPage(custtypename,pageNo,pageSize);
+ }
+
+ @Override
+ public TSeaCusttype getCustseaById(Integer custtypeid) {
+ return custseaDao.getCustseaById(custtypeid);
+ }
+
+ @Override
+ public boolean updateCustsea(TSeaCusttype tSeaCusttype) {
+ return custseaDao.updateCustsea(tSeaCusttype);
+ }
+
+ @Override
+ public boolean saveCustsea(TSeaCusttype tSeaCusttype) {
+ return custseaDao.saveCustsea(tSeaCusttype);
+ }
+
+ @Override
+ public boolean exist(Integer custtypeid) {
+ return custseaDao.exist(custtypeid);
+ }
+
+ @Override
+ public List<TNcDevice> getAllCanAssign(Integer ruleid,String devname,String devtype) {
+ return custseaDao.getAllCanAssign(ruleid,devname,devtype);
+ }
+
+ @Override
+ public List<TNcDevice> getAllDevByCusttype(Integer ruleid) {
+ return custseaDao.getAllDevByCusttype(ruleid);
+ }
+
+ @Override
+ public void assignDevRule(String ids, String ruleid) {
+ if(custseaDao.deleteDevRuleid(Integer.parseInt(ruleid))){
+ if(!StringUtil.isEmpty(ids)){
+
+ String[] strs=ids.split(",");
+ for(String id:strs){
+ if (!StringUtil.isEmpty(id)) {
+ TDevCusttype custdev=new TDevCusttype();
+ custdev.setRuleid(Integer.parseInt(ruleid));
+ custdev.setDeviceid(Integer.parseInt(id));
+ custseaDao.addDevRuleid(custdev);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/impl/SeasonServiceImpl.java b/src/main/java/com/supwisdom/dlpay/atte/service/impl/SeasonServiceImpl.java
new file mode 100644
index 0000000..0eef3c8
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/SeasonServiceImpl.java
@@ -0,0 +1,91 @@
+package com.supwisdom.dlpay.atte.service.impl;
+
+import com.supwisdom.dlpay.atte.dao.SeasonDao;
+import com.supwisdom.dlpay.atte.domain.TSeason;
+import com.supwisdom.dlpay.atte.service.SeasonService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.system.page.Pagination;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class SeasonServiceImpl implements SeasonService {
+ @Autowired
+ SeasonDao seasonDao;
+
+ @Override
+ public Pagination getSeasonWithPage(String season,String deptcode ,int pageNo, int pageSize) {
+ return seasonDao.getSeasonWithPage(season,deptcode,pageNo,pageSize);
+ }
+
+ @Override
+ public TSeason getSeasonById(Integer id) {
+
+ return seasonDao.getSeasonById(id);
+ }
+
+ @Override
+ public TSeason findBySeason(String season) {
+ return seasonDao.findBySeason(season);
+ }
+
+ @Override
+ public boolean saveSeason(TSeason season) {
+ return seasonDao.saveSeason(season);
+ }
+
+ @Override
+ public int getMaxSeasonId() {
+
+ return seasonDao.getMaxSeasonId();
+ }
+
+ @Override
+ public TSeason findSeasonByIdAndName(Integer id, String season) {
+ return seasonDao.getSeasonByIdAndName(id,season);
+ }
+
+ @Override
+ public boolean updateSeason(TSeason season) {
+ return seasonDao.updateSeason(season);
+ }
+
+ @Override
+ public boolean deleteSeason(int id) {
+ return seasonDao.deleteSeason(id);
+ }
+
+ @Override
+ public List<TSeason> findAllSeason() {
+ return seasonDao.findAllSeason();
+ }
+
+ @Override
+ public boolean stoporopen(Integer id) {
+ TSeason season=seasonDao.getSeasonById(id);
+ if(season==null){
+ return false;
+ }
+ season.setUpdatetime(DateUtil.getNow());
+ if(season.getStatus()==1){
+ season.setStatus(2); //停用
+ }else{
+ TSeason open=seasonDao.getOpenRule(season.getCusttypeid()+"",season.getDeptcode());
+ if(open!=null){
+ open.setStatus(2);
+ open.setUpdatetime(DateUtil.getNow());
+ seasonDao.updateSeason(open);
+ }
+ season.setStatus(1); //启用
+ }
+ seasonDao.updateSeason(season);
+ return true;
+ }
+
+ @Override
+ public TSeason getOpenRule(String custtypeid, String deptcode) {
+ return seasonDao.getOpenRule(custtypeid,deptcode);
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/task/CreateAtteDtlTask.java b/src/main/java/com/supwisdom/dlpay/atte/task/CreateAtteDtlTask.java
new file mode 100644
index 0000000..626b098
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/atte/task/CreateAtteDtlTask.java
@@ -0,0 +1,53 @@
+package com.supwisdom.dlpay.atte.task;
+
+import com.supwisdom.dlpay.atte.service.AtteClassService;
+import com.supwisdom.dlpay.framework.util.DateUtil;
+import com.supwisdom.dlpay.task.SyncCustomerTask;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+@Configuration //1.主要用于标记配置类,兼备Component的效果。
+@EnableScheduling // 2.开启定时任务
+public class CreateAtteDtlTask implements ApplicationRunner {
+ protected static Logger logger = LoggerFactory.getLogger(CreateAtteDtlTask.class);
+ @Autowired
+ AtteClassService atteClassService;
+
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+
+ }
+
+ @Scheduled(cron = "${atte.create.dtl}")//每天一点生成流水
+ public void createAtteDtl(){
+
+ String attedate= null;
+ try {
+ String now = DateUtil.getNow();
+ logger.info("时间:" + now + "--生成考勤名单");
+ attedate = DateUtil.getNow("yyyyMMdd");
+ atteClassService.createAtteDtl(attedate,null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ @Scheduled(cron = "${atte.refresh.dtl}")//每十分钟刷新一次考勤状态
+ public void refreshAtteDtl(){
+ try {
+ String now = DateUtil.getNow();
+ logger.info("时间:" + now + "--刷新考勤状态");
+ String attedate = DateUtil.getNow("yyyyMMdd");
+ atteClassService.handleDtl(null,attedate);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/ncmgr/bean/NcTimeBean.java b/src/main/java/com/supwisdom/dlpay/ncmgr/bean/NcTimeBean.java
index cc51b13..786c5d2 100644
--- a/src/main/java/com/supwisdom/dlpay/ncmgr/bean/NcTimeBean.java
+++ b/src/main/java/com/supwisdom/dlpay/ncmgr/bean/NcTimeBean.java
@@ -5,6 +5,7 @@
private String timename;
private String btime;
private String etime;
+ private Integer timetype;
public String getTimename() {
return timename;
}
@@ -29,5 +30,13 @@
public void setEtime(String etime) {
this.etime = etime;
}
+
+ public Integer getTimetype() {
+ return timetype;
+ }
+
+ public void setTimetype(Integer timetype) {
+ this.timetype = timetype;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/ncmgr/controller/NcMgrController.java b/src/main/java/com/supwisdom/dlpay/ncmgr/controller/NcMgrController.java
index 6b014f8..7b64d26 100644
--- a/src/main/java/com/supwisdom/dlpay/ncmgr/controller/NcMgrController.java
+++ b/src/main/java/com/supwisdom/dlpay/ncmgr/controller/NcMgrController.java
@@ -567,6 +567,7 @@
ts.setTimename(postData.getTimename());
ts.setBtime(postData.getBtime());
ts.setEtime(postData.getEtime());
+ ts.setTimetype(postData.getTimetype());
ts.setOperflag("A");
ts.setSyncflag("");
ts.setUpdtime(DateUtil.getNow());
@@ -611,6 +612,7 @@
time.setTimename(bean.getTimename());
time.setBtime(bean.getBtime());
time.setEtime(bean.getEtime());
+ time.setTimetype(bean.getTimetype());
time.setOperflag("A");//操作标记 A:添加 D:删除
time.setSyncflag("");
time.setUpdtime(DateUtil.getNow());
diff --git a/src/main/java/com/supwisdom/dlpay/ncmgr/domain/TNcTime.java b/src/main/java/com/supwisdom/dlpay/ncmgr/domain/TNcTime.java
index 12bb210..4e2e2aa 100644
--- a/src/main/java/com/supwisdom/dlpay/ncmgr/domain/TNcTime.java
+++ b/src/main/java/com/supwisdom/dlpay/ncmgr/domain/TNcTime.java
@@ -22,6 +22,7 @@
private String syncflag;
private String synctime;
private String updtime;
+ private Integer timetype;
// Constructors
@@ -121,4 +122,12 @@
this.updtime = updtime;
}
+ @Column(name = "timetype")
+ public Integer getTimetype() {
+ return timetype;
+ }
+
+ public void setTimetype(Integer timetype) {
+ this.timetype = timetype;
+ }
}
\ No newline at end of file
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 16d3b2b..038d33c 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -45,6 +45,8 @@
sync.cardStatus.cron=0 0/10 * * * ?
apiLogin.refresh.cron=0 0/20 * * * ?
+atte.create.dtl=0 0 1 * * ?
+atte.refresh.dtl=0 0/10 * * * ?
spring.redis.database=2
diff --git a/src/main/resources/templates/atte/app/appindex.html b/src/main/resources/templates/atte/app/appindex.html
new file mode 100644
index 0000000..750467b
--- /dev/null
+++ b/src/main/resources/templates/atte/app/appindex.html
@@ -0,0 +1,189 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
+
+<head>
+ <title>首页</title>
+ <!--<meta name="_csrf_header" th:content="${_csrf.headerName}" />
+ <meta name="_csrf_token" th:content="${_csrf.parameterName}" th:value="${_csrf.token}" />-->
+ <meta charset="utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" href="/static/libs/layui/css/layui.css" th:href="@{/static/libs/layui/css/layui.css}"/>
+
+ <link rel="stylesheet" href="/static/res/assets/plugins/element-ui/theme-default/index.css" th:href="@{/static/res/assets/plugins/element-ui/theme-default/index.css}"/>
+
+ <!--<script type="text/javascript" th:src="@{/static/libs/jquery/jquery-3.2.1.min.js}"></script>-->
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/jquery/jquery.min.js}"></script>
+ <!--<script type="text/javascript" th:src="@{/static/libs/layui/layui.js}"></script>-->
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/jquery/jquery.form.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/layer/layer.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/js/vue.min.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/element-ui/index.js}"></script>
+
+
+</head>
+
+<body>
+
+ <div id="app1">
+ <div class="block" style="background:#ffffff";>
+ <br>
+ <span class="demonstration" style="text-align: center;display:block; font-size: 20px;color: #9932CC">选择请假日期</span><br><br>
+ <!--动态将图片轮播图的容器高度设置成与图片一致-->
+ <el-form ref="dateDiaForm" style="text-align: center;display:block;" :model="dateDiaForm" label-width="36%">
+ <el-form-item label="开始日期:" prop="startdate">
+ <el-col :span="18">
+ <el-date-picker
+ v-model="dateDiaForm.startdate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="结束日期:" prop="enddate">
+ <el-col :span="18">
+ <el-date-picker
+ v-model="dateDiaForm.enddate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </el-col>
+ </el-form-item>
+ </el-form>
+ <el-button type="success" @click="openDoor" style=" display:block;margin:0 auto;width:100px;height:100px;border-radius:50px;border:solid rgb(100,100,100) 0px; font-size: 20px" >申请</el-button>
+ </div>
+
+ </div>
+
+</body>
+
+<script>
+ var app1_vue = new Vue({
+ el:'#app1',
+ data:{
+ devNameList: [],
+ devIdList:[],
+ selectDevName:'',
+ selectDevId:'',
+ // 图片父容器高度
+ bannerHeight :1000,
+ // 浏览器宽度
+ screenWidth :0,
+ userId:'',
+ dateDiaForm:{
+ startdate:'',
+ enddate:''
+ }
+ },
+
+ methods:{
+ indexChange: function (pre, next) {
+ var _self = this;
+ var devIdListTmp = _self.devIdList;
+ _self.selectDevId=devIdListTmp[pre];
+ // console.log(_self.selectDevId)
+
+ },
+ openDoor:function () {
+ var devId = app1_vue.selectDevId;
+ app_openDoor(devId);
+ },
+ setSize:function () {
+ // 通过浏览器宽度(图片宽度)计算高度
+ this.bannerHeight = this.screenWidth;
+ },
+ },
+ created:function(){
+ var _self = this;
+ // 首次加载时,需要调用一次
+ _self.screenWidth = window.innerWidth;
+ _self.setSize();
+
+ var userId='[[${userId}]]';
+ _self.userId = userId;
+
+ // $.ajax({
+ // type: "get",
+ // dataType: "json",
+ // url: "[[@{/app/loadAppDevList?userId=}]]"+userId,
+ // success: function (ret) {
+ // var ut = ret.devList;
+ // if (ut == null){
+ // confirm("不具有开门权限");
+ // }
+ // var names = [];
+ // var ids = [];
+ // for (var i = 0; i < ut.length; i++) {
+ // names.push(ut[i].devname);
+ // ids.push(ut[i].deviceid);
+ // }
+ // _self.devNameList = names;
+ // _self.devIdList= ids;
+ //
+ // }
+ // })
+ }
+
+ })
+
+ function app_openDoor(devId) {
+ var userId = app1_vue.userId;
+ console.log(userId);
+ layer.confirm('你确定要开启此门吗?',{icon: 3,title: '请确认',offset: '30%'},function (index) {
+ $.ajax({
+ type: "get",
+ dataType: "json",
+ url:encodeURI("[[@{/app/openDoorById?devId=}]]"+devId+"&userId="+userId),
+ success:function (ret) {
+ if (ret.message == undefined){
+ layer.msg('用户认证已过期,请重新登录',{icon: 2,time:1000});
+ window.location = "[[@{/login}]]";
+ return;
+ }
+ if (ret.message != "") {
+ layer.msg(ret.message, {icon: 2, time: 2000});
+ } else {
+ layer.msg('开门成功', {icon: 1, time: 2000});
+ }
+ }
+ })
+ });
+
+ }
+
+ // 窗口大小发生改变时,调用一次
+ window.onresize = function(){
+ app1_vue.screenWidth = window.innerWidth;
+ app1_vue.setSize();
+ }
+
+
+
+
+</script>
+
+<style>
+
+ .el-carousel__item h3 {
+ color: #ff3366;
+ font-size: 14px;
+ opacity: 0.75;
+ line-height: 300px;
+ margin: 0;
+ /*background-color:#66cccc;
+ border: 0px solid #e5e5e5;
+ width: 50%;
+ left: 10%;
+ height: 100%;*/
+ }
+
+ .el-carousel__item:nth-child(2n) {
+ background-color: #ffffff;
+ }
+
+ .el-carousel__item:nth-child(2n+1) {
+ background-color: #ffffff;
+ }
+
+ .el-carousel__item .Carousel{
+ border-bottom: 1px solid #f1f4f8;
+ }
+</style>
\ No newline at end of file
diff --git a/src/main/resources/templates/atte/app/test.html b/src/main/resources/templates/atte/app/test.html
new file mode 100644
index 0000000..95d8a7c
--- /dev/null
+++ b/src/main/resources/templates/atte/app/test.html
@@ -0,0 +1,168 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
+
+<head>
+ <title>首页</title>
+ <!--<meta name="_csrf_header" th:content="${_csrf.headerName}" />
+ <meta name="_csrf_token" th:content="${_csrf.parameterName}" th:value="${_csrf.token}" />-->
+ <meta charset="utf-8"/>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <link rel="stylesheet" href="/static/libs/layui/css/layui.css" th:href="@{/static/libs/layui/css/layui.css}"/>
+
+ <link rel="stylesheet" href="/static/res/assets/plugins/element-ui/theme-default/index.css" th:href="@{/static/res/assets/plugins/element-ui/theme-default/index.css}"/>
+
+ <!--<script type="text/javascript" th:src="@{/static/libs/jquery/jquery-3.2.1.min.js}"></script>-->
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/jquery/jquery.min.js}"></script>
+ <!--<script type="text/javascript" th:src="@{/static/libs/layui/layui.js}"></script>-->
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/jquery/jquery.form.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/layer/layer.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/js/vue.min.js}"></script>
+ <script type="text/javascript" th:src="@{/static/res/assets/plugins/element-ui/index.js}"></script>
+
+
+</head>
+
+<body>
+
+ <div id="app1">
+ <div class="block" style="background:#ffffff;">
+ <br>
+ <span class="demonstration" style="text-align: center;display:block; font-size: 20px;color: #9932CC">选择要开门的设备</span><br><br>
+ <!--动态将图片轮播图的容器高度设置成与图片一致-->
+
+ <el-button type="success" @click="openDoor" style=" display:block;margin:0 auto;width:100px;height:100px;border-radius:50px;border:solid rgb(100,100,100) 0px; font-size: 20px" >开门</el-button>
+ </div>
+
+ </div>
+
+</body>
+
+<script>
+ var app1_vue = new Vue({
+ el:'#app1',
+ data:{
+ devNameList: [],
+ devIdList:[],
+ selectDevName:'',
+ selectDevId:'',
+ // 图片父容器高度
+ bannerHeight :1000,
+ // 浏览器宽度
+ screenWidth :0,
+ userId:''
+ },
+
+ methods:{
+ indexChange: function (pre, next) {
+ var _self = this;
+ var devIdListTmp = _self.devIdList;
+ _self.selectDevId=devIdListTmp[pre];
+ // console.log(_self.selectDevId)
+
+ },
+ openDoor:function () {
+ var devId = app_vue.selectDevId;
+ app_openDoor(devId);
+ },
+ setSize:function () {
+ // 通过浏览器宽度(图片宽度)计算高度
+ this.bannerHeight = this.screenWidth;
+ },
+ },
+ created:function(){
+ var _self = this;
+ // 首次加载时,需要调用一次
+ _self.screenWidth = window.innerWidth;
+ _self.setSize();
+
+ var userId='[[${userId}]]';
+ _self.userId = userId;
+
+ // $.ajax({
+ // type: "get",
+ // dataType: "json",
+ // url: "[[@{/app/loadAppDevList?userId=}]]"+userId,
+ // success: function (ret) {
+ // var ut = ret.devList;
+ // if (ut == null){
+ // confirm("不具有开门权限");
+ // }
+ // var names = [];
+ // var ids = [];
+ // for (var i = 0; i < ut.length; i++) {
+ // names.push(ut[i].devname);
+ // ids.push(ut[i].deviceid);
+ // }
+ // _self.devNameList = names;
+ // _self.devIdList= ids;
+ //
+ // }
+ // })
+ }
+
+ })
+
+ function app_openDoor(devId) {
+ var userId = app_vue.userId;
+ console.log(userId);
+ layer.confirm('你确定要开启此门吗?',{icon: 3,title: '请确认',offset: '30%'},function (index) {
+ $.ajax({
+ type: "get",
+ dataType: "json",
+ url:encodeURI("[[@{/app/openDoorById?devId=}]]"+devId+"&userId="+userId),
+ success:function (ret) {
+ if (ret.message == undefined){
+ layer.msg('用户认证已过期,请重新登录',{icon: 2,time:1000});
+ window.location = "[[@{/login}]]";
+ return;
+ }
+ if (ret.message != "") {
+ layer.msg(ret.message, {icon: 2, time: 2000});
+ } else {
+ layer.msg('开门成功', {icon: 1, time: 2000});
+ }
+ }
+ })
+ });
+
+ }
+
+ // 窗口大小发生改变时,调用一次
+ window.onresize = function(){
+ app_vue.screenWidth = window.innerWidth;
+ app_vue.setSize();
+ }
+
+
+
+
+</script>
+
+<style>
+
+ .el-carousel__item h3 {
+ color: #ff3366;
+ font-size: 14px;
+ opacity: 0.75;
+ line-height: 300px;
+ margin: 0;
+ /*background-color:#66cccc;
+ border: 0px solid #e5e5e5;
+ width: 50%;
+ left: 10%;
+ height: 100%;*/
+ }
+
+ .el-carousel__item:nth-child(2n) {
+ background-color: #ffffff;
+ }
+
+ .el-carousel__item:nth-child(2n+1) {
+ background-color: #ffffff;
+ }
+
+ .el-carousel__item .Carousel{
+ border-bottom: 1px solid #f1f4f8;
+ }
+</style>
\ No newline at end of file
diff --git a/src/main/resources/templates/atte/class/index.html b/src/main/resources/templates/atte/class/index.html
new file mode 100644
index 0000000..c27fc99
--- /dev/null
+++ b/src/main/resources/templates/atte/class/index.html
@@ -0,0 +1,938 @@
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">考勤排班</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">人员考勤</a>
+ <a><cite>考勤排班</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body" >
+ <div id="classapp">
+ <div id="classdiv" >
+ <el-form :inline="true" ref="classform" :model="classform" data-parsley-validate class="form-horizontal form-label-left">
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">班次名称:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="classform.classname"></el-input>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="col-md-3">
+ <div class="form-group">
+ <button type="button" class="btn btn-info" @click="query" id="custsea_qrybtn">查 询</button>
+ <button class="btn btn-primary" type="button" @click="addClass">添加班次</button>
+ </div>
+ </div>
+ </el-form>
+
+ <template>
+ <el-table
+ ref="singleTable"
+ :data="tableData"
+ highlight-current-row
+ @current-change="currRowChange"
+ stripe
+ border
+ max-height="2000"
+ style="width: 100%">
+ <el-table-column
+ prop="classid"
+ label="ID"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="classname"
+ label="班次名称"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="workorno"
+ label="班次类别"
+ :formatter="classtypefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="deptcode"
+ label="部门"
+ :formatter="deptfor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="timegrpid"
+ label="时间组"
+ :formatter="timefor">
+
+ </el-table-column>
+ <el-table-column
+ prop="startdate"
+ label="开始日期"
+ :formatter="startdatefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="enddate"
+ label="结束日期"
+ :formatter="enddatefor"
+ >
+ </el-table-column>
+
+ <el-table-column
+ label="操作"
+ >
+ <template scope="scope">
+ <button type="button" class="btn btn-info btn-xs" title="编辑" @click="editClass(scope.row.classid)">编辑</button>
+ <button type="button" class="btn btn-danger btn-xs" @click="delClass(scope.row.classid)" title="删除" >删除</button>
+ <button type="button" class="btn btn-danger btn-xs" @click="assignCust(scope.row.classid)" title="添加人员" >添加人员</button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="clearfix"></div>
+ <el-pagination
+ @size-change="handleSizeChange"
+ @current-change="currPageChange"
+ :current-page="currPage"
+ :page-sizes="[10, 20, 50, 100]"
+ :page-size="pageSize"
+ layout="prev, pager, next,sizes, jumper,total"
+ :total="totSize">
+ </el-pagination>
+ </template>
+
+ <!--添加修改班次-->
+ <el-dialog :title="classtitle" :visible.sync="dialogFormVisible" top="80px" size="tiny" :modal-append-to-body='false' @close="closeDialog('classDiaForm')">
+ <el-form ref="classDiaForm" class="el-form-item el-form-item--mini" :model="classDiaForm" size="mini" :rules="rules" label-width="36%">
+ <el-form-item label="班次名称:" prop="classname">
+ <el-col :span="18">
+ <el-input v-model="classDiaForm.classname" style="width: 187px;" maxlength="20">
+ </el-input>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="班次类别:" prop="workorno">
+ <el-col :span="18">
+ <el-select v-model="classDiaForm.workorno" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="workorno in typegrplist"
+ :key="workorno.value"
+ :label="workorno.label"
+ :value="workorno.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="部门:" prop="deptcode">
+ <el-col :span="18">
+ <el-select v-if=" oper.opertype == 'S' ||oper.opertype == 'P' " v-model="classDiaForm.deptcode" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="deptcode in deptlist"
+ :key="deptcode.value"
+ :label="deptcode.label"
+ :value="deptcode.value">
+ </el-option>
+ </el-select>
+ <el-input readonly v-if=" oper.opertype != 'S' && oper.opertype != 'P'" v-model="dept.deptname" style="width: 187px;" maxlength="20">
+ </el-input>
+
+ </el-col>
+ </el-form-item>
+ <el-form-item label="时间组:" prop="timegrpid">
+ <el-col :span="18">
+ <el-select v-model="classDiaForm.timegrpid" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="timegrpid in timelist"
+ :key="timegrpid.value"
+ :label="timegrpid.label"
+ :value="timegrpid.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="开始日期:" prop="startdate">
+ <el-col :span="18">
+ <el-date-picker
+ v-model="classDiaForm.startdate" type="date" :picker-options="pickerOptions0"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="结束日期:" prop="enddate">
+ <el-col :span="18">
+ <el-date-picker
+ v-model="classDiaForm.enddate" type="date" :picker-options="pickerOptions1"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </el-col>
+ </el-form-item>
+
+
+
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="resetForm('classDiaForm') ">取 消</el-button>
+ <el-button type="primary" @click="saveClass('classDiaForm')">确 定</el-button>
+ </div>
+ </el-dialog>
+ </div>
+
+
+
+
+ <!--人员选择-->
+ <div id="assign_custSelect" style="display: none">
+ <div>
+ <el-form :inline="true" ref="devform" :model="person_person" data-parsley-validate
+ class="form-horizontal form-label-left">
+ <div class="col-md-3" >
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">姓名:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="person_person.custname" ></el-input>
+ </div>
+ </div>
+ </div>
+ <!--<div class="col-md-3" >-->
+ <!--<div class="form-group">-->
+ <!--<label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">部门:</span>-->
+ <!--</label>-->
+ <!--<div class="col-md-8 col-sm-12 col-xs-12">-->
+ <!--<el-select v-model="person_person.deptcode"-->
+ <!--filterable-->
+ <!--clearable-->
+ <!--placeholder="请选择">-->
+ <!--<el-option-->
+ <!--v-for="deptcode in deptlist"-->
+ <!--:key="deptcode.value"-->
+ <!--:label="deptcode.label"-->
+ <!--:value="deptcode.value">-->
+ <!--</el-option>-->
+ <!--</el-select>-->
+ <!--</div>-->
+ <!--</div>-->
+ <!--</div>-->
+ <div class="col-md-3" >
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">人员类别:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-select v-model="person_person.custtypeid"
+ filterable
+ clearable
+ placeholder="请选择">
+ <el-option
+ v-for="custtypeid in custtypelist"
+ :key="custtypeid.value"
+ :label="custtypeid.label"
+ :value="custtypeid.value">
+ </el-option>
+ </el-select>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-3" >
+ <div class="form-group">
+ <button type="button" class="btn btn-info" @click="searchCust" id="cust_qrybtn">查 询</button>
+ </div>
+ </div>
+ </el-form>
+
+ </div>
+
+
+
+
+
+ <div id="assign_devSel">
+ <div class="layui-row layui-col-space15">
+ <div class="layui-col-md5" style="width: 45%">
+ <div class="layui-card">
+ <div class="layui-card-header" style="margin-bottom: 10px" v-if="person_lefttable">
+ 可分配人员({{person_lefttable.length}}人)
+ </div>
+ <div id="addDoorlist_pensonS-tb" class="layui-card-body">
+
+ <template>
+ <el-table
+ height="480"
+ ref="multipleTable"
+ :data="person_lefttable"
+ tooltip-effect="dark"
+ style="width: 100%;"
+ stripe
+ border
+ @selection-change="lefttableSelect">
+ <el-table-column
+ fixed
+ type="selection"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="cardno"
+ label="卡号"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="custname"
+ label="姓名"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="bankcardno"
+ label="银行卡号"
+ >
+ </el-table-column>
+ </el-table>
+ </template>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-col-md1" style="width: 10%">
+ <div style="width:5%;height:400px;display:inline-block;padding:0;margin-left: 5px; float:left">
+ <div style="position: absolute;top:55%;width:5%;padding:0;margin: 0;text-align: center;left: 28%">
+ <el-button class="el-icon-d-arrow-right" :disabled="per_addBtn_dis" @click="person_addBtn"></el-button>
+ </div>
+ <div style="position: absolute;top:80%;width:5%;padding:0;margin: 0;text-align: center;left: 28%">
+ <el-button class="el-icon-d-arrow-left" :disabled="per_delBtn_dis" @click="person_delBtn"></el-button>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-col-md5" style="width: 45%">
+ <div class="layui-card">
+
+ <div class="layui-card-header" style="margin-bottom: 10px" v-if="person_righttable">
+ 已分配人员({{person_righttable.length}}人)
+ </div>
+ <div class="layui-card-body">
+ <template>
+ <el-table
+ height="480"
+ ref="multipleTable"
+ :data="person_righttable"
+ tooltip-effect="dark"
+ style="width: 100%;"
+ stripe
+ border
+ @selection-change="rightTableSelect">
+ <el-table-column
+ fixed
+ type="selection"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="cardno"
+ label="卡号"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="custname"
+ label="姓名"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="bankcardno"
+ label="银行卡号"
+ >
+ </el-table-column>
+ </el-table>
+ </template>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-row layui-col-space15">
+ <div style="float:left;margin:0px 0 0 30%;"><el-button style="margin-top: 12px;" @click="prev_btn">返回</el-button></div>
+ <div style="float:left;margin:0px 0 0 10%;"><el-button style="margin-top: 12px;" @click="save_btn">保存</el-button></div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+</div>
+
+<script>
+ var class_vue = new Vue({
+ el: '#classapp',
+ data:{
+ oper:'',
+ readonly:true,
+ dept:'',
+ tableData: [],
+ currPage: 1,
+ pageSize:10,
+ totSize:0,
+ sel_classid:'',
+ currentRow: null,
+ classform:{
+ classname:'',
+ },
+ person_person:{
+ custname:'',
+ custtypeid:'',
+ deptcode:''
+ },
+ devtypes:[],
+ typegrplist:[{value:1,label:'工作日'},{value:2,label:'节假日'},],
+ person_lefttable:[],
+ person_righttable:[],
+ custtypelist:[],
+ timelist:[],
+ deptlist:[],
+ leftTableSelection:[],
+ rightTableSelection:[],
+ per_addBtn_dis:true,
+ per_delBtn_dis:true,
+ dialogFormVisible: false,
+ dlgAllotDevVisible:false,
+ classtitle:'添加班次',
+ classDiaForm:{
+ classid:'',
+ classname:'',
+ startdate:'',
+ enddate:'',
+ status:'',
+ workorno:'',
+ timegrpid:'',
+ deptcode:''
+ },
+ pickerOptions0: {
+ disabledDate:function(time) {
+ return time.getTime() <Date.now();
+ }
+ },
+ pickerOptions1: {
+ disabledDate:function(time) {
+ if(class_vue.classDiaForm.startdate !=''){
+
+ return time.getTime() < class_vue.classDiaForm.startdate.getTime();
+ }else {
+ return time.getTime() < Date.now();
+ }
+ }
+ },
+ rules:{
+ classname:[
+ { required: true, message: '请输入班次名称', trigger: 'blur' },
+ { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
+ ],
+ workorno:[
+ { required: true, message: ' ',},
+ ],
+ timegrpid:[
+ { required: true, message: ' '},
+ ],
+ startdate:[
+ { required: true,message: ' ', },
+ ],
+ enddate:[
+ { required: true ,message: ' ',},
+ ],
+ deptcode:[
+ { required: true ,message: ' ',},
+ ],
+ },
+
+ },
+ methods: {
+ handleSizeChange:function(val) {
+ this.pageSize=val;
+ class_commonQuery(this,this.currPage,val);
+ },
+ currPageChange:function(val) {
+ this.currPage=val;
+ class_commonQuery(this,this.currPage,this.pageSize);
+ },
+ currRowChange:function(val) {
+ this.currentRow = val;
+ },
+ query:function () {
+ this.pagesize=10;
+ this.currPage=1;
+ class_commonQuery(this,this.currPage,this.pageSize);
+ },
+ resetForm:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ closeDialog:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ saveClass:function (formName) {
+ var _that=this;
+ var vali = false;
+ this.$refs[formName].validate(
+ function(valid){
+ if (valid){
+ vali = true;
+ }else{
+ vali=false;
+ }
+ });
+ if (vali==true){
+ class_saveData(_that,formName);
+ }
+ },
+ editClass:function (id) {
+ class_getFillData(this,id);
+ this.dialogFormVisible = true;
+ this.classtitle="修改班次"
+ },
+ classtypefor:function (row) {
+
+ return classtype_grpname(row.workorno);
+ },
+ deptfor:function (row) {
+
+ return dept_grpname(row.deptcode);
+ },
+ timefor:function(row){
+ return timegrp_grpname(row.timegrpid);
+ },
+
+ startdatefor:function(row){
+ if(row.startdate != null) {
+ return dateformatter(row.startdate);
+ }
+ },
+ enddatefor:function(row){
+ if(row.enddate != null) {
+ return dateformatter(row.enddate);
+ }
+ },
+
+ assignCust:function(id){
+ this.sel_classid=id;
+ $("#classdiv").hide();
+ $("#assign_custSelect").show();
+ $("#cust_qrybtn").click();
+ },
+ searchCust:function(){
+ var that=this;
+ addAllCustList(that);
+ },
+ lefttableSelect:function(val) {
+ //console.log(val);
+ this.leftTableSelection = val;
+ this.per_addBtn_dis=this.leftTableSelection<=0;
+ },
+ rightTableSelect:function(val) {
+ this.rightTableSelection = val;
+ this.per_delBtn_dis=this.rightTableSelection<=0;
+ },
+ person_addBtn:function(){
+ var _self=this;
+ var left=_self.leftTableSelection;
+ var right=[];
+ right=left.splice(0,left.length);
+ var dev={};
+ for(var i=0;i<right.length;i++){
+ if($.inArray(right[i],_self.person_righttable)==-1) {
+ _self.person_righttable.push(right[i]);
+ }
+ }
+ var leftData=this.person_lefttable;
+ for(var i=0;i<right.length;i++){
+ var s = $.inArray(right[i],leftData );
+ if (s != -1) {
+ leftData.splice(s, 1);
+ }
+ }
+ this.per_addBtn_dis=true;
+ },
+ person_delBtn:function(){
+ var right=this.rightTableSelection;
+ var rightData=this.person_righttable;
+ for(var i=0;i<right.length;i++) {
+ var s = $.inArray(right[i], rightData);//判断是否在rightData中存在这个值,存在返回下标,不存在返回-1
+ if (s != -1) {
+ rightData.splice(s, 1);
+ }
+ }
+ for(var i=0;i<right.length;i++) {
+ this.person_lefttable.push(right[i]);
+ }
+ this.per_delBtn_dis = true;
+ },
+ save_btn: function () {
+ var that=this;
+ save_cust_class(that);
+ },
+ prev_btn:function (){
+ $("#classdiv").show();
+ $("#assign_custSelect").hide();
+ this.person_lefttable=[];
+ this.person_righttable=[];
+ },
+ addClass:function(){
+ class_getFillData(this,"-1");
+ this.dialogFormVisible = true;
+ this.classtitle="添加班次";
+ // var id=7;
+ // var cdate='20200404';
+ // $.ajax({
+ // type:"get",
+ // dataType:"json",
+ // url:"[[@{/atte/adddtlbyhand?custtypeid=}]]"+id+"&attedate="+cdate,
+ // success:function(ret){
+ // alert('ok');
+ // }
+ // })
+
+ },
+ delClass:function(id){
+ class_deletedata(id);
+ }
+ },
+ created:function(){
+ var _self=this;
+
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:"[[@{/atte/class/list?classname=}]]",
+ success:function(ret){
+ //console.log(ret);
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ _self.oper=ret.operator;
+ var times=ret.timelist;
+ var timelist=[];
+ for (var i = 0; i < times.length; i++) {
+ timelist.push({
+ value: times[i].timegrpid,
+ label: times[i].timegrpname
+ });
+ }
+ _self.timelist=timelist;
+ var depts=ret.deptlist;
+ var deptlist=[];
+ for (var i = 0; i < depts.length; i++) {
+ deptlist.push({
+ value: depts[i].deptcode,
+ label: depts[i].deptname
+ });
+ }
+ _self.deptlist=deptlist;
+ var custtypes=ret.custtypelist;
+ var custtypelist=[];
+ for (var i = 0; i < custtypes.length; i++) {
+ custtypelist.push({
+ value: custtypes[i].custtypeid,
+ label: custtypes[i].custtypename
+ });
+ }
+ _self.custtypelist=custtypelist;
+ if(ret.dept!=null){
+ _self.dept=ret.dept;
+ }
+ }
+ })
+ }
+
+ })
+ function save_cust_class(that){
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var classid=that.sel_classid;
+ var idlist=new Array();
+ var right=that.person_righttable;
+ // if(right.length==0){
+ // layer.msg("请选择人员!",{icon:2,time:1000});
+ // return '';
+ // }
+ for(var i=0;i<right.length;i++){
+ idlist.push(right[i].custid);
+ }
+
+ $.ajax({
+ type: "POST",
+ url:"[[@{atte/addCustClass?classid=}]]"+classid+"&idlist="+idlist,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success: function (data) {
+
+ if (data.errStr == undefined) {
+ layer.msg('用户认证已过期,请重新登录', {icon: 2, time: 1000});
+ window.location = "login";
+ return;
+ }
+ if(data.errStr != ''){
+ layer.msg(data.errStr, {icon: 2, time: 1000});
+ return ;
+ }
+ if (data.errStr == ''){
+ layer.msg('添加班次人员成功!', {icon: 1, time: 1000});
+ $("#cust_qrybtn").click();
+ return ;
+ }
+ }
+ });
+ }
+ function addAllCustList(that){
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var custname=that.person_person.custname;
+ var deptcode=that.person_person.deptcode;
+ var custtypeid=that.person_person.custtypeid;
+ var classid=that.sel_classid;
+ that.person_lefttable=[];
+ var url="[[@{/atte/getCustomerList?}]]"+"perName="+custname+"&custtypeid="+custtypeid
+ +"&deptcode="+deptcode+"&classid="+classid ;
+ $.ajax({
+ type: "POST",
+ url: url,
+ dataType: "json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ contentType: "application/json",
+ data: "",
+ success: function (data) {
+ if(data.countIndex == undefined){
+ layer.msg('用户认证已过期,请重新登录',{icon:2,time:1000});
+ window.location="login";
+ return;
+ }
+
+ if(data.countIndex){
+ layer.msg('人员数量过大,请输入查询条件!',{icon:2,time:3000});
+ }else{
+ // addDoorlist_vue.person_lefttable=data.pNotInResult;
+ var allcust=data.allcust;
+ var hasclasscust=data.hasclasscust;
+ that.person_righttable=hasclasscust;
+ that.person_lefttable=allcust;
+ }
+ }
+ });
+
+ }
+
+ function timeformatter(time){
+
+ return time.substr(0,4)+'-'+time.substr(4,2)+'-'+time.substr(6,2)+' '
+ +time.substr(8,2)+':'+time.substr(10,2)+':'+time.substr(12,2);
+
+ }
+ function dateformatter(time){
+ return time.substr(0,4)+'-'+time.substr(4,2)+'-'+time.substr(6,2);
+ }
+
+
+ function classtype_grpname(workorno){
+ var list = class_vue.typegrplist;
+
+ if(workorno!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == workorno){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function dept_grpname(deptcode){
+ var list = class_vue.deptlist;
+
+ if(deptcode!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == deptcode){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function timegrp_grpname(timegrpid){
+ var list = class_vue.timelist;
+
+ if(timegrpid!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == timegrpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function devtype_grpname(devtype){
+ var list=class_vue.devtypes;
+ if(devtype!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == devtype){
+ return list[i].label;
+ }
+ }
+ }
+ }
+
+ function class_commonQuery(_self,pageno,pagesize) {
+ var classname=_self.classform.classname;
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:"[[@{/atte/class/list?classname=}]]"+classname+"&pageNo="+pageno+"&pageSize="+pagesize,
+ success:function(ret){
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ if(_self.totSize == 0 ){
+ layer.msg("暂无数据", {icon: 2, time: 1000});
+ }
+ if (ret.errStr != ''){
+ lay.msg(ret.errStr,{icon: 2, time: 1000});
+ }
+ }
+ })
+ }
+
+ function class_getFillData(_self,classid){
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:encodeURI("[[@{/atte/loadClassForUpdate?classid=}]]"+classid),
+ success:function(ret){
+ if (ret.atteclass!=null ){
+ _self.classDiaForm = ret.atteclass;
+ var start=ret.atteclass.startdate;
+ var end=ret.atteclass.enddate;
+ _self.classDiaForm.startdate=new Date(start.substr(0, 4), start.substr(4, 2)-1, start.substr(6, 2));
+ _self.classDiaForm.enddate=new Date(end.substr(0, 4), end.substr(4, 2)-1, end.substr(6, 2));
+ }
+ if(_self.oper.opertype!='S' &&_self.oper.opertype != 'P'){
+ _self.classDiaForm.deptcode=_self.oper.deptcode
+ }
+ }
+ })
+ }
+
+ function class_saveData(_that,formName) {
+ var sdate=_that.classDiaForm.startdate;
+ var edate=_that.classDiaForm.enddate;
+ var startdate=class_Formatdate(sdate);
+ var enddate=class_Formatdate(edate);
+ if(startdate>enddate){
+ layer.msg("结束时间不能小于开始时间!", {icon: 2, time: 1000});
+ return '';
+ }
+ var classname=_that.classDiaForm.classname;
+ var workorno=_that.classDiaForm.workorno;
+ var classid=_that.classDiaForm.classid;
+ var timegrpid=_that.classDiaForm.timegrpid;
+ var deptcode=_that.classDiaForm.deptcode;
+ var url;
+ var data='';
+ if(class_vue.classtitle=='添加班次'){
+ var url="[[@{/atte/addClass?classname=}]]"+classname+"&workorno="+workorno+"&startdate="+startdate+"&enddate="+enddate+"&timegrpid="+timegrpid+"&deptcode="+deptcode;
+ }else{
+ var url="[[@{/atte/updateClass?startdate=}]]"+startdate+"&enddate="+enddate+"&deptcode="+deptcode;
+ data=JSON.stringify(_that.classDiaForm);
+ }
+ var token=$("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type: "POST",
+ url: url,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data:data,
+ success: function (data) {
+ if (data.errStr == undefined) {
+ layer.msg('用户认证已过期,请重新登录', {icon: 2, time: 1000});
+ window.location = "login";
+ return;
+ }
+ if (data.errStr != "") {
+ layer.msg(data.errStr, {icon: 2, time: 1000});
+ } else {
+ layer.msg('保存信息成功!', {icon: 1, time: 1000});
+ class_refreshThisTable();
+ _that.$refs[formName].resetFields();
+ _that.dialogFormVisible = false;
+ }
+
+ }
+ });
+
+
+ }
+ function class_Formatdate(date){
+ if(date==null||date==''){
+ return '';
+ }
+ var d=new Date(date);
+ var month=d.getMonth() + 1+'';
+ var date=d.getDate()+'';
+ if(month.length==1){
+ month='0'+month;
+ }
+ if(date.length==1){
+ date='0'+date;
+ }
+ var formated=d.getFullYear() + '' + month + '' +date;
+
+ return formated;
+ }
+
+ function class_refreshThisTable(){
+ class_commonQuery(class_vue,class_vue.currPage,class_vue.pageSize);
+ }
+
+ function class_deletedata(id){
+ var token=$("meta[name='_csrf_token']").attr("value");
+ layer.confirm('你确定要删除选择的班次吗?', {icon: 3, title:'请确认',offset:'30%'}, function(index){
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/deleteClass?classid=}]]"+id,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success:function(ret){
+ //console.log(ret);
+ if(ret.message == undefined){
+ layer.msg('用户认证已过期,请重新登录', {icon:2,time:1000});
+ window.location="login";
+ return;
+ }
+ if (ret.message != "") {
+ layer.msg(ret.message, {icon:2,time:1000});
+ }else{
+ if(ret.flag==0) {
+ layer.msg('删除成功', {icon: 1, time: 1000});
+ class_refreshThisTable();
+ }else {
+ layer.msg(ret.message, {icon:2,time:3000});
+ }
+ }
+ }
+ })
+ });
+ }
+
+
+
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/atte/dtl/index.html b/src/main/resources/templates/atte/dtl/index.html
new file mode 100644
index 0000000..7d2d7f0
--- /dev/null
+++ b/src/main/resources/templates/atte/dtl/index.html
@@ -0,0 +1,491 @@
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">考勤流水</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">人员考勤</a>
+ <a><cite>考勤流水</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body" >
+ <div id="attedtlapp">
+ <el-form :inline="true" ref="attedtlform" :model="attedtlform" data-parsley-validate class="form-horizontal form-label-left">
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">开始日期:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-date-picker style="width: 100%"
+ v-model="attedtlform.startdate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">结束日期:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-date-picker style="width: 100%"
+ v-model="attedtlform.enddate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">卡号:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="attedtlform.cardno" placeholder="输入%模糊查询"></el-input>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">姓名:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="attedtlform.custname" ></el-input>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">设备名称:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="attedtlform.devname" ></el-input>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">人员类别:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-select v-model="attedtlform.custtypeid" style="width:100%;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="custtypeid in typegrplist"
+ :key="custtypeid.value"
+ :label="custtypeid.label"
+ :value="custtypeid.value">
+ </el-option>
+ </el-select>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;"></span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <button type="button" class="btn btn-info" @click="query" id="attedtl_qrybtn">查 询</button>
+ </div>
+ </div>
+ </div>
+ </el-form>
+
+ <template>
+ <el-table
+ ref="singleTable"
+ :data="tableData"
+ highlight-current-row
+ @current-change="currRowChange"
+ stripe
+ border
+ max-height="2000"
+ style="width: 100%">
+
+ <el-table-column
+ prop="refno"
+ label="流水号"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="custname"
+ label="姓名"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="cardno"
+ label="卡号"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="attedate"
+ label="日期"
+ :formatter="attedatefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="attetime"
+ label="打卡时间"
+ :formatter="attetimefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="devname"
+ label="设备名称"
+ >
+ </el-table-column>
+
+
+ <el-table-column
+ prop="custtypeid"
+ label="人员类别"
+ :formatter="custtypefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="deptcode"
+ label="部门"
+ :formatter="deptfor"
+ >
+ </el-table-column>
+
+
+ </el-table>
+ <div class="clearfix"></div>
+ <el-pagination
+ @size-change="handleSizeChange"
+ @current-change="currPageChange"
+ :current-page="currPage"
+ :page-sizes="[10, 20, 50, 100]"
+ :page-size="pageSize"
+ layout="prev, pager, next,sizes, jumper,total"
+ :total="totSize">
+ </el-pagination>
+ </template>
+
+
+
+ </div>
+
+
+ </div>
+</div>
+
+<script>
+ var attedtl_vue = new Vue({
+ el: '#attedtlapp',
+ data:{
+ tableData: [],
+ deptlist:[],
+ currPage: 1,
+ pageSize:10,
+ totSize:0,
+ currentRow: null,
+ stategrplist:[{value:0,label:'未打卡'},{value:1,label:'正常'},{value:2,label:'迟到'},{value:3,label:'请假'},{value:4,label:'旷工'},],
+ attedtlform:{
+ startdate:Date.now(),
+ enddate:Date.now(),
+ cardno:'',
+ custname:'',
+ custtypeid:'',
+ deptcode:'',
+ devname:''
+ },
+ timegrplist:[],
+ typegrplist:[],
+ dialogFormVisible: false,
+ dlgAllotDevVisible:false,
+ updatetitle:'修改考勤状态',
+ dtlDiaForm:{
+ atteno:'',
+ custname:'',
+ state:'',
+ remark:''
+ },
+ rules: {
+ season: [
+ { required: true, message: '请输入时令名', trigger: 'blur' },
+ { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
+ ],
+
+
+ },
+
+ },
+ methods: {
+ handleSizeChange:function(val) {
+ this.pageSize=val;
+ attedtl_commonQuery(this,this.currPage,val);
+ },
+ currPageChange:function(val) {
+ this.currPage=val;
+ attedtl_commonQuery(this,this.currPage,this.pageSize);
+ },
+ currRowChange:function(val) {
+ this.currentRow = val;
+ },
+ attedatefor:function(row){
+ if(row.attedate!= null){
+ return dateformatter(row.attedate);
+ }
+ },
+ attetimefor:function(row){
+ if(row.attetime!= null){
+ return timeformatter(row.attetime);
+ }
+ },
+ endtimefor:function(row){
+ if(row.endtime!= null){
+ return timeformatter(row.endtime);
+ }
+ },
+ statefor:function(row){
+ if(row.state!= null){
+ return state_grpname(row.state);
+ }
+ },
+ timenamefor:function(row){
+ if(row.timeid!=null){
+ return timeid_grpname(row.timeid);
+ }
+ },
+ query:function () {
+ this.pagesize=10;
+ this.currPage=1;
+ attedtl_commonQuery(this,this.currPage,this.pageSize);
+ },
+ resetForm:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ closeDialog:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ saveState:function (formName) {
+
+ var _that=this;
+ attedtl_saveData(_that,formName);
+
+ },
+ editDtl:function (row) {
+ dtl_getFillData(this,row);
+ this.dialogFormVisible = true;
+ this.updatetitle="修改流水状态"
+ },
+ custtypefor:function (row) {
+ return custtype_grpname(row.custtypeid);
+ },
+ deptfor:function (row) {
+ return dept_grpname(row.deptcode);
+ },
+ refreshdtl:function (){
+ var _that=this;
+ refreshAtteDtl(_that);
+ }
+
+ },
+ created:function(){
+ var _self=this;
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var startdate=class_Formatdate(_self.attedtlform.startdate);
+ var enddate=class_Formatdate(_self.attedtlform.enddate);
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/dtl/list?startdate=}]]"+startdate+"&enddate="+enddate,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data:JSON.stringify(_self.attedtlform),
+ success:function(ret){
+ // //console.log(ret);
+ // _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ var custtypelist = [];
+ var types=ret.custtypelist;
+ for (var i = 0; i < types.length; i++) {
+ custtypelist.push({
+ value: types[i].custtypeid,
+ label: types[i].custtypename
+ });
+ }
+ _self.typegrplist=custtypelist;
+ var deptlist = [];
+ var depts=ret.deptlist;
+ for (var i = 0; i < depts.length; i++) {
+ deptlist.push({
+ value: depts[i].deptcode,
+ label: depts[i].deptname
+ });
+ }
+ _self.deptlist=deptlist;
+ }
+ })
+ }
+
+ })
+ function refreshAtteDtl(that){
+ var startdate=class_Formatdate(that.attedtlform.startdate);
+ var enddate=class_Formatdate(that.attedtlform.enddate);
+ if(startdate== '' || enddate=='') {
+ layer.msg("请选择日期", {icon: 2, time: 1000});
+ return;
+ }
+ if(startdate>enddate){
+ layer.msg("开始日期不能大于结束日期!", {icon: 2, time: 1000});
+ return;
+ }
+ layer.confirm('你确定要刷新所选日期的流水吗?', {icon: 3, title:'请确认',offset:'30%'},function (){
+
+ })
+ }
+ function dateformatter(time){
+ return time.substr(0,4)+'-'+time.substr(4,2)+'-'+time.substr(6,2);
+ }
+ function timeformatter(time){
+ return time.substr(0,2)+':'+time.substr(2,2)+':'+time.substr(4,2);
+ }
+
+ function custtype_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = attedtl_vue.typegrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function dept_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = attedtl_vue.deptlist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function state_grpname(grpid){
+ if(grpid!=null){
+ var list = attedtl_vue.stategrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+
+ function timeid_grpname(grpid){
+ if(grpid!=null){
+ var list = attedtl_vue.timegrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function class_Formatdate(date){
+ if(date==null||date==''){
+ return '';
+ }
+ var d=new Date(date);
+ var month=d.getMonth() + 1+'';
+ var date=d.getDate()+'';
+ if(month.length==1){
+ month='0'+month;
+ }
+ if(date.length==1){
+ date='0'+date;
+ }
+ var formated=d.getFullYear() + '' + month + '' +date;
+
+ return formated;
+ }
+ function attedtl_commonQuery(_self,pageno,pagesize) {
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var startdate=class_Formatdate(_self.attedtlform.startdate);
+ var enddate=class_Formatdate(_self.attedtlform.enddate);
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/dtl/list?startdate=}]]"+startdate+"&enddate="+enddate+"&pageNo="+pageno+"&pageSize="+pagesize,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data:JSON.stringify(_self.attedtlform),
+ success:function(ret){
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ if(_self.totSize == 0 ){
+ layer.msg("暂无数据", {icon: 2, time: 1000});
+ }
+
+ }
+ })
+ }
+
+ function dtl_getFillData(_self,row){
+ _self.dtlDiaForm.atteno=row.atteno;
+ _self.dtlDiaForm.custname=row.custname;
+ _self.dtlDiaForm.state=row.state;
+ _self.dtlDiaForm.remark=row.remark;
+ }
+
+ function attedtl_saveData(_that,formName) {
+ var atteno=_that.dtlDiaForm.atteno;
+ var state=_that.dtlDiaForm.state;
+ var remark=_that.dtlDiaForm.remark;
+ var token=$("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type: "POST",
+ url: '[[@{/atte/updateDtl?atteno=}]]'+atteno+"&state="+state+"&remark="+remark,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success: function (data) {
+ if (data.errStr == undefined) {
+ layer.msg('用户认证已过期,请重新登录', {icon: 2, time: 1000});
+ window.location = "login";
+ return;
+ }
+ if (data.errStr != "") {
+ layer.msg(data.errStr, {icon: 2, time: 1000});
+ } else {
+ layer.msg('保存信息成功!', {icon: 1, time: 1000});
+ _that.dialogFormVisible = false;
+ dtl_refreshThisTable();
+ _that.$refs[formName].resetFields();
+ }
+ }
+ })
+
+ }
+
+ function dtl_refreshThisTable(){
+ attedtl_commonQuery(attedtl_vue,attedtl_vue.currPage,attedtl_vue.pageSize);
+ };
+
+
+
+
+
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/atte/role/index.html b/src/main/resources/templates/atte/role/index.html
new file mode 100644
index 0000000..2728f59
--- /dev/null
+++ b/src/main/resources/templates/atte/role/index.html
@@ -0,0 +1,807 @@
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">考勤规则管理</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">人员考勤</a>
+ <a><cite>考勤规则管理</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body" >
+ <div id="seasonapp">
+ <div id="rulediv" >
+ <el-form :inline="true" ref="seasonform" :model="seasonform" data-parsley-validate class="form-horizontal form-label-left">
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">规则名称:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="seasonform.season"></el-input>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="col-md-3">
+ <div class="form-group">
+ <button type="button" class="btn btn-info" @click="query" id="season_qrybtn">查 询</button>
+ <button class="btn btn-primary" type="button" @click="addSeason">添加规则</button>
+ </div>
+ </div>
+ </el-form>
+
+ <template>
+ <el-table
+ ref="singleTable"
+ :data="tableData"
+ highlight-current-row
+ @current-change="currRowChange"
+ stripe
+ border
+ max-height="2000"
+ style="width: 100%">
+ <el-table-column
+ prop="id"
+ label="ID"
+ sortable
+ width="100">
+ </el-table-column>
+ <el-table-column
+ prop="season"
+ label="规则名称"
+ sortable
+ width="200">
+ </el-table-column>
+ <el-table-column
+ prop="weekid"
+ label="时间周"
+ width="150"
+ :formatter="weekfor">
+ </el-table-column>
+ <el-table-column
+ prop="deptcode"
+ label="部门"
+ width="200"
+ :formatter="deptfor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="custtypeid"
+ label="人员类别"
+ width="200"
+ :formatter="custtypefor"
+ >
+ </el-table-column>
+ <el-table-column
+ label="操作"
+ >
+ <template scope="scope">
+ <button type="button" class="btn btn-info btn-xs" v-if="scope.row.status=='2'" title="编辑规则" @click="editSeason(scope.row.id)">编辑</button>
+ <button type="button" class="btn btn-danger btn-xs" v-if="scope.row.status=='2'" title="删除规则" @click="delSeason(scope.row.id)">删除</button>
+ <button type="button" class="btn btn-success btn-xs" title="启用规则"
+ @click="openSeason(scope.row.id)" v-if="scope.row.status=='2' ">启用
+ </button>
+ <button type="button" class="btn btn-warning btn-xs" title="停用规则"
+ @click="stopSeason(scope.row.id)" v-if="scope.row.status=='1' ">停用
+ </button>
+ <button type="button" class="btn btn-danger btn-xs" @click="assignDev(scope.row.id)" title="分配设备" >分配设备</button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <div class="clearfix"></div>
+ <el-pagination
+ @size-change="handleSizeChange"
+ @current-change="currPageChange"
+ :current-page="currPage"
+ :page-sizes="[10, 20, 50, 100]"
+ :page-size="pageSize"
+ layout="prev, pager, next,sizes, jumper,total"
+ :total="totSize">
+ </el-pagination>
+ </template>
+
+ <!--添加修改时令-->
+ <el-dialog :title="seasontitle" :visible.sync="dialogFormVisible" top="80px" size="tiny" :modal-append-to-body='false' @close="closeDialog('seasonDiaForm')">
+ <el-form ref="seasonDiaForm" class="el-form-item el-form-item--mini" :model="seasonDiaForm" size="mini" :rules="rules" label-width="36%">
+ <el-form-item label="规则名称:" prop="season">
+ <el-col :span="18">
+ <el-input v-model="seasonDiaForm.season" style="width: 187px;" maxlength="20">
+ </el-input>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="时间周:" prop="weekid">
+ <el-col :span="18">
+ <el-select v-model="seasonDiaForm.weekid" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="weekid in weekgrplist"
+ :key="weekid.value"
+ :label="weekid.label"
+ :value="weekid.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="部门:" prop="deptcode">
+ <el-col :span="18">
+ <el-select v-if=" oper.opertype == 'S' ||oper.opertype == 'P' " v-model="seasonDiaForm.deptcode" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="deptcode in deptlist"
+ :key="deptcode.value"
+ :label="deptcode.label"
+ :value="deptcode.value">
+ </el-option>
+ </el-select>
+ <el-input readonly v-if=" oper.opertype != 'S' && oper.opertype != 'P'" v-model="dept.deptname" style="width: 187px;" maxlength="20">
+ </el-input>
+
+ </el-col>
+ </el-form-item>
+ <el-form-item label="人员类别:" prop="custtypeid">
+ <el-col :span="18">
+ <el-select v-model="seasonDiaForm.custtypeid" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="custtypeid in custtypelist"
+ :key="custtypeid.value"
+ :label="custtypeid.label"
+ :value="custtypeid.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
+
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="resetForm('seasonDiaForm') ">取 消</el-button>
+ <el-button type="primary" @click="saveSeason('seasonDiaForm')">确 定</el-button>
+ </div>
+ </el-dialog>
+ </div>
+
+ <!--设备选择-->
+ <div id="assign_devSelect" style="display: none">
+ <div>
+ <el-form :inline="true" ref="devform" :model="dev_device" data-parsley-validate
+ class="form-horizontal form-label-left">
+ <div class="col-md-3" >
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">设备名称:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="dev_device.devname" ></el-input>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-3" >
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">设备类型:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-select v-model="dev_device.devtype"
+ filterable
+ clearable
+ placeholder="请选择">
+ <el-option
+ v-for="devtype in devtypes"
+ :key="devtype.value"
+ :label="devtype.label"
+ :value="devtype.value">
+ </el-option>
+ </el-select>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-3" >
+ <div class="form-group">
+ <button type="button" class="btn btn-info" @click="searchDev" id="dev_qrybtn">查 询</button>
+ </div>
+ </div>
+ </el-form>
+
+ </div>
+
+
+
+
+
+ <div id="assign_devSel">
+ <div class="layui-row layui-col-space15">
+ <div class="layui-col-md5" style="width: 45%">
+ <div class="layui-card">
+ <div class="layui-card-header" style="margin-bottom: 10px" v-if="dev_lefttable">
+ 可分配设备({{dev_lefttable.length}}台)
+ </div>
+ <div id="addDoorlist_pensonS-tb" class="layui-card-body">
+
+ <template>
+ <el-table
+ height="480"
+ ref="multipleTable"
+ :data="dev_lefttable"
+ tooltip-effect="dark"
+ style="width: 100%;"
+ stripe
+ border
+ @selection-change="lefttableSelect">
+ <el-table-column
+ fixed
+ type="selection"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="deviceid"
+ label="编号"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="devname"
+ label="设备名称"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="devtype"
+ label="设备类型"
+ :formatter="devtypefor"
+ >
+ </el-table-column>
+ </el-table>
+ </template>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-col-md1" style="width: 10%">
+ <div style="width:5%;height:400px;display:inline-block;padding:0;margin-left: 5px; float:left">
+ <div style="position: absolute;top:55%;width:5%;padding:0;margin: 0;text-align: center;left: 28%">
+ <el-button class="el-icon-d-arrow-right" :disabled="per_addBtn_dis" @click="dev_addBtn"></el-button>
+ </div>
+ <div style="position: absolute;top:80%;width:5%;padding:0;margin: 0;text-align: center;left: 28%">
+ <el-button class="el-icon-d-arrow-left" :disabled="per_delBtn_dis" @click="dev_delBtn"></el-button>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-col-md5" style="width: 45%">
+ <div class="layui-card">
+
+ <div class="layui-card-header" style="margin-bottom: 10px" v-if="dev_righttable">
+ 已分配设备({{dev_righttable.length}}台)
+ </div>
+ <div class="layui-card-body">
+ <template>
+ <el-table
+ height="480"
+ ref="multipleTable"
+ :data="dev_righttable"
+ tooltip-effect="dark"
+ style="width: 100%;"
+ stripe
+ border
+ @selection-change="rightTableSelect">
+ <el-table-column
+ fixed
+ type="selection"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="deviceid"
+ label="编号"
+ >
+ </el-table-column>
+ <el-table-column
+ sortable
+ prop="devname"
+ label="设备名称"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="devtype"
+ label="设备类型"
+ :formatter="devtypefor"
+ >
+ </el-table-column>
+ </el-table>
+ </template>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="layui-row layui-col-space15">
+ <div style="float:left;margin:0px 0 0 30%;"><el-button style="margin-top: 12px;" @click="prev_btn">返回</el-button></div>
+ <div style="float:left;margin:0px 0 0 10%;"><el-button style="margin-top: 12px;" @click="save_dev">保存</el-button></div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
+
+<script>
+ var season_vue = new Vue({
+ el: '#seasonapp',
+ data:{
+ oper:'',
+ tableData: [],
+ currPage: 1,
+ pageSize:10,
+ totSize:0,
+ currentRow: null,
+ seasonform:{
+ season:'',
+ },
+ dept:'',
+ sel_ruleid:'',
+ weekgrplist:[],
+ custtypelist:[],
+ deptlist:[],
+ dev_device:{
+ devname:'',
+ devtype:''
+ },
+ dev_lefttable:[],
+ dev_righttable:[],
+ leftTableSelection:[],
+ rightTableSelection:[],
+ per_addBtn_dis:true,
+ per_delBtn_dis:true,
+ devtypes:[],
+ dialogFormVisible: false,
+ dlgAllotDevVisible:false,
+ seasontitle:'添加规则',
+ seasonDiaForm:{
+ id:'',
+ season:'',
+ weekid:'',
+ deptcode:'',
+ custtypeid:'',
+ status:''
+ },
+ rules: {
+ season: [
+ { required: true, message: '请输入时令名', trigger: 'blur' },
+ { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
+ ],
+ weekid:[
+ { required: true, message: ' ',},
+ ],
+ deptcode:[
+ { required: true, message: ' '},
+ ],
+ custtypeid:[
+ { required: true,message: ' ', },
+ ],
+
+ },
+ },
+ methods: {
+ handleSizeChange:function(val) {
+ this.pageSize=val;
+ season_commonQuery(this,this.seasonform.season,this.currPage,val);
+ },
+ currPageChange:function(val) {
+ this.currPage=val;
+ season_commonQuery(this,this.seasonform.season,this.currPage,this.pageSize);
+ },
+ currRowChange:function(val) {
+ this.currentRow = val;
+ },
+ delSeason:function (row) {
+ season_deletedata(row);
+ },
+ openSeason:function (row) {
+ stoporopen(row,1);
+ },
+ stopSeason:function (row) {
+ stoporopen(row,2);
+ },
+ query:function () {
+ this.pagesize=10;
+ this.currPage=1;
+ season_commonQuery(this,this.seasonform.season,this.currPage,this.pageSize);
+ },
+ addSeason:function (formName) {
+ season_getFillData(this,"-1");
+ this.dialogFormVisible = true;
+ this.seasontitle="添加规则";
+ },
+ resetForm:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ closeDialog:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ saveSeason:function (formName) {
+
+ var _that=this;
+ var vali = false;
+ this.$refs[formName].validate(
+ function(valid){
+ if (valid){
+ vali = true;
+ }else{
+ vali=false;
+ }
+ });
+ if (vali==true){
+ season_saveData(_that,_that.seasonDiaForm,formName);
+
+ }
+
+ },
+ editSeason:function (id) {
+ season_getFillData(this,id);
+ this.dialogFormVisible = true;
+ this.seasontitle="修改规则"
+ },
+ weekfor:function (row) {
+ return weektime_grpname(row.weekid);
+ },
+ deptfor:function (row) {
+ return dept_grpname(row.deptcode);
+ },
+ custtypefor:function (row) {
+ return custtype_grpname(row.custtypeid);
+ },
+ assignDev:function(id){
+ this.sel_ruleid=id;
+ $("#rulediv").hide();
+ $("#assign_devSelect").show();
+ $("#dev_qrybtn").click();
+ },
+ searchDev:function(devname,devtype){
+ var that=this;
+ addAllDevList(that);
+ },
+ lefttableSelect:function(val) {
+ //console.log(val);
+ this.leftTableSelection = val;
+ this.per_addBtn_dis=this.leftTableSelection<=0;
+ },
+ rightTableSelect:function(val) {
+ this.rightTableSelection = val;
+ this.per_delBtn_dis=this.rightTableSelection<=0;
+ },
+ devtypefor:function(row){
+ return devtype_grpname(row.devtype);
+ },
+ dev_addBtn:function(){
+ var _self=this;
+ var left=_self.leftTableSelection;
+ var right=[];
+ right=left.splice(0,left.length);
+ var dev={};
+
+ for(var i=0;i<right.length;i++){
+ if($.inArray(right[i],_self.dev_righttable)==-1) {
+ _self.dev_righttable.push(right[i]);
+ }
+ }
+ this.per_addBtn_dis=true;
+ },
+ dev_delBtn:function(){
+ var right=this.rightTableSelection;
+ var rightData=this.dev_righttable;
+ for(var i=0;i<right.length;i++) {
+ var s = $.inArray(right[i], rightData);//判断是否在rightData中存在这个值,存在返回下标,不存在返回-1
+ if (s != -1) {
+ rightData.splice(s, 1);
+ }
+ }
+ this.per_delBtn_dis = true;
+ },
+ save_dev: function () {
+ var that=this;
+ save_dev_rule(that);
+ },
+ prev_btn:function (){
+ $("#rulediv").show();
+ $("#assign_devSelect").hide();
+ this.dev_lefttable=[];
+ this.dev_righttable=[];
+ }
+
+ },
+ created:function(){
+ var _self=this;
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:"[[@{/atte/rule/list?season=}]]",
+ success:function(ret){
+ //console.log(ret);
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ _self.oper=ret.operator;
+ var weeklist = [];
+ var weeks=ret.weeklist;
+ for (var i = 0; i < weeks.length; i++) {
+ weeklist.push({
+ value: weeks[i].weekid,
+ label: weeks[i].weekname
+ });
+ }
+ _self.weekgrplist=weeklist;
+ var deptlist = [];
+ var depts=ret.deptlist;
+ for (var i = 0; i < depts.length; i++) {
+ deptlist.push({
+ value: depts[i].deptcode,
+ label: depts[i].deptname
+ });
+ }
+ _self.deptlist=deptlist;
+ var custtypelist = [];
+ var custtypes=ret.custtypelist;
+ for (var i = 0; i < custtypes.length; i++) {
+ custtypelist.push({
+ value: custtypes[i].custtypeid,
+ label: custtypes[i].custtypename
+ });
+ }
+ if(ret.dept!=null){
+ _self.dept=ret.dept;
+ }
+ _self.custtypelist=custtypelist;
+ }
+ })
+ }
+
+ })
+ function save_dev_rule(that){
+ var ids='';
+ var list=that.dev_righttable;
+ for(var i=0;i<list.length;i++) {
+ ids=ids+','+list[i].deviceid;
+ }
+ var ruleid=season_vue.sel_ruleid;
+ var token=$("meta[name='_csrf_token']").attr("value");
+
+ $.ajax({
+ type: "POST",
+ url:"[[@{atte/assign/save?ids=}]]"+ids+"&ruleid="+ruleid,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success: function (data) {
+
+ if (data.okFlag == '1') {
+ layer.msg("保存成功!",{icon:1,time:1000});
+ }
+ $("#dev_qrybtn").click();
+ }
+ });
+ }
+ function addAllDevList(that){
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var ruleid=that.sel_ruleid;
+ var devname=that.dev_device.devname;
+
+ var devtype=that.dev_device.devtype;
+ $.ajax({
+ type: "get",
+ url: "[[@{atte/assign/devlist?ruleid=}]]"+ruleid+"&devname="+devname+"&devtype="+devtype,
+ dataType: "json",
+ success: function (data) {
+
+
+ if (data.canassignlist.length==0 && data.hasassignlist.length==0 ){
+ layer.msg('没有记录!',{icon:2,time:1000});
+ return;
+ }
+ season_vue.dev_lefttable=data.canassignlist;
+ season_vue.dev_righttable=data.hasassignlist;
+
+ }
+ });
+ }
+ function devtype_grpname(devtype){
+ var list=season_vue.devtypes;
+ if(devtype!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == devtype){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function weektime_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = season_vue.weekgrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function dept_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = season_vue.deptlist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function custtype_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = season_vue.custtypelist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+
+ function season_commonQuery(_self,season,pageno,pagesize) {
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:encodeURI("[[@{/atte/rule/list?season=}]]"+season+"&pageNo="+pageno+"&pageSize="+pagesize),
+ success:function(ret){
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ if(_self.totSize == 0 ){
+ layer.msg("暂无数据", {icon: 2, time: 1000});
+ }
+ }
+ })
+ }
+
+ function season_getFillData(_self,id){
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:encodeURI("[[@{/atte/loadSeasonForUpdate?sid=}]]"+id),
+ success:function(ret){
+ var weeklist = [];
+ var weeks=ret.weekgrp;
+ for (var i = 0; i < weeks.length; i++) {
+ weeklist.push({
+ value: weeks[i].weekid,
+ label: weeks[i].weekname
+ });
+ }
+ console.log(weeklist);
+ if (ret.season!=null){
+ _self.seasonDiaForm = ret.season;
+ }
+ if(_self.oper.opertype!='S' &&_self.oper.opertype != 'P'){
+ _self.seasonDiaForm.deptcode=_self.oper.deptcode
+ }
+ _self.weekgrplist=weeklist;
+ }
+ })
+ }
+
+ function season_saveData(_that,formdata,formName) {
+ var url;
+ if(season_vue.seasontitle == "添加规则"){
+ url = encodeURI("[[@{/atte/addSeason}]]");
+ }
+ if(season_vue.seasontitle == "修改规则"){
+ url = encodeURI("[[@{/atte/updateSeason}]]");
+ }
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type: "POST",
+ url: url,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data: JSON.stringify(formdata),
+ success: function (data) {
+ if (data.errStr == undefined) {
+ layer.msg('用户认证已过期,请重新登录', {icon: 2, time: 1000});
+ window.location = "login";
+ return;
+ }
+ if (data.errStr != "") {
+ layer.msg(data.errStr, {icon: 2, time: 1000});
+ } else {
+ layer.msg('保存信息成功!', {icon: 1, time: 1000});
+ season_refreshThisTable();
+ _that.$refs[formName].resetFields();
+ _that.dialogFormVisible = false;
+ }
+ }
+ });
+
+ }
+
+ function season_refreshThisTable(){
+ season_commonQuery(season_vue,season_vue.seasonform.season,season_vue.currPage,season_vue.pageSize);
+ };
+
+ function season_deletedata(id){
+ layer.confirm('你确定要删除选择的规则吗?', {icon: 3, title:'请确认',offset:'30%'}, function(index){
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:"[[@{/atte/deleteSeason?id=}]]"+id,
+ success:function(ret){
+ //console.log(ret);
+ if(ret.message == undefined){
+ layer.msg('用户认证已过期,请重新登录', {icon:2,time:1000});
+ window.location="login";
+ return;
+ }
+ if (ret.message != "") {
+ layer.msg(ret.message, {icon:2,time:1000});
+ }else{
+ if(ret.flag==0) {
+ layer.msg('删除成功', {icon: 1, time: 1000});
+ season_refreshThisTable();
+ }else {
+ layer.msg(ret.message, {icon:2,time:3000});
+ }
+ }
+ }
+ })
+ });
+ }
+
+ function stoporopen(id,flag){
+ var msg='';
+ if(flag==1){
+ msg='你确定要启用该规则,并停用该部门,人员类别下其他规则?';
+ }else{
+ msg='你确定要停用该规则?';
+ }
+ var token=$("meta[name='_csrf_token']").attr("value");
+ layer.confirm(msg, {icon: 3, title:'请确认',offset:'30%'}, function(index){
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/stoporopenrule?id=}]]"+id,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success:function(ret){
+ //console.log(ret);
+ if(ret.errStr == undefined){
+ layer.msg('用户认证已过期,请重新登录', {icon:2,time:1000});
+ window.location="login";
+ return;
+ }
+ if (ret.errStr != "") {
+ layer.msg(ret.errStr, {icon:2,time:1000});
+ }else{
+ if(flag==1) {
+ layer.msg('启用成功', {icon: 1, time: 1000});
+ }else {
+ layer.msg('停用成功', {icon: 1, time: 1000});
+ }
+ season_refreshThisTable();
+ }
+ }
+ })
+ });
+ }
+
+
+
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/atte/timedtl/index.html b/src/main/resources/templates/atte/timedtl/index.html
new file mode 100644
index 0000000..9b353a0
--- /dev/null
+++ b/src/main/resources/templates/atte/timedtl/index.html
@@ -0,0 +1,551 @@
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">考勤状态维护</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">人员考勤</a>
+ <a><cite>考勤状态维护</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body" >
+ <div id="timedtlapp">
+ <el-form :inline="true" ref="attedtlform" :model="attedtlform" data-parsley-validate class="form-horizontal form-label-left">
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">开始日期:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-date-picker style="width: 100%"
+ v-model="attedtlform.startdate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">结束日期:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-date-picker style="width: 100%"
+ v-model="attedtlform.enddate" type="date"
+ placeholder="选择日期" :editable="false" value-format="yyyyMMdd">
+ </el-date-picker>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">卡号:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="attedtlform.cardno" placeholder="输入%模糊查询"></el-input>
+ </div>
+ </div>
+ </div>
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">姓名:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-input v-model="attedtlform.custname" ></el-input>
+ </div>
+ </div>
+ </div>
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;">人员类别:</span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <el-select v-model="attedtlform.custtypeid" style="width:100%;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="custtypeid in typegrplist"
+ :key="custtypeid.value"
+ :label="custtypeid.label"
+ :value="custtypeid.value">
+ </el-option>
+ </el-select>
+ </div>
+ </div>
+ </div>
+
+
+ <div class="col-md-4">
+ <div class="form-group">
+ <label class="control-label col-md-4 col-sm-12 col-xs-12" style="font-size: 14px;"></span>
+ </label>
+ <div class="col-md-8 col-sm-12 col-xs-12">
+ <button type="button" class="btn btn-info" @click="query" id="attedtl_qrybtn">查 询</button>
+ <button class="btn btn-primary" type="button" @click="refreshdtl">刷新流水</button>
+ </div>
+ </div>
+ </div>
+ </el-form>
+
+ <template>
+ <el-table
+ ref="singleTable"
+ :data="tableData"
+ highlight-current-row
+ @current-change="currRowChange"
+ stripe
+ border
+ max-height="2000"
+ style="width: 100%">
+ <el-table-column
+ label="操作">
+
+ <template scope="scope">
+ <button type="button" class="btn btn-info btn-xs" title="修改考勤状态" @click="editDtl(scope.row)">修改考勤状态</button>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="atteno"
+ label="流水号"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="custname"
+ label="姓名"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="cardno"
+ label="卡号"
+ sortable
+ >
+ </el-table-column>
+ <el-table-column
+ prop="attedate"
+ label="日期"
+ :formatter="attedatefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="timeid"
+ label="考勤时段"
+ :formatter="timenamefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="state"
+ label="考勤状态"
+ :formatter="statefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="oldstate"
+ label="原始状态"
+ :formatter="oldstatefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="custtypeid"
+ label="人员类别"
+ :formatter="custtypefor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="deptcode"
+ label="部门"
+ :formatter="deptfor"
+ >
+ </el-table-column>
+ <el-table-column
+ prop="remark"
+ label="备注"
+ >
+ </el-table-column>
+
+ </el-table>
+ <div class="clearfix"></div>
+ <el-pagination
+ @size-change="handleSizeChange"
+ @current-change="currPageChange"
+ :current-page="currPage"
+ :page-sizes="[10, 20, 50, 100]"
+ :page-size="pageSize"
+ layout="prev, pager, next,sizes, jumper,total"
+ :total="totSize">
+ </el-pagination>
+ </template>
+
+ <!--修改考勤状态-->
+ <el-dialog :title="updatetitle" :visible.sync="dialogFormVisible" top="80px" size="tiny" :modal-append-to-body='false' @close="closeDialog('dtlDiaForm')">
+ <el-form ref="dtlDiaForm" class="el-form-item el-form-item--mini" :model="dtlDiaForm" size="mini" :rules="rules" label-width="36%">
+ <el-form-item label="姓名:" prop="custname">
+ <el-col :span="18">
+ <el-input v-model="dtlDiaForm.custname" readonly style="width: 250px;" maxlength="20">
+ </el-input>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="考勤状态:" prop="state">
+ <el-col :span="18">
+ <el-select v-model="dtlDiaForm.state" style="width: 250px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="state in stategrplist"
+ :key="state.value"
+ :label="state.label"
+ :value="state.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
+ <el-form-item label="备注:" prop="remark">
+ <el-col :span="18">
+ <el-input type="textarea" v-model="dtlDiaForm.remark" placeholder="填写备注" style="width: 250px;" >
+ </el-input>
+ </el-col>
+ </el-form-item>
+
+
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="resetForm('dtlDiaForm') ">取 消</el-button>
+ <el-button type="primary" @click="saveState('dtlDiaForm')">确 定</el-button>
+ </div>
+ </el-dialog>
+ </div>
+
+
+ </div>
+</div>
+
+<script>
+ var timedtl_vue = new Vue({
+ el: '#timedtlapp',
+ data:{
+ tableData: [],
+ currPage: 1,
+ pageSize:10,
+ totSize:0,
+ currentRow: null,
+ stategrplist:[{value:0,label:'未打卡'},{value:1,label:'正常'},{value:2,label:'迟到'},{value:3,label:'请假'},{value:4,label:'旷工'},],
+ attedtlform:{
+ startdate:Date.now(),
+ enddate:Date.now(),
+ cardno:'',
+ custname:'',
+ custtypeid:'',
+ deptcode:''
+ },
+ timegrplist:[],
+ typegrplist:[],
+ deptlist:[],
+ dialogFormVisible: false,
+ dlgAllotDevVisible:false,
+ updatetitle:'修改考勤状态',
+ dtlDiaForm:{
+ atteno:'',
+ custname:'',
+ state:'',
+ remark:''
+ },
+ rules: {
+ season: [
+ { required: true, message: '请输入时令名', trigger: 'blur' },
+ { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur'}
+ ],
+
+
+ },
+
+ },
+ methods: {
+ handleSizeChange:function(val) {
+ this.pageSize=val;
+ attedtl_commonQuery(this,this.currPage,val);
+ },
+ currPageChange:function(val) {
+ this.currPage=val;
+ attedtl_commonQuery(this,this.currPage,this.pageSize);
+ },
+ currRowChange:function(val) {
+ this.currentRow = val;
+ },
+ attedatefor:function(row){
+ if(row.attedate!= null){
+ return dateformatter(row.attedate);
+ }
+ },
+ statimefor:function(row){
+ if(row.statime!= null){
+ return timeformatter(row.statime);
+ }
+ },
+ statefor:function(row){
+ if(row.state!= null){
+ return state_grpname(row.state);
+ }
+ },
+ oldstatefor:function(row){
+ if(row.oldstate!= null){
+ return state_grpname(row.oldstate);
+ }
+ },
+ timenamefor:function(row){
+ if(row.timeid!=null){
+ return timeid_grpname(row.timeid);
+ }
+ },
+ query:function () {
+ this.pagesize=10;
+ this.currPage=1;
+ attedtl_commonQuery(this,this.currPage,this.pageSize);
+ },
+ resetForm:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ closeDialog:function(formName) {
+ this.$refs[formName].resetFields();
+ this.dialogFormVisible = false
+ },
+ saveState:function (formName) {
+
+ var _that=this;
+ attedtl_saveData(_that,formName);
+
+ },
+ editDtl:function (row) {
+ dtl_getFillData(this,row);
+ this.dialogFormVisible = true;
+ this.updatetitle="修改流水状态"
+ },
+ custtypefor:function (row) {
+ return custtype_grpname(row.custtypeid);
+ },
+ deptfor:function (row) {
+ return dept_grpname(row.deptcode);
+ },
+ refreshdtl:function (){
+ var _that=this;
+ refreshAtteDtl(_that);
+ }
+
+ },
+ created:function(){
+ var _self=this;
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var startdate=class_Formatdate(_self.attedtlform.startdate);
+ var enddate=class_Formatdate(_self.attedtlform.enddate);
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/timedtl/list?startdate=}]]"+startdate+"&enddate="+enddate,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data:JSON.stringify(_self.attedtlform),
+ success:function(ret){
+ // //console.log(ret);
+ // _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ var custtypelist = [];
+ var types=ret.custtypelist;
+ for (var i = 0; i < types.length; i++) {
+ custtypelist.push({
+ value: types[i].custtypeid,
+ label: types[i].custtypename
+ });
+ }
+ var timelist=[];
+ var times=ret.timelist;
+ for (var i = 0; i < times.length; i++) {
+ timelist.push({
+ value: times[i].timeid,
+ label: times[i].timename
+ });
+ }
+ var deptlist=[];
+ var depts=ret.deptlist;
+ for (var i = 0; i < depts.length; i++) {
+ deptlist.push({
+ value: depts[i].deptcode,
+ label: depts[i].deptname
+ });
+ }
+ _self.deptlist=deptlist;
+ _self.timegrplist=timelist;
+ _self.typegrplist=custtypelist;
+ }
+ })
+ }
+
+ })
+ function refreshAtteDtl(that){
+ var startdate=class_Formatdate(that.attedtlform.startdate);
+ var enddate=class_Formatdate(that.attedtlform.enddate);
+ if(startdate== '' || enddate=='') {
+ layer.msg("请选择日期", {icon: 2, time: 1000});
+ return;
+ }
+ if(startdate>enddate){
+ layer.msg("开始日期不能大于结束日期!", {icon: 2, time: 1000});
+ return;
+ }
+ layer.confirm('你确定要刷新所选日期的流水吗?', {icon: 3, title:'请确认',offset:'30%'},function (){
+
+ $.ajax({
+ type:"get",
+ dataType:"json",
+ url:"[[@{/atte/adddtlbyhand?enddate=}]]"+enddate+"&startdate="+startdate,
+ success:function(ret){
+ layer.msg('保存信息成功!', {icon: 1, time: 1000});
+ dtl_refreshThisTable();
+ }
+ })
+ })
+ }
+ function dateformatter(time){
+ return time.substr(0,4)+'-'+time.substr(4,2)+'-'+time.substr(6,2);
+ }
+ function timeformatter(time){
+ return time.substr(0,2)+':'+time.substr(2,2)+':'+time.substr(4,2);
+ }
+
+ function dept_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = timedtl_vue.deptlist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function custtype_grpname(grpid){
+// console.log(typeof timeid)
+ if(grpid!=null){
+ var list = timedtl_vue.typegrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function state_grpname(grpid){
+ if(grpid!=null){
+ var list = timedtl_vue.stategrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+
+ function timeid_grpname(grpid){
+ if(grpid!=null){
+ var list = timedtl_vue.timegrplist;
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == grpid){
+ return list[i].label;
+ }
+ }
+ }
+ }
+ function class_Formatdate(date){
+ if(date==null||date==''){
+ return '';
+ }
+ var d=new Date(date);
+ var month=d.getMonth() + 1+'';
+ var date=d.getDate()+'';
+ if(month.length==1){
+ month='0'+month;
+ }
+ if(date.length==1){
+ date='0'+date;
+ }
+ var formated=d.getFullYear() + '' + month + '' +date;
+
+ return formated;
+ }
+ function attedtl_commonQuery(_self,pageno,pagesize) {
+
+ var token=$("meta[name='_csrf_token']").attr("value");
+ var startdate=class_Formatdate(_self.attedtlform.startdate);
+ var enddate=class_Formatdate(_self.attedtlform.enddate);
+ $.ajax({
+ type:"post",
+ dataType:"json",
+ url:"[[@{/atte/timedtl/list?startdate=}]]"+startdate+"&enddate="+enddate+"&pageNo="+pageno+"&pageSize="+pagesize,
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ data:JSON.stringify(_self.attedtlform),
+ success:function(ret){
+ _self.totSize=ret.PageResult.totalCount;
+ _self.tableData=ret.PageResult.list;
+ if(_self.totSize == 0 ){
+ layer.msg("暂无数据", {icon: 2, time: 1000});
+ }
+
+ }
+ })
+ }
+
+ function dtl_getFillData(_self,row){
+ _self.dtlDiaForm.atteno=row.atteno;
+ _self.dtlDiaForm.custname=row.custname;
+ _self.dtlDiaForm.state=row.state;
+ _self.dtlDiaForm.remark=row.remark;
+ }
+
+ function attedtl_saveData(_that,formName) {
+ var atteno=_that.dtlDiaForm.atteno;
+ var state=_that.dtlDiaForm.state;
+ var remark=_that.dtlDiaForm.remark;
+ if(remark==null){
+ remark='';
+ }
+ var token=$("meta[name='_csrf_token']").attr("value");
+ $.ajax({
+ type: "POST",
+ url: '[[@{/atte/updatetimeDtl?atteno=}]]'+atteno+"&state="+state+"&remark="+remark,
+ dataType: "json",
+ contentType: "application/json",
+ headers: {
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json',
+ 'X-CSRF-TOKEN':token,
+ },
+ success: function (data) {
+ if (data.errStr == undefined) {
+ layer.msg('用户认证已过期,请重新登录', {icon: 2, time: 1000});
+ window.location = "login";
+ return;
+ }
+ if (data.errStr != "") {
+ layer.msg(data.errStr, {icon: 2, time: 1000});
+ } else {
+ layer.msg('保存信息成功!', {icon: 1, time: 1000});
+ _that.dialogFormVisible = false;
+ dtl_refreshThisTable();
+ _that.$refs[formName].resetFields();
+ }
+ }
+ })
+
+ }
+
+ function dtl_refreshThisTable(){
+ attedtl_commonQuery(timedtl_vue,timedtl_vue.currPage,timedtl_vue.pageSize);
+ };
+
+
+
+
+
+</script>
\ No newline at end of file
diff --git a/src/main/resources/templates/ncmgr/nc_time.html b/src/main/resources/templates/ncmgr/nc_time.html
index 28f38f7..506dc3e 100644
--- a/src/main/resources/templates/ncmgr/nc_time.html
+++ b/src/main/resources/templates/ncmgr/nc_time.html
@@ -54,6 +54,13 @@
width="200">
</el-table-column>
<el-table-column
+ prop="timetype"
+ label="时段类型"
+ sortable
+ :formatter="timetypefor"
+ width="190">
+ </el-table-column>
+ <el-table-column
prop="updtime"
label="更新时间"
:formatter="updform">
@@ -90,6 +97,18 @@
</div>
</div>
</el-form-item>
+ <el-form-item label="时段类型:" prop="timetype">
+ <el-col :span="18">
+ <el-select v-model="timeDiaForm.timetype" style="width: 187px;" clearable filterable placeholder="请选择">
+ <el-option
+ v-for="timetype in timetypelist"
+ :key="timetype.value"
+ :label="timetype.label"
+ :value="timetype.value">
+ </el-option>
+ </el-select>
+ </el-col>
+ </el-form-item>
<el-form-item label="开始时间:" prop="btime">
<el-col :span="15">
<el-time-picker placeholder="选择时间" @change="pickbTime" v-model="timeDiaForm.btime" style="width: 187px"></el-time-picker>
@@ -123,13 +142,15 @@
timeform:{
timename:''
},
+ timetypelist:[{value:0,label:'默认'},{value:1,label:'考到'},{value:2,label:'考离'}],
dialogFormVisible: false,
dlgAllotDevVisible:false,
timeDiaForm:{
timeid:'',
timename:'',
btime:new Date(),
- etime:new Date()
+ etime:new Date(),
+ timetype:0
},
rules:{
timename:[
@@ -219,6 +240,12 @@
if(row.updtime != null) {
return time_timeformatter(row.updtime);
}
+ },
+ timetypefor:function(row){
+ if(row.timetype ==null){
+ row.timetype=0;
+ }
+ return timetype_formatter(row.timetype);
}
},
created:function(){
@@ -243,6 +270,17 @@
// return [year,month,date].join('-')+' '+[hour,moment,second].join(':');
}
+ function timetype_formatter(type){
+ var list = time_vue.timetypelist;
+
+ if(type!=null){
+ for(var i=0;i<list.length;i++){
+ if(list[i].value == type){
+ return list[i].label;
+ }
+ }
+ }
+ }
function time_refreshThisTable(){
time_commonQuery(time_vue,time_vue.timeform.timename,time_vue.currPage,time_vue.pageSize);
};
@@ -306,6 +344,12 @@
_self.timeDiaForm.btime = new Date(year,mon,day,btime[0],btime[1]);
_self.timeDiaForm.etime = new Date(year,mon,day,etime[0],etime[1]);
}
+ if(ret.time==null || ret.time.timetype==null){
+ _self.timeDiaForm.timetype==0;
+ }else{
+ _self.timeDiaForm.timetype=ret.time.timetype;
+ }
+
}
})
}