请假功能
diff --git a/src/main/java/com/supwisdom/dlpay/app/controller/AppController.java b/src/main/java/com/supwisdom/dlpay/app/controller/AppController.java
index a8fd46b..4d643d0 100644
--- a/src/main/java/com/supwisdom/dlpay/app/controller/AppController.java
+++ b/src/main/java/com/supwisdom/dlpay/app/controller/AppController.java
@@ -52,11 +52,11 @@
return "apph5/remoteH5";
}
- @RequestMapping("/doorappindex")
- public String doorappindex(@RequestParam(value = "custid") String custid, Model model) {
- model.addAttribute("userId", custid);
- return "apph5/leavehistory";
- }
+// @RequestMapping("/doorappindex")
+// public String doorappindex(@RequestParam(value = "custid") String custid, Model model) {
+// model.addAttribute("userId", custid);
+// return "apph5/leavehistory";
+// }
@RequestMapping("/doorappvisitor")
public String doorappvisitor(@RequestParam(value = "custid") String custid, Model model) {
diff --git a/src/main/java/com/supwisdom/dlpay/atte/controller/AppAtteController.java b/src/main/java/com/supwisdom/dlpay/atte/controller/AppAtteController.java
index e62dbdc..4d3570c 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/controller/AppAtteController.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/controller/AppAtteController.java
@@ -2,11 +2,13 @@
import com.supwisdom.dlpay.atte.bean.RestSearchBean;
import com.supwisdom.dlpay.atte.domain.TAtteRest;
+import com.supwisdom.dlpay.atte.service.AtteClassService;
import com.supwisdom.dlpay.atte.service.AtteRestService;
import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;
import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;
import com.supwisdom.dlpay.framework.util.DateUtil;
import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.mainservice.domain.TCustomer;
import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;
import com.supwisdom.dlpay.system.domain.TCustType;
@@ -33,20 +35,29 @@
private SystemService systemService;
@Autowired
private WebInterfaceService webInterfaceService;
+ @Autowired
+ private AtteClassService atteClassService;
/**
* 菜单
* @param
*/
- @RequestMapping("/atte/index")
+ @RequestMapping("/doorappindex")
public String appindex(@RequestParam(value = "custid") String custid, Model model) {
model.addAttribute("custid", custid);
+ TCustomer cust=webInterfaceService.findCustomerById(custid);
+ if(cust==null){
+ return "atte/app/error";
+ }
+ if(atteRestService.isreview(custid)){
+ return "atte/app/re_index";
+ }
return "atte/app/index";
}
/**
* 请假
* @param
*/
- @RequestMapping(value = "/savetempcust", method = {RequestMethod.POST})
+ @RequestMapping(value = "/atte/savetempcust", method = {RequestMethod.POST})
@ResponseBody
public Map addRest(@RequestParam("custid") String custid,
@RequestParam("enddate") String enddate,
@@ -79,7 +90,7 @@
/**
* 查看历史假条
*/
- @RequestMapping(value = "/getrestlist")
+ @RequestMapping(value = "/atte/getrestlist")
@ResponseBody
public Map getRestList(@RequestParam("rtype") Integer rtype,
@RequestParam("status") Integer status,
@@ -112,7 +123,7 @@
public ModelAndView searchindex(@RequestParam(value = "custid")String custid){
ModelAndView model=new ModelAndView();
model.addObject("custid",custid);
- model.setViewName("apph5/app/index");
+ model.setViewName("apph5/myleave");
return model;
}
/**
@@ -127,7 +138,7 @@
return model;
}
@ResponseBody
- @RequestMapping("/getcusttypelist")
+ @RequestMapping("/atte/getcusttypelist")
public Map loadAppDevList(){
Map map = new HashMap();
try{
@@ -143,10 +154,11 @@
/**
* 审核列表
*/
- @RequestMapping(value = "/getreviewlist")
+ @RequestMapping(value = "/atte/getreviewlist")
@ResponseBody
public Map getreviewlist(@RequestParam("rtype") Integer rtype,
@RequestParam("custid") String custid,
+ @RequestParam("status") Integer status,
@RequestParam(value = "custtypeid", required = false, defaultValue = "") Integer custtypeid,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") int pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize,
@@ -154,15 +166,91 @@
Map map=new HashMap();
RestSearchBean searchBean=new RestSearchBean();
- searchBean.setStatus(0);
+ searchBean.setStatus(status);
searchBean.setCusttypeid(custtypeid);
searchBean.setRtype(rtype);
TCustomer cust=webInterfaceService.findCustomerById(custid);
- searchBean.setDeptcode(cust.getDeptcode());
+ if(StringUtil.isEmpty(cust.getDeptcode())){
+ searchBean.setDeptcode("99");
+ }else {
+ searchBean.setDeptcode(cust.getDeptcode());
+ }
Pagination page=atteRestService.getRestInfo(searchBean,pageNo,pageSize);
map.put("page",page);
return map;
}
+ /**
+ * 审核
+ */
+ @RequestMapping(value = "/atte/getreviewlist")
+ @ResponseBody
+ public Map reviewer(@RequestParam("custid") String custid,
+ @RequestParam("status") Integer status,
+ @RequestParam("id") Integer id,
+ HttpServletRequest request){
+ Map map=new HashMap();
+ TCustomer cust=webInterfaceService.findCustomerById(custid);
+
+ try {
+ if(cust==null){
+ map.put("errStr","客户信息不存在!");
+ return map;
+ }
+ if(status==null || id==null){
+ map.put("errStr","参数错误");
+ return map;
+ }
+ TAtteRest rest=atteRestService.getAtteRestById(id);
+ if(rest!=null&&rest.getStatus()==0){
+ rest.setUpdatetime(DateUtil.getNow());
+ rest.setRecustid(custid);
+ rest.setStatus(status);
+ atteRestService.updateAtteRest(rest);
+ if(status==2){
+ atteClassService.updateRestDtl(rest.getStartdate(),rest.getEnddate(),custid,rest.getRtype());
+ }
+ map.put("errStr","");
+ }else {
+ map.put("errStr","假单不存在");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr",e.getMessage());
+ }
+
+ return map;
+
+ }
+ /**
+ * 取消
+ */
+ @RequestMapping("/atte/cancelRest")
+ @ResponseBody
+ public Map cancelRest(@RequestParam("status") Integer status,
+ @RequestParam("id") Integer id,
+ HttpServletRequest request){
+ Map map=new HashMap();
+
+ TAtteRest rest= null;
+ try {
+ rest = atteRestService.getAtteRestById(id);
+ if(rest.getStatus()==0){
+ rest.setStatus(3);
+ rest.setUpdatetime(DateUtil.getNow());
+ atteRestService.updateAtteRest(rest);
+ map.put("errStr","");
+ }else{
+ map.put("errStr","修改失败!");
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ map.put("errStr",e.getMessage());
+ }
+ return map;
+
+ }
+
}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteRestDaoImpl.java b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteRestDaoImpl.java
index 15a0ad3..63e43d7 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteRestDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/dao/impl/AtteRestDaoImpl.java
@@ -4,6 +4,7 @@
import com.supwisdom.dlpay.atte.bean.RestSearchBean;
import com.supwisdom.dlpay.atte.dao.AtteRestDao;
import com.supwisdom.dlpay.atte.domain.TAtteRest;
+import com.supwisdom.dlpay.atte.domain.TAtteReview;
import com.supwisdom.dlpay.framework.util.StringUtil;
import com.supwisdom.dlpay.system.page.Pagination;
import org.hibernate.query.internal.NativeQueryImpl;
@@ -232,8 +233,16 @@
@Transactional
@Override
public boolean isreview(String custid) {
+ if(StringUtil.isEmpty(custid)){
+ return false;
+ }
String sql= " select bean from TAtteReview bean where bean.custid= :cid ";
-
+ TypedQuery<TAtteReview> query=entityManager.createQuery(sql,TAtteReview.class);
+ query.setParameter("cid",custid);
+ List<TAtteReview> list=query.getResultList();
+ if(list!=null&&list.size()>0){
+ return true;
+ }
return false;
}
}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java b/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java
index c184388..0af74ad 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/AtteClassService.java
@@ -89,4 +89,8 @@
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
public List<AtteReport> getPReportList(AttedtlSearchBean searchBean);
+
+ //处理假条
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean updateRestDtl(String startdate,String enddate,String custid,Integer state);
}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/AtteRestService.java b/src/main/java/com/supwisdom/dlpay/atte/service/AtteRestService.java
index b52a048..262b902 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/AtteRestService.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/AtteRestService.java
@@ -23,4 +23,7 @@
@Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
public Pagination getRestInfo(RestSearchBean searchBean, int pageNo, int pageSize);
+
+ @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})
+ public boolean isreview(String custid);
}
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 8b8fe2f..6707c73 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
@@ -428,4 +428,21 @@
public List<AtteReport> getPReportList(AttedtlSearchBean searchBean) {
return atteClassDao.getPReportList(searchBean);
}
+
+ @Override
+ public boolean updateRestDtl(String startdate, String enddate, String custid,Integer state) {
+ Integer start=Integer.parseInt(startdate);
+ Integer end=Integer.parseInt(enddate);
+ while (start<=end){
+ List<TAtteDtl> list=atteClassDao.getDetailList(custid,startdate);
+ for(TAtteDtl dtl:list){// 处理假条
+ dtl.setState(state);
+ dtl.setUpdatetime(DateUtil.getNow());
+ atteClassDao.updateAtteDtl(dtl);
+ }
+ startdate= DateUtil.getNewDay(startdate,1);
+ start=Integer.parseInt(startdate);
+ }
+ return true;
+ }
}
diff --git a/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteRestServiceImpl.java b/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteRestServiceImpl.java
index 71237b7..7acdd40 100644
--- a/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteRestServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/atte/service/impl/AtteRestServiceImpl.java
@@ -37,4 +37,9 @@
public Pagination getRestInfo(RestSearchBean searchBean, int pageNo, int pageSize) {
return atteRestDao.getRestInfo(searchBean,pageNo,pageSize);
}
+
+ @Override
+ public boolean isreview(String custid) {
+ return atteRestDao.isreview(custid);
+ }
}
diff --git a/src/main/kotlin/com/supwisdom/dlpay/security.kt b/src/main/kotlin/com/supwisdom/dlpay/security.kt
index 73eaabd..6b309f0 100644
--- a/src/main/kotlin/com/supwisdom/dlpay/security.kt
+++ b/src/main/kotlin/com/supwisdom/dlpay/security.kt
@@ -127,8 +127,8 @@
.antMatchers("/app/apply/**").permitAll()
.antMatchers("/api/conference/**").permitAll()
.antMatchers("/api/notify/**").permitAll()
- .antMatchers("/app/atte/index").permitAll()
- .antMatchers("/app/*").permitAll()
+ .antMatchers("/app/atte/*").permitAll()
+ .antMatchers("/app/doorappindex").permitAll()
.antMatchers("/api/common/**").hasAnyRole("THIRD_COMMON", "THIRD_ADMIN")
.antMatchers("/api/consume/**").hasRole("THIRD_CONSUME")
.antMatchers("/api/deposit/**").hasRole("THIRD_DEPOSIT")
diff --git a/src/main/resources/atte.sql b/src/main/resources/atte.sql
index 510750b..feed522 100644
--- a/src/main/resources/atte.sql
+++ b/src/main/resources/atte.sql
@@ -47,7 +47,7 @@
d.operid,
d.updatetime
FROM t_atte_dtl d
-WHERE (((t.custid)::text = (d.custid)::text) AND ((t.attedate)::text = (d.attedate)::text) AND (d.state = 3)))) THEN 3
+WHERE (((t.custid)::text = (d.custid)::text) AND ((t.attedate)::text = (d.attedate)::text) AND (d.state > 10)))) THEN 3
WHEN (EXISTS ( SELECT d.atteno,
d.custid,
d.attedate,
diff --git a/src/main/resources/templates/atte/app/index.html b/src/main/resources/templates/atte/app/index.html
index c6f4b35..2ed64f1 100644
--- a/src/main/resources/templates/atte/app/index.html
+++ b/src/main/resources/templates/atte/app/index.html
@@ -30,7 +30,7 @@
<!--<p style="text-align: center;display: block;font-size:20px">请假</p>-->
<!--</div>-->
<div class="weui-cells">
- <a class="weui-cell weui-cell_access" onclick="add()" >
+ <a class="weui-cell weui-cell_access" th:href="@{'/app/atte/addindex?custid='+${custid}}" >
<div class="weui-cell__bd">
<p>请假</p>
</div>
@@ -40,7 +40,7 @@
</div>
<div class="weui-cells">
- <a class="weui-cell weui-cell_access" onclick="search()" >
+ <a class="weui-cell weui-cell_access" th:href="@{'/app/atte/searchindex?custid='+${custid}}" >
<div class="weui-cell__bd">
<p>查看假条</p>
</div>
@@ -49,16 +49,7 @@
</a>
</div>
-<div class="weui-cells">
- <a class="weui-cell weui-cell_access" onclick="review()" >
- <div class="weui-cell__bd">
- <p>审核假条</p>
- </div>
- <div class="weui-cell__ft">
- </div>
- </a>
-</div>
</body>
diff --git a/src/main/resources/templates/atte/app/re_index.html b/src/main/resources/templates/atte/app/re_index.html
new file mode 100644
index 0000000..3e838d7
--- /dev/null
+++ b/src/main/resources/templates/atte/app/re_index.html
@@ -0,0 +1,112 @@
+
+<!DOCTYPE html>
+<html style="height: 100%" 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>
+
+
+ <link rel="stylesheet" th:href="@{/static/libs/weui/weui.min.css}" media="all"/>
+</head>
+
+<body style="height: 100%;background:#f0f0ff">
+<!--<div class="topbar">-->
+ <!--<p style="text-align: center;display: block;font-size:20px">请假</p>-->
+<!--</div>-->
+<div class="weui-cells">
+ <a class="weui-cell weui-cell_access" th:href="@{'/app/atte/addindex?custid='+${custid}}" >
+ <div class="weui-cell__bd">
+ <p>请假</p>
+ </div>
+ <div class="weui-cell__ft">
+ </div>
+ </a>
+
+</div>
+<div class="weui-cells">
+ <a class="weui-cell weui-cell_access" th:href="@{'/app/atte/searchindex?custid='+${custid}}" >
+ <div class="weui-cell__bd">
+ <p>查看假条</p>
+ </div>
+ <div id="test" class="weui-cell__ft">
+ </div>
+ </a>
+
+</div>
+<div class="weui-cells">
+ <a class="weui-cell weui-cell_access" th:href="@{'/app/atte/reviewindex?custid='+${custid}}" >
+ <div class="weui-cell__bd">
+ <p>审核假条</p>
+ </div>
+ <div class="weui-cell__ft">
+ </div>
+ </a>
+
+</div>
+
+
+</body>
+
+<script>
+
+ $(function () {
+
+ });
+ function add() {
+ var custid=[[${custid}]];
+ alert('ok');
+ $.ajax({
+ type: "get",
+ url: "[[@{/app/atte/addindex?custid=}]]"+custid,
+ dataType: "json",
+ success: function (data) {
+
+ }
+ });
+ }
+ function search(){
+ var custid=[[${custid}]];
+ $.ajax({
+ type: "get",
+ url: "[[@{app/atte/searchindex?custid=}]]"+custid,
+ dataType: "json",
+ success: function (data) {
+
+
+ }
+ });
+ }
+ function review() {
+ var custid=[[${custid}]];
+ $.ajax({
+ type: "get",
+ url: "[[@{app/atte/reviewindex?custid=}]]"+custid,
+ dataType: "json",
+ success: function (data) {
+
+
+ }
+ });
+ }
+
+</script>
+
+<style>
+
+</style>
\ No newline at end of file