人员管理功能(未完成)
diff --git a/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSaveBean.java b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSaveBean.java
new file mode 100644
index 0000000..f68fb7a
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSaveBean.java
@@ -0,0 +1,161 @@
+package com.supwisdom.dlpay.customer.bean;
+
+
+
+public class CustomerSaveBean {
+    private String custid;
+    private Integer custtype;
+    private String custname;
+    private String operid;
+    private String idno;
+    private String idtype;
+    private String phone;
+    private String batchno;
+    private String lastsaved;
+    private String status;
+    private String cardno;
+    private String cardphyid;
+    private String bankcardno;
+    private String checkstatus;
+    private Integer savecardflag;
+
+    public String getCustid() {
+        return custid;
+    }
+
+    public void setCustid(String custid) {
+        this.custid = custid;
+    }
+
+    public Integer getCusttype() {
+        return custtype;
+    }
+
+    public void setCusttype(Integer custtype) {
+        this.custtype = custtype;
+    }
+
+    public String getCustname() {
+        return custname;
+    }
+
+    public void setCustname(String custname) {
+        this.custname = custname;
+    }
+
+    public String getOperid() {
+        return operid;
+    }
+
+    public void setOperid(String operid) {
+        this.operid = operid;
+    }
+
+    public String getIdno() {
+        return idno;
+    }
+
+    public void setIdno(String idno) {
+        this.idno = idno;
+    }
+
+    public String getIdtype() {
+        return idtype;
+    }
+
+    public void setIdtype(String idtype) {
+        this.idtype = idtype;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getBatchno() {
+        return batchno;
+    }
+
+    public void setBatchno(String batchno) {
+        this.batchno = batchno;
+    }
+
+    public String getLastsaved() {
+        return lastsaved;
+    }
+
+    public void setLastsaved(String lastsaved) {
+        this.lastsaved = lastsaved;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getCardno() {
+        return cardno;
+    }
+
+    public void setCardno(String cardno) {
+        this.cardno = cardno;
+    }
+
+    public String getCardphyid() {
+        return cardphyid;
+    }
+
+    public void setCardphyid(String cardphyid) {
+        this.cardphyid = cardphyid;
+    }
+
+    public String getBankcardno() {
+        return bankcardno;
+    }
+
+    public void setBankcardno(String bankcardno) {
+
+        this.bankcardno = bankcardno;
+    }
+
+    public Integer getSavecardflag() {
+        return savecardflag;
+    }
+
+    public void setSavecardflag(Integer savecardflag) {
+        this.savecardflag = savecardflag;
+    }
+
+    public String getCheckstatus() {
+        return checkstatus;
+    }
+
+    public void setCheckstatus(String checkstatus) {
+        this.checkstatus = checkstatus;
+    }
+
+    @Override
+    public String toString() {
+        return "CustomerSaveBean{" +
+                "custid='" + custid + '\'' +
+                ", custtype=" + custtype +
+                ", custname='" + custname + '\'' +
+                ", operid='" + operid + '\'' +
+                ", idno='" + idno + '\'' +
+                ", idtype='" + idtype + '\'' +
+                ", phone='" + phone + '\'' +
+                ", batchno='" + batchno + '\'' +
+                ", lastsaved='" + lastsaved + '\'' +
+                ", status='" + status + '\'' +
+                ", cardno='" + cardno + '\'' +
+                ", cardphyid='" + cardphyid + '\'' +
+                ", bankcardno='" + bankcardno + '\'' +
+                '}';
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/CustomerSearchBean.java b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
similarity index 82%
rename from src/main/java/com/supwisdom/dlpay/system/bean/CustomerSearchBean.java
rename to src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
index 2a69580..ee53c17 100644
--- a/src/main/java/com/supwisdom/dlpay/system/bean/CustomerSearchBean.java
+++ b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerSearchBean.java
@@ -1,4 +1,6 @@
-package com.supwisdom.dlpay.system.bean;
+package com.supwisdom.dlpay.customer.bean;
+
+import com.supwisdom.dlpay.system.bean.PageBean;
 
 public class CustomerSearchBean extends PageBean {
     private String custname;
diff --git a/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerShowBean.java b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerShowBean.java
new file mode 100644
index 0000000..8d58026
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/customer/bean/CustomerShowBean.java
@@ -0,0 +1,107 @@
+package com.supwisdom.dlpay.customer.bean;
+
+
+public class CustomerShowBean {
+    private String custid;
+    private Integer custtype;
+    private String custname;
+    private String phone;
+    private String cardno;
+    private String cardphyid;
+    private String bankcardno;
+    private String deptcode;
+    private String custtypeid;
+    private String checkstatus;
+    private String status;
+
+
+    public String getDeptcode() {
+        return deptcode;
+    }
+
+    public void setDeptcode(String deptcode) {
+        this.deptcode = deptcode;
+    }
+
+    public String getCusttypeid() {
+        return custtypeid;
+    }
+
+    public void setCusttypeid(String custtypeid) {
+        this.custtypeid = custtypeid;
+    }
+
+    public String getCustid() {
+        return custid;
+    }
+
+    public void setCustid(String custid) {
+        this.custid = custid;
+    }
+
+    public Integer getCusttype() {
+        return custtype;
+    }
+
+    public void setCusttype(Integer custtype) {
+        this.custtype = custtype;
+    }
+
+    public String getCustname() {
+        return custname;
+    }
+
+    public void setCustname(String custname) {
+        this.custname = custname;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getCardno() {
+        return cardno;
+    }
+
+    public void setCardno(String cardno) {
+        this.cardno = cardno;
+    }
+
+    public String getCardphyid() {
+        return cardphyid;
+    }
+
+    public void setCardphyid(String cardphyid) {
+        this.cardphyid = cardphyid;
+    }
+
+    public String getBankcardno() {
+        return bankcardno;
+    }
+
+    public void setBankcardno(String bankcardno) {
+
+        this.bankcardno = bankcardno;
+    }
+
+    public String getCheckstatus() {
+        return checkstatus;
+    }
+
+    public void setCheckstatus(String checkstatus) {
+
+        this.checkstatus = checkstatus;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+}
diff --git a/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java b/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java
new file mode 100644
index 0000000..6db52fc
--- /dev/null
+++ b/src/main/java/com/supwisdom/dlpay/customer/controller/CustomerController.java
@@ -0,0 +1,113 @@
+package com.supwisdom.dlpay.customer.controller;
+
+
+import com.google.gson.Gson;
+import com.supwisdom.dlpay.api.bean.JsonResult;
+import com.supwisdom.dlpay.api.bean.QueryUserParam;
+import com.supwisdom.dlpay.api.bean.UserInforResponse;
+import com.supwisdom.dlpay.customer.bean.CustomerSaveBean;
+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;
+import com.supwisdom.dlpay.doorlist.bean.CustomerListBean;
+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.PageResult;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;
+import com.supwisdom.dlpay.paysdk.proxy.UserProxy;
+import com.supwisdom.dlpay.system.domain.TCustType;
+import com.supwisdom.dlpay.system.domain.TDept;
+import com.supwisdom.dlpay.system.service.SystemService;
+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.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+@Controller
+@RequestMapping("/customer")
+public class CustomerController {
+
+
+    @Autowired
+    private UserProxy userProxy;
+    @Autowired
+    private SystemService systemService;
+    @Autowired
+    private WebInterfaceService webInterfaceService;
+
+    @RequestMapping("/index")
+    public String indexView(ModelMap model) {
+        List<TCustType> lst = systemService.findAllCusttype();
+        List<TDept> dept=systemService.findAllDept();
+        Gson gson = new Gson();
+        String deptString = gson.toJson(dept);
+        model.put("deptlist", deptString);
+        String typeString = gson.toJson(lst);
+        model.put("custtypelist", typeString);
+
+        return "doorlist/customer/index";
+    }
+
+    @RequestMapping("/list")
+    @ResponseBody
+    public PageResult<TCustomerInfo> getDataList(@RequestParam("page") Integer pageNo,
+                                                 @RequestParam("limit") Integer pageSize,
+                                                 @RequestParam(value = "searchkey", required = false) String searchKey) {
+        try {
+            if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+            if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+            CustomerSearchBean searchBean = new CustomerSearchBean();
+            searchBean.setPageNo(pageNo);
+            searchBean.setCustname(searchKey);
+            searchBean.setPageSize(pageSize);
+            PageResult<TCustomerInfo> bean= webInterfaceService.getCustomerInfoPage(searchBean);
+
+            return bean;
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new PageResult<>(99, "系统查询错误");
+        }
+    }
+
+
+    @GetMapping("/loadadd")
+    public String loadadd(Model model) {
+        List<TCustType> list=systemService.findAllCusttype();
+        model.addAttribute("typelist",list);
+        return "restaurant/customer/form";
+    }
+
+    @PostMapping("/add")
+    @ResponseBody
+    public JsonResult add(@RequestBody CustomerListBean customer,
+                          @AuthenticationPrincipal TOperator operUser) {
+        if (customer != null) {
+            String operid=operUser.getOperid();
+            String now = DateUtil.getNow();
+            QueryUserParam queryUserParam = new QueryUserParam();
+            queryUserParam.setCitizencardno(customer.getCardno());
+            UserInforResponse response = userProxy.querybycardno(queryUserParam);
+            if (response.getRetcode() != 0) {
+                return JsonResult.error("核心平台验证人员失败:"+response.getRetmsg());
+            }
+            webInterfaceService.doSaveCustomerAndCard(operid,now,customer,response);
+            return JsonResult.ok();
+        } else {
+            return JsonResult.error("添加失败");
+        }
+    }
+
+/*
+    @PostMapping("/delete")
+    @ResponseBody
+    public JsonResult delete(@RequestParam String  custid) {
+        return customerService.deleteCustomer(custid);
+    }
+
+*/
+
+
+}
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 dca8fca..89fd7d5 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/bean/TCustomerInfo.java
@@ -12,6 +12,8 @@
     private String bankcardno;

     private String cardphyid;

     private String expiredate;

+    private String deptcode;

+    private String custtypeid;

 

     public String getCustid() {

         return custid;

@@ -61,4 +63,19 @@
         this.expiredate = expiredate;

     }

 

+    public String getDeptcode() {

+        return deptcode;

+    }

+

+    public void setDeptcode(String deptcode) {

+        this.deptcode = deptcode;

+    }

+

+    public String getCusttypeid() {

+        return custtypeid;

+    }

+

+    public void setCusttypeid(String custtypeid) {

+        this.custtypeid = custtypeid;

+    }

 }

diff --git a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
index 1455d88..180b14d 100644
--- a/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
+++ b/src/main/java/com/supwisdom/dlpay/doorlist/controller/DoorlistMgrController.java
@@ -384,13 +384,6 @@
             }

             for (CustomerListBean list : doorList) {

 

-                String deptcode=list.getDeptno();

-                TDept dept=systemService.getDeptByDeptno(list.getDeptno());

-                if(null!=dept){

-                    deptcode=dept.getDeptcode();

-                }

-

-

                 String cardno = list.getCardno();

                 //String bankcardno = list.getBankcardno();

 

@@ -416,78 +409,7 @@
                 }

                 succCnt++;

                 tmpi++;

-                TCustomer customer = webInterfaceService.findCustomerById(response.getUserid());

-                if (customer != null) {//此用户已存在

-                    TCard card = webInterfaceService.findCardByCustid(customer.getCustid());

-

-                    customer.setStatus(customer.getStatus());

-                    customer.setCustname(response.getUsername());

-//            customer.setSex(list.getSex());

-//            customer.setEmail(list.getEmail());

-//            customer.setMobile(list.getMobile());

-//            customer.setAddr(list.getAddr());

-                    customer.setClosedate(response.getExpiredate());

-                    customer.setLastsavedtime(now);

-                    customer.setAddoperid(operid);

-                    customer.setRemark(list.getRemarks());

-                    customer.setDeptcode(deptcode);

-                    customer.setCusttypeid(list.getCusttypeid());

-                    webInterfaceService.saveCustomer(customer);

-

-                    //一个用户可能会有多个卡,补办新卡新增一条信息

-                    if (card != null) {

-                        card.setCardphyid(response.getCardphyid());

-                        card.setExpiredate(response.getExpiredate());

-                        card.setStatus(response.getCardstatus());

-                        card.setTranstatus(response.getTransstatus());

-                        card.setCardverno(Integer.parseInt(card.getCardverno()) + 1 + "");

-                        card.setLastsavedtime(now);

-                        webInterfaceService.saveCard(card);

-                    } else {

-                        TCard cardTmp = new TCard();

-                        cardTmp.setCardno(list.getCardno());

-                        cardTmp.setBankcardno(response.getBankcardno());

-                        cardTmp.setCustid(response.getUserid());

-                        cardTmp.setCardphyid(response.getCardphyid());

-                        cardTmp.setExpiredate(response.getExpiredate());

-                        cardTmp.setStatus(response.getCardstatus());

-                        cardTmp.setTranstatus(response.getTransstatus());

-                        cardTmp.setCardverno("1");

-                        cardTmp.setLastsavedtime(now);

-                        webInterfaceService.saveCard(cardTmp);

-                    }

-

-                } else {

-                    TCustomer customerTmp = new TCustomer();

-                    customerTmp.setCustid(response.getUserid());

-                    customerTmp.setStatus("1");

-                    customerTmp.setCustname(response.getUsername());

-//            customerTmp.setSex(list.getSex());

-//            customerTmp.setEmail(list.getEmail());

-//            customerTmp.setMobile(list.getMobile());

-//            customerTmp.setAddr(list.getAddr());

-                    customerTmp.setOpendate(now.substring(0, 8));

-                    customerTmp.setClosedate(response.getExpiredate());

-                    customerTmp.setLastsavedtime(now);

-                    customerTmp.setAddoperid(operid);

-                    customerTmp.setRemark(list.getRemarks());

-                    customer.setDeptcode(deptcode);

-                    customer.setCusttypeid(list.getCusttypeid());

-                    webInterfaceService.saveCustomer(customerTmp);

-

-                    TCard cardTmp = new TCard();

-                    cardTmp.setCardno(list.getCardno());

-                    cardTmp.setBankcardno(response.getBankcardno());

-                    cardTmp.setCustid(customerTmp.getCustid());

-                    cardTmp.setCardphyid(response.getCardphyid());

-                    cardTmp.setExpiredate(response.getExpiredate());

-                    cardTmp.setStatus(response.getCardstatus());

-                    cardTmp.setTranstatus(response.getTransstatus());

-                    cardTmp.setCardverno("1");

-                    cardTmp.setLastsavedtime(now);

-                    //cardTmp.setBankcardno(response.getBankcardno());

-                    webInterfaceService.saveCard(cardTmp);

-                }

+                webInterfaceService.doSaveCustomerAndCard(operid, now, list, response);

             }

             //获取结束时间

             long endTime = System.currentTimeMillis();

@@ -515,6 +437,7 @@
         return map;

     }

 

+

     /**

      * 获取要下发的人员名单

      *

diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
index 2952d71..150a275 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/CustomerDao.java
@@ -1,6 +1,8 @@
 package com.supwisdom.dlpay.mainservice.dao;

 

+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;

 import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;

+import com.supwisdom.dlpay.framework.util.PageResult;

 import com.supwisdom.dlpay.mainservice.domain.TCustomer;

 

 import java.util.List;

@@ -17,4 +19,6 @@
 

     public TCustomerInfo getTCustomerByExcel(String cardno);

 

+    public PageResult<TCustomerInfo> getCustomerInfoPage(CustomerSearchBean param);

+

 }

diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
index 4a37d73..59ac60a 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/dao/impl/CustomerDaoImpl.java
@@ -1,9 +1,13 @@
 package com.supwisdom.dlpay.mainservice.dao.impl;

 

+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;

 import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;

+import com.supwisdom.dlpay.framework.util.PageResult;

 import com.supwisdom.dlpay.framework.util.StringUtil;

 import com.supwisdom.dlpay.mainservice.dao.CustomerDao;

 import com.supwisdom.dlpay.mainservice.domain.TCustomer;

+import org.hibernate.query.internal.NativeQueryImpl;

+import org.hibernate.transform.Transformers;

 import org.springframework.stereotype.Repository;

 import org.springframework.transaction.annotation.Transactional;

 

@@ -11,6 +15,7 @@
 import javax.persistence.PersistenceContext;

 import javax.persistence.Query;

 import javax.persistence.TypedQuery;

+import java.math.BigInteger;

 import java.util.List;

 

 @Repository

@@ -90,6 +95,38 @@
 

     @Transactional

     @Override

+    public PageResult<TCustomerInfo> getCustomerInfoPage(CustomerSearchBean param) {

+

+        String perName=param.getCustname();

+        String sql = "select a.custid,a.custname,a.deptcode,a.custtypeid,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' ";

+        String countSql = "select count(*) as cnt 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(perName)){

+            sql += " and a.custname like :perName ";

+            countSql += " and a.custname like :perName ";

+        }

+        sql +=" order by b.cardno desc ";

+

+

+        Query query = entityManager.createNativeQuery(sql);

+        Query countQuery = entityManager.createNativeQuery(countSql);

+        if (!StringUtil.isEmpty(perName)){

+            query.setParameter("perName", "%"+perName+"%");

+            countQuery.setParameter("perName", "%"+perName+"%");

+        }

+        query.setFirstResult((param.getPageNo() - 1) * param.getPageSize());

+        query.setMaxResults(param.getPageSize()); //分页显示

+

+        query.unwrap(NativeQueryImpl.class).setResultTransformer(Transformers.aliasToBean(TCustomerInfo.class));

+        List<TCustomerInfo> list = query.getResultList();

+        BigInteger count = (BigInteger) countQuery.getSingleResult();

+        return new PageResult<>(count.longValue(), list);

+    }

+

+    @Transactional

+    @Override

     public TCustomerInfo getTCustomerByExcel(String cardno) {

         String sql = "select a.custid,a.custname,b.cardno,b.bankcardno,b.cardphyid,b.expiredate from t_customer a,t_card b  " +

                 " where a.custid = b.custid and b.status = 'normal' and b.transtatus='normal' and cardno=?1 ";

diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java b/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
index 6675db4..ec8c6ce 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/service/WebInterfaceService.java
@@ -1,6 +1,10 @@
 package com.supwisdom.dlpay.mainservice.service;

 

+import com.supwisdom.dlpay.api.bean.UserInforResponse;

+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;

+import com.supwisdom.dlpay.doorlist.bean.CustomerListBean;

 import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;

+import com.supwisdom.dlpay.framework.util.PageResult;

 import com.supwisdom.dlpay.mainservice.bean.TDoorcardlstInfo;

 import com.supwisdom.dlpay.mainservice.bean.TDoordtlInfo;

 import com.supwisdom.dlpay.mainservice.domain.TCard;

@@ -132,4 +136,11 @@
     //修改卡信息

     @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})

     public boolean updateCard(TCard bean);

-}

+

+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})

+    public void doSaveCustomerAndCard(String operid, String now, CustomerListBean list, UserInforResponse response) ;

+

+    @Transactional(propagation = Propagation.REQUIRED,rollbackFor = {Exception.class})

+    PageResult<TCustomerInfo> getCustomerInfoPage(CustomerSearchBean bean);

+

+    }

diff --git a/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java b/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
index 7d2b3c8..f40b40c 100644
--- a/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
+++ b/src/main/java/com/supwisdom/dlpay/mainservice/service/impl/WebInterfaceServiceImpl.java
@@ -1,6 +1,10 @@
 package com.supwisdom.dlpay.mainservice.service.impl;

 

+import com.supwisdom.dlpay.api.bean.UserInforResponse;

+import com.supwisdom.dlpay.customer.bean.CustomerSearchBean;

+import com.supwisdom.dlpay.doorlist.bean.CustomerListBean;

 import com.supwisdom.dlpay.doorlist.bean.TCustomerInfo;

+import com.supwisdom.dlpay.framework.util.PageResult;

 import com.supwisdom.dlpay.mainservice.bean.TDoorcardlstInfo;

 import com.supwisdom.dlpay.mainservice.bean.TDoordtlInfo;

 import com.supwisdom.dlpay.mainservice.dao.*;

@@ -8,7 +12,9 @@
 import com.supwisdom.dlpay.mainservice.domain.TCustomer;

 import com.supwisdom.dlpay.mainservice.domain.TKey;

 import com.supwisdom.dlpay.mainservice.service.WebInterfaceService;

+import com.supwisdom.dlpay.system.domain.TDept;

 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;

 

@@ -26,6 +32,8 @@
     CustomerDao customerDao;

     @Autowired

     CardDao cardDao;

+    @Autowired

+    private SystemService systemService;

 

     @Override

     public List<TKey> getAllKeys() throws Exception {

@@ -144,4 +152,92 @@
     public boolean updateCard(TCard bean) {

         return cardDao.updateCard(bean);

     }

+

+    @Override

+    public void doSaveCustomerAndCard(String operid, String now, CustomerListBean list,  UserInforResponse response) {

+

+        String deptcode=list.getDeptno();

+        TDept dept=systemService.getDeptByDeptno(list.getDeptno());

+        if(null!=dept){

+            deptcode=dept.getDeptcode();

+        }

+

+        TCustomer customer = findCustomerById(response.getUserid());

+        if (customer != null) {//此用户已存在

+            TCard card = findCardByCustid(customer.getCustid());

+

+            customer.setStatus(customer.getStatus());

+            customer.setCustname(response.getUsername());

+//            customer.setSex(list.getSex());

+//            customer.setEmail(list.getEmail());

+//            customer.setMobile(list.getMobile());

+//            customer.setAddr(list.getAddr());

+            customer.setClosedate(response.getExpiredate());

+            customer.setLastsavedtime(now);

+            customer.setAddoperid(operid);

+            customer.setRemark(list.getRemarks());

+            customer.setDeptcode(deptcode);

+            customer.setCusttypeid(list.getCusttypeid());

+            saveCustomer(customer);

+

+            //一个用户可能会有多个卡,补办新卡新增一条信息

+            if (card != null) {

+                card.setCardphyid(response.getCardphyid());

+                card.setExpiredate(response.getExpiredate());

+                card.setStatus(response.getCardstatus());

+                card.setTranstatus(response.getTransstatus());

+                card.setCardverno(Integer.parseInt(card.getCardverno()) + 1 + "");

+                card.setLastsavedtime(now);

+                saveCard(card);

+            } else {

+                TCard cardTmp = new TCard();

+                cardTmp.setCardno(list.getCardno());

+                cardTmp.setBankcardno(response.getBankcardno());

+                cardTmp.setCustid(response.getUserid());

+                cardTmp.setCardphyid(response.getCardphyid());

+                cardTmp.setExpiredate(response.getExpiredate());

+                cardTmp.setStatus(response.getCardstatus());

+                cardTmp.setTranstatus(response.getTransstatus());

+                cardTmp.setCardverno("1");

+                cardTmp.setLastsavedtime(now);

+                saveCard(cardTmp);

+            }

+

+        } else {

+            TCustomer customerTmp = new TCustomer();

+            customerTmp.setCustid(response.getUserid());

+            customerTmp.setStatus("1");

+            customerTmp.setCustname(response.getUsername());

+//            customerTmp.setSex(list.getSex());

+//            customerTmp.setEmail(list.getEmail());

+//            customerTmp.setMobile(list.getMobile());

+//            customerTmp.setAddr(list.getAddr());

+            customerTmp.setOpendate(now.substring(0, 8));

+            customerTmp.setClosedate(response.getExpiredate());

+            customerTmp.setLastsavedtime(now);

+            customerTmp.setAddoperid(operid);

+            customerTmp.setRemark(list.getRemarks());

+            customer.setDeptcode(deptcode);

+            customer.setCusttypeid(list.getCusttypeid());

+            saveCustomer(customerTmp);

+

+            TCard cardTmp = new TCard();

+            cardTmp.setCardno(list.getCardno());

+            cardTmp.setBankcardno(response.getBankcardno());

+            cardTmp.setCustid(customerTmp.getCustid());

+            cardTmp.setCardphyid(response.getCardphyid());

+            cardTmp.setExpiredate(response.getExpiredate());

+            cardTmp.setStatus(response.getCardstatus());

+            cardTmp.setTranstatus(response.getTransstatus());

+            cardTmp.setCardverno("1");

+            cardTmp.setLastsavedtime(now);

+            //cardTmp.setBankcardno(response.getBankcardno());

+            saveCard(cardTmp);

+        }

+    }

+

+    @Override

+    public PageResult<TCustomerInfo> getCustomerInfoPage(CustomerSearchBean bean){

+        return customerDao.getCustomerInfoPage(bean);

+    }

 }

diff --git a/src/main/resources/templates/doorlist/customer/index.html b/src/main/resources/templates/doorlist/customer/index.html
new file mode 100644
index 0000000..29dce7b
--- /dev/null
+++ b/src/main/resources/templates/doorlist/customer/index.html
@@ -0,0 +1,182 @@
+<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 class="layui-form toolbar">
+            搜索:
+            <input id="customer-search-value" class="layui-input search-input" type="text" placeholder="输入姓名"/>&emsp;
+            <button id="customer-btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon">&#xe615;</i>搜索
+            </button>
+            <button id="customer-btn-add" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加人员</button>
+           <!-- <button id="customer-btn-import" class="layui-btn icon-btn" ><i class="layui-icon"></i>批量导入</button>-->
+          <!--  <a id="customer-btn-export" href="javascript:void(0);" class="layui-btn layui-btn-primary" >导出</a>-->
+        </div>
+        <table class="layui-table" id="customer-table" lay-filter="customer-table"></table>
+    </div>
+</div>
+<input hidden th:value="${custtypelist}" id="custtypelist">
+<input hidden th:value="${deptlist}" id="deptlist">
+<script>
+
+    var ctlist=$("#custtypelist").val();
+    var custtypelist=JSON.parse(ctlist);
+    var dplist=$("#deptlist").val();
+    var deptlist=JSON.parse(dplist);
+    layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+        let form = layui.form;
+        let table = layui.table;
+        let admin = layui.admin;
+
+        form.render('select');
+
+        // 渲染表格
+        table.render({
+            elem: '#customer-table',
+            url: '[[@{/customer/list}]]',
+            page: true,
+            minWidth: 80,
+            cols: [
+                [
+                    {field: 'custname', sort: true, width: 120, title: '客户姓名'},
+                    {field: 'cardno', sort: true,width: 120, title: '市名卡号'},
+                    {field: 'phone',  title: '联系电话'},
+                    {field: 'bankcardno', sort: true, width: 200, title: '银行卡号'},
+                    /*{
+                        field: 'checkstatus', title: '审核状态', align: 'center', width: 120, sort: true, templet: function (d) {
+                            if ('uncheck' == d.checkstatus) {
+                                return '<span class="layui-badge layui-bg-orange">待审核</span>'
+                            } else if ('normal' == d.checkstatus) {
+                                return '<span class="layui-badge layui-bg-green">成功</span>';
+                            } else if ('fail' == d.checkstatus) {
+                                return '<span class="layui-badge layui-bg-gray">失败</span>';
+                            } else {
+                                return d.checkstatus;
+                            }
+                        }
+                    },*/
+                    {
+                        field: 'deptcode',
+                        title: '部门',
+                        sort: true,
+                        align: 'center',
+                        templet: function (item) {
+                            console.log(deptlist);
+                            for(var i=0 ;i<deptlist.length;i++){
+                                if(item.deptcode==deptlist[i].deptcode){
+                                    return deptlist[i].deptname;
+                                }
+                            }
+                            return item.deptno;
+                        }
+                    },
+                    {
+                        field: 'custtype', width:100, title: '人员类别', templet: function (item) {
+                            for(var i=0 ;i<custtypelist.length;i++){
+                                if(item.custtypeid==custtypelist[i].custtypeid){
+                                    return custtypelist[i].custtypename;
+                                }
+                            }
+                            return item.custtypeid;
+                        }
+                    },
+                    {
+                        field: 'custid', align: 'center',width:150, title: '操作', fixed: 'right', templet: function (item) {
+                            return ' <a class="layui-btn  layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> '+
+                                ' <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>';
+                        }
+                    }
+                ]
+            ]
+        });
+        $('#customer-btn-export').click(function () {
+            var url = '[[@{/customer/export}]]';
+            /* $("#form").attr("action",url);
+
+             $("#form").submit();*/
+
+            $("#customer-btn-export").attr("href", url );
+            $("#customer-btn-export")[0].click();
+        });
+        // 搜索按钮点击事件
+        $('#customer-btn-search').click(function () {
+            let key = $('#customer-search-value').val().trim();
+            table.reload('customer-table', {where: {searchkey: key}, page: {curr: 1}});
+        });
+        $('#customer-btn-add').click(function () {
+            showModel();
+        });
+       /* $('#customer-btn-import').click(function () {
+            showDownload();
+        });
+        let showDownload = function () {
+            let title ='导入';
+            admin.popupCenter({
+                title: title,
+                path: '[[@{/customer/loadimport}]]',
+                finish: function () {
+                    table.reload('customer-table', {});
+                }
+            });
+        };*/
+        let showModel = function (data) {
+            let title = data ? '修改人员信息' : '添加人员信息';
+            admin.putTempData('t_cus', data);
+            admin.popupCenter({
+                title: title,
+                path: '[[@{/customer/loadadd}]]',
+                finish: function () {
+                    table.reload('customer-table', {});
+                }
+            });
+        };
+
+
+        // 工具条点击事件
+        table.on('tool(customer-table)', function (obj) {
+            let data = obj.data;
+            let layEvent = obj.event;
+            console.log(data);
+            if (layEvent === 'edit') {
+                showModel(data);
+            } else if (layEvent === 'del') {
+                showDelete(data);
+            }
+        });
+        let showDelete = function (data) {
+            console.log(data);
+            layer.confirm('确定要删除吗?', function (i) {
+                layer.close(i);
+                layer.load(2);
+                let token = $("meta[name='_csrf_token']").attr("value");
+                admin.go('[[@{/customer/delete}]]', {
+                    custid: data.custid,
+                    _csrf: token
+                }, function (data) {
+                    console.log(data.code);
+                    layer.closeAll('loading');
+                    if (data.code == 200) {
+                        layer.msg(data.msg, {icon: 1});
+                    } else if (data.code == 401) {
+                        layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+                            location.replace('/login');
+                        }, 1000);
+                        return;
+                    } else {
+                        layer.msg(data.msg, {icon: 2});
+                    }
+                    table.reload('customer-table', {});
+                }, function (ret) {
+                    console.log(ret);
+                    layer.closeAll('loading');
+                    layer.msg('请求失败了,请稍后再试', {icon: 2});
+                });
+            });
+        };
+
+    });
+</script>