大理考勤
diff --git a/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java b/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java
index 432b416..e0f6232 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/controller/CustAtteController.java
@@ -176,7 +176,7 @@
                 map.put("errStr","该规则名称已存在,请从新修改!");
                 return map;
             }
-            TSeason open=seasonService.getOpenRule(bean.getCusttypeid()+"",bean.getDeptcode());
+            TSeason open=seasonService.getOpenRule(bean.getCusttypeid(),bean.getDeptcode());
                 if(open!=null&&open.getId()!=bean.getId()){
                     map.put("errStr","所选部门,人员类别下存在已启用的规则!");
                     return map;
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
index e332dd6..4f4d985 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteClassDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteClassDaoImpl.java
@@ -452,7 +452,7 @@
         if(!StringUtil.isEmpty(searchBean.getCardno())){
             sql+="  and v.cardno like :cno ";
         }
-        sql+=" order by v.doorseqno ";
+        sql+=" order by v.transdate desc,v.transtime desc";
         Query query=entityManager.createNativeQuery(sql, AtteDtl.class);
         if(!StringUtil.isEmpty(searchBean.getStartdate())&&!StringUtil.isEmpty(searchBean.getEnddate())){
             query.setParameter("sdate",searchBean.getStartdate());
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java b/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java
index 63d6202..49f1df2 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/SeasonService.java
@@ -39,5 +39,5 @@
     public boolean stoporopen(Integer id);
 
     @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
-    public TSeason getOpenRule(String custtypeid,String deptcode);
+    public TSeason getOpenRule(Integer 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
index 02ae69b..485b1e2 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteClassServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteClassServiceImpl.java
@@ -9,6 +9,8 @@
 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.dao.BusinessparaDao;
+import com.supwisdom.dlpay.framework.domain.TBusinesspara;
 import com.supwisdom.dlpay.framework.util.DateUtil;
 import com.supwisdom.dlpay.framework.util.StringUtil;
 import com.supwisdom.dlpay.mainservice.dao.CustomerDao;
@@ -46,6 +48,8 @@
     NcTimeDao ncTimeDao;
     @Autowired
     private SystemService systemService;
+    @Autowired
+    private BusinessparaDao businessparaDao;
 
     @Override
     public Pagination getClassWithPage(String classname,String deptcode, int pageNo, int pageSize) {
@@ -346,22 +350,27 @@
         String etime=time.getEtime().replace(":","")+"00";
         int bmin=getDiffMin(attetime,btime);
         int emin=getDiffMin(attetime,etime);
+        int d_min=0;
         if(time.getTimetype()==1){   //考到
+          TBusinesspara b_para= businessparaDao.findByParakey("atte_bmin");
+          d_min=Integer.parseInt(b_para.getParaval());
              if(bmin>0){  //
                  flag=0;
              }else {
                  if(emin>0){
                      flag=1;
-                 }else if(emin>-60){
+                 }else if(emin>-d_min){
                      flag=2;
                  }else{
                      flag=0;
                  }
              }
         }else if(time.getTimetype()==2){ //考离
-            if(bmin>60){
+            TBusinesspara e_para= businessparaDao.findByParakey("atte_emin");
+            d_min=Integer.parseInt(e_para.getParaval());
+            if(bmin>d_min){
                 flag=0;
-            }else if(bmin<60&&bmin>0){
+            }else if(bmin<d_min&&bmin>0){
                 flag=2;
             }else if(bmin<0&&emin>0){
                 flag=1;
@@ -369,6 +378,7 @@
                 flag=0;
             }
         }else{
+
             if(bmin<0&&emin>0){
                 flag=1;
             }else{
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
index 0eef3c8..37f7871 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/impl/SeasonServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/SeasonServiceImpl.java
@@ -72,7 +72,7 @@
         if(season.getStatus()==1){
             season.setStatus(2); //停用
         }else{
-            TSeason open=seasonDao.getOpenRule(season.getCusttypeid()+"",season.getDeptcode());
+            TSeason open=seasonDao.getOpenRule(season.getCusttypeid(),season.getDeptcode());
             if(open!=null){
                 open.setStatus(2);
                 open.setUpdatetime(DateUtil.getNow());
@@ -85,7 +85,7 @@
     }
 
     @Override
-    public TSeason getOpenRule(String custtypeid, String deptcode) {
+    public TSeason getOpenRule(Integer custtypeid, String deptcode) {
         return seasonDao.getOpenRule(custtypeid,deptcode);
     }
 }
diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java b/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java
index 89fd7d5..5e60101 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java
@@ -13,7 +13,7 @@
     private String cardphyid;

     private String expiredate;

     private String deptcode;

-    private String custtypeid;

+    private Integer custtypeid;

 

     public String getCustid() {

         return custid;

@@ -71,11 +71,11 @@
         this.deptcode = deptcode;

     }

 

-    public String getCusttypeid() {

+    public Integer getCusttypeid() {

         return custtypeid;

     }

 

-    public void setCusttypeid(String custtypeid) {

+    public void setCusttypeid(Integer custtypeid) {

         this.custtypeid = custtypeid;

     }

 }

diff --git a/src/main/resources/atte.sql b/src/main/resources/atte.sql
new file mode 100644
index 0000000..a700db6
--- /dev/null
+++ b/src/main/resources/atte.sql
@@ -0,0 +1,31 @@
+SELECT t.transdate,
+       t.transtime,
+       substr((t.doorid)::text, 5) AS deviceid,
+       t.doorseqno,
+       t.cardno,
+       t.cardphyid,
+       t.bankcardno,
+       t.custid,
+       t.custname,
+       t.status,
+       t.devtype
+FROM t_doordtl t
+WHERE ((substr((t.doorid)::text, 5))::integer IN ( SELECT DISTINCT d.deviceid
+  FROM (t_dev_rule d
+  LEFT JOIN t_atte_rule r ON ((d.ruleid = r.id)))
+  WHERE (r.status = 1)))
+ORDER BY t.doorseqno;
+
+
+INSERT INTO "tb_businesspara" VALUES ('atte_bmin', '60');
+INSERT INTO "tb_businesspara" VALUES ('atte_min', '60');
+INSERT INTO "tb_businesspara" VALUES ('atte_emin', '60');
+
+
+INSERT INTO  VALUES (47, NULL, 1, NULL, '', '/atte/dtl/index', '考勤流水', NULL, 36, NULL);
+INSERT INTO  VALUES (45, NULL, 1, NULL, '', '/atte/timedtl/index', '考勤状态维护', NULL, 36, NULL);
+INSERT INTO  VALUES (37, NULL, 1, NULL, '', '/atte/rule/index', '考勤规则管理', NULL, 36, NULL);
+INSERT INTO  VALUES (36, NULL, 0, NULL, 'layui-icon-set', '#', '人员考勤', 36, -1, NULL);
+INSERT INTO  VALUES (42, NULL, 1, NULL, '', '/atte/class/index', '手动排班', NULL, 36, NULL);
+INSERT INTO  VALUES (48, NULL, 1, NULL, '', '#', '审核人管理', NULL, 36, NULL);
+