From: qiaowei Date: Wed, 22 May 2019 01:09:08 +0000 (+0800) Subject: 用户中心 X-Git-Tag: 1.0.0^2~207 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=b11a4a890475c3f72a1a7626fd20fabf6ae3a4e3;p=epayment%2Ffood_payapi.git 用户中心 --- diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java index 733a6c2a..0f7265e2 100644 --- a/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java +++ b/src/main/java/com/supwisdom/dlpay/api/dao/AccountDao.java @@ -5,6 +5,11 @@ import com.supwisdom.dlpay.api.repositories.TAccountRepository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.*; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Lock; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.jpa.repository.QueryHints; +import org.springframework.data.repository.query.Param; import javax.persistence.LockModeType; import javax.persistence.QueryHint; @@ -34,5 +39,6 @@ public interface AccountDao extends JpaRepository, TAccountRep @Query("select a from TAccount a where a.userid = ?1 and a.subjno=?2") TAccount findByUseridAndSubjno(String userid, String subjno); - Page findAllByAccnameContaining(String accname, Pageable pageable); + @Query("select a from TAccount a where a.person.name like CONCAT('%',:accname,'%') ") + Page findAllByAccnameContaining(@Param("accname") String accname, Pageable pageable); } diff --git a/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java b/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java index aba2853b..96940b93 100644 --- a/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java +++ b/src/main/java/com/supwisdom/dlpay/api/dao/PointsAccountDao.java @@ -1,10 +1,18 @@ package com.supwisdom.dlpay.api.dao; import com.supwisdom.dlpay.api.domain.TPointsAccount; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; @Repository public interface PointsAccountDao extends JpaRepository { TPointsAccount findByUserid(String userid); + + @Query("select a from TPointsAccount a where a.person.name like CONCAT('%',:name,'%') ") + Page findAllByNameContaining(@Param("name") String name, Pageable pageable); + } diff --git a/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java b/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java index 1fda8a1a..d19e905e 100644 --- a/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java +++ b/src/main/java/com/supwisdom/dlpay/api/domain/TPointsAccount.java @@ -1,10 +1,8 @@ package com.supwisdom.dlpay.api.domain; import com.supwisdom.dlpay.framework.util.MD5; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; + +import javax.persistence.*; /** * 积分账户表 @@ -31,6 +29,18 @@ public class TPointsAccount { @Column(name = "LASTSAVED", precision = 15) private String lastsaved; + @OneToOne + @JoinColumn(name = "USERID",insertable = false,updatable = false) + private TPerson person; + + public TPerson getPerson() { + return person; + } + + public void setPerson(TPerson person) { + this.person = person; + } + public TPointsAccount() { } diff --git a/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java b/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java new file mode 100644 index 00000000..d7ac7849 --- /dev/null +++ b/src/main/java/com/supwisdom/dlpay/system/bean/IdTypeBean.java @@ -0,0 +1,27 @@ +package com.supwisdom.dlpay.system.bean; + +public class IdTypeBean { + private String idtype; + private String typename; + + public IdTypeBean(String idtype,String typename){ + this.idtype = idtype; + this.typename = typename; + } + + public String getIdtype() { + return idtype; + } + + public void setIdtype(String idtype) { + this.idtype = idtype; + } + + public String getTypename() { + return typename; + } + + public void setTypename(String typename) { + this.typename = typename; + } +} diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java b/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java index e8e4eb7d..584953c5 100644 --- a/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java +++ b/src/main/java/com/supwisdom/dlpay/system/controller/RoleController.java @@ -44,7 +44,6 @@ public class RoleController { } @GetMapping("/role/loadadd") - @PreAuthorize("hasPermission('/role/loadadd','')") public String loadadd() { return "system/role/form"; } diff --git a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java index 718fa533..a39aa521 100644 --- a/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java +++ b/src/main/java/com/supwisdom/dlpay/system/controller/UserController.java @@ -1,17 +1,25 @@ package com.supwisdom.dlpay.system.controller; +import com.supwisdom.dlpay.api.bean.JsonResult; import com.supwisdom.dlpay.api.domain.TAccount; import com.supwisdom.dlpay.api.domain.TPerson; +import com.supwisdom.dlpay.api.domain.TPersonIdentity; +import com.supwisdom.dlpay.api.domain.TPointsAccount; +import com.supwisdom.dlpay.framework.domain.TOperator; import com.supwisdom.dlpay.framework.util.PageResult; +import com.supwisdom.dlpay.framework.util.StringUtil; import com.supwisdom.dlpay.framework.util.WebConstant; +import com.supwisdom.dlpay.system.bean.IdTypeBean; import com.supwisdom.dlpay.system.bean.PersonParamBean; import com.supwisdom.dlpay.system.service.UserDataService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; @Controller public class UserController { @@ -19,9 +27,10 @@ public class UserController { private UserDataService userDataService; @GetMapping("/user/index") - public String sysparaView() { + public String index() { return "system/user/index"; } + @GetMapping("/user/list") @PreAuthorize("hasPermission('/user/list','')") @ResponseBody @@ -41,6 +50,44 @@ public class UserController { return new PageResult<>(99, "系统查询错误"); } } + + @GetMapping("/user/loadadd") + public String add(ModelMap map) { + List list = new ArrayList<>(); + list.add(new IdTypeBean("1", "身份证")); + list.add(new IdTypeBean("2", "护照")); + list.add(new IdTypeBean("3", "驾照")); + list.add(new IdTypeBean("4", "港澳通行证")); + list.add(new IdTypeBean("5", "学工号")); + list.add(new IdTypeBean("9", "其他")); + map.put("idtypes", list); + return "system/user/add"; + } + + @PostMapping("/user/add") + @PreAuthorize("hasPermission('/user/add','')") + @ResponseBody + public JsonResult add(@RequestBody TPerson person) { + if (StringUtil.isEmpty(person.getName()) + || StringUtil.isEmpty(person.getSex()) + || StringUtil.isEmpty(person.getIdno()) + || StringUtil.isEmpty(person.getIdtype()) + || StringUtil.isEmpty(person.getMobile())) { + return JsonResult.error("参数错误"); + } + return userDataService.saveUser(person); + } + + @PostMapping("/user/del") + @PreAuthorize("hasPermission('/user/del','')") + @ResponseBody + public JsonResult del(@RequestParam String userid) { + if (StringUtil.isEmpty(userid)) { + return JsonResult.error("参数错误"); + } + return userDataService.deleteUser(userid); + } + @GetMapping("/user/acc") public String acc() { return "system/user/account"; @@ -65,4 +112,53 @@ public class UserController { return new PageResult<>(99, "系统查询错误"); } } + + @GetMapping("/user/point") + public String point() { + return "system/user/point"; + } + + @GetMapping("/user/pointlist") + @PreAuthorize("hasPermission('/user/pointlist','')") + @ResponseBody + public PageResult getDataPointList(@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; + PersonParamBean searchBean = new PersonParamBean(); + searchBean.setPageNo(pageNo); + searchBean.setName(searchKey); + searchBean.setPageSize(pageSize); + return userDataService.getPointsByKey(searchBean); + } catch (Exception e) { + e.printStackTrace(); + return new PageResult<>(99, "系统查询错误"); + } + } + + @PostMapping("/user/delacc") + @PreAuthorize("hasPermission('/user/delacc','')") + @ResponseBody + public JsonResult delacc(@RequestParam String accno) { + if (StringUtil.isEmpty(accno)) { + return JsonResult.error("参数错误"); + } + return userDataService.closeAccount(accno); + } + @PostMapping("/user/delpoint") + @PreAuthorize("hasPermission('/user/delpoint','')") + @ResponseBody + public JsonResult delpoint(@RequestParam String userid) { + if (StringUtil.isEmpty(userid)) { + return JsonResult.error("参数错误"); + } + return userDataService.deletePoint(userid); + } + @GetMapping("/user/pointdtl") + public String pointdtl(@RequestParam String userid,ModelMap map) { + map.put("userid",userid); + return "system/user/pointdtl"; + } } diff --git a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java index 34748c74..942196e3 100644 --- a/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java +++ b/src/main/java/com/supwisdom/dlpay/system/service/UserDataService.java @@ -1,12 +1,17 @@ package com.supwisdom.dlpay.system.service; +import com.supwisdom.dlpay.api.bean.JsonResult; import com.supwisdom.dlpay.api.domain.TAccount; import com.supwisdom.dlpay.api.domain.TPerson; +import com.supwisdom.dlpay.api.domain.TPersonIdentity; +import com.supwisdom.dlpay.api.domain.TPointsAccount; import com.supwisdom.dlpay.framework.util.PageResult; import com.supwisdom.dlpay.system.bean.PersonParamBean; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import java.util.List; + public interface UserDataService { @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) PageResult getPersonsByKey(PersonParamBean param); @@ -14,4 +19,24 @@ public interface UserDataService { @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) PageResult getAccountsByKey(PersonParamBean param); + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) + PageResult getPointsByKey(PersonParamBean param); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) + JsonResult saveUser(TPerson person); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) + JsonResult deleteUser(String userid); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) + JsonResult closeAccount(String accno); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) + JsonResult deletePoint(String userid); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) + List getPersonIdentity(String userid); + + @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class,readOnly = true) + PageResult getUserPointDTL(PersonParamBean param); } diff --git a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java index 315927fe..54694f56 100644 --- a/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java +++ b/src/main/java/com/supwisdom/dlpay/system/service/impl/UserDataServiceImpl.java @@ -1,11 +1,17 @@ package com.supwisdom.dlpay.system.service.impl; +import com.supwisdom.dlpay.api.bean.JsonResult; import com.supwisdom.dlpay.api.dao.AccountDao; import com.supwisdom.dlpay.api.dao.PersonDao; +import com.supwisdom.dlpay.api.dao.PersonIdentityDao; +import com.supwisdom.dlpay.api.dao.PointsAccountDao; import com.supwisdom.dlpay.api.domain.TAccount; import com.supwisdom.dlpay.api.domain.TPerson; -import com.supwisdom.dlpay.framework.util.PageResult; -import com.supwisdom.dlpay.framework.util.StringUtil; +import com.supwisdom.dlpay.api.domain.TPersonIdentity; +import com.supwisdom.dlpay.api.domain.TPointsAccount; +import com.supwisdom.dlpay.framework.data.SystemDateTime; +import com.supwisdom.dlpay.framework.service.SystemUtilService; +import com.supwisdom.dlpay.framework.util.*; import com.supwisdom.dlpay.system.bean.PersonParamBean; import com.supwisdom.dlpay.system.service.UserDataService; import org.springframework.beans.factory.annotation.Autowired; @@ -14,17 +20,26 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Optional; + @Service public class UserDataServiceImpl implements UserDataService { @Autowired private PersonDao personDao; @Autowired private AccountDao accountDao; + @Autowired + private PointsAccountDao pointsAccountDao; + @Autowired + private SystemUtilService systemUtilService; + @Autowired + private PersonIdentityDao personIdentityDao; @Override public PageResult getPersonsByKey(PersonParamBean param) { Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize() - , Sort.by(Sort.Direction.DESC,"lastsaved")); + , Sort.by(Sort.Direction.DESC, "lastsaved")); if (!StringUtil.isEmpty(param.getName())) { return new PageResult<>(personDao.findAllByNameContaining(param.getName(), pageable)); } @@ -39,4 +54,125 @@ public class UserDataServiceImpl implements UserDataService { } return new PageResult<>(accountDao.findAll(pageable)); } + + @Override + public PageResult getPointsByKey(PersonParamBean param) { + Pageable pageable = PageRequest.of(param.getPageNo() - 1, param.getPageSize()); + if (!StringUtil.isEmpty(param.getName())) { + return new PageResult<>(pointsAccountDao.findAllByNameContaining(param.getName(), pageable)); + } + return new PageResult<>(pointsAccountDao.findAll(pageable)); + } + + @Override + public JsonResult saveUser(TPerson person) { + if (!StringUtil.isEmpty(person.getUserid())) { + Optional temp = personDao.findById(person.getUserid()); + if (!temp.isPresent()) { + return JsonResult.error("参数错误"); + } + TPerson it = temp.get(); + if (!person.getIdno().equals(it.getIdno()) + || !person.getIdtype().equals(it.getIdtype())) { + TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno()); + if (has != null && !has.getUserid().equals(person.getUserid())) { + return JsonResult.error("证件类型、证件号已存在"); + } + } + if (!person.getName().equals(it.getName())) { + TAccount account = accountDao.findByUserid(person.getUserid()); + if (account != null) { + account.setAccname(person.getName()); + accountDao.save(account); + } + } + if (StringUtil.isEmpty(person.getStatus())) { + person.setStatus(TradeDict.STATUS_NORMAL); + } + personDao.save(person); + } else { + TPerson has = personDao.findByIdentity(person.getIdtype(), person.getIdno()); + if (has != null) { + return JsonResult.error("证件类型、证件号已存在"); + } + SystemDateTime systemDateTime = systemUtilService.getSysdatetime(); + person.setStatus(TradeDict.STATUS_NORMAL); + person.setLastsaved(systemDateTime.getHostdatetime()); + person = personDao.save(person); + + TAccount account = new TAccount(); + account.setAccname(person.getName()); + account.setSubjno(Subject.SUBJNO_PERSONAL_DEPOSIT); + account.setUserid(person.getUserid()); + account.setStatus(person.getStatus()); + account.setBalance(0.0); + account.setAvailbal(0.0); + account.setFrozebal(0.0); + account.setLowfreeFlag(false); + account.setMaxbal(systemUtilService.getSysparaValueAsDouble(SysparaUtil.SYSPARAID_NO1, SysparaUtil.SYSPARA_NO1_DEFAULT)); + account.setLasttransdate(systemDateTime.getHostdate()); + account.setLastdayDpsamt(0.0); + account.setLastdayTransamt(0.0); + account.setOpendate(systemDateTime.getHostdate()); + account.setTac(account.generateTac()); + accountDao.save(account); + } + return JsonResult.ok("添加成功"); + } + + @Override + public JsonResult deleteUser(String userid) { + TAccount account = accountDao.findByUserid(userid); + if (account != null) { + if (!TradeDict.STATUS_CLOSED.equals(account.getStatus()) && account.getBalance() != 0) { + return JsonResult.error("该用户账户未注销且余额不为0,无法删除"); + } else { + accountDao.delete(account); + } + } + TPointsAccount pointsAccount = pointsAccountDao.findByUserid(userid); + if (pointsAccount != null) { + if (pointsAccount.getPoints() != 0) { + return JsonResult.error("该用户账户积分不为0,无法删除,若要删除请先删除积分账户"); + } else { + pointsAccountDao.delete(pointsAccount); + } + } + personDao.deleteById(userid); + return JsonResult.ok("操作成功"); + } + + @Override + public JsonResult closeAccount(String accno) { + Optional opt = accountDao.findById(accno); + if (opt.isPresent()) { + TAccount acc = opt.get(); + acc.setStatus(TradeDict.STATUS_CLOSED); + accountDao.save(acc); + return JsonResult.ok("操作成功"); + } else { + return JsonResult.error("参数错误"); + } + } + + @Override + public JsonResult deletePoint(String userid) { + Optional pointsAccount = pointsAccountDao.findById(userid); + if (pointsAccount.isPresent()) { + pointsAccountDao.delete(pointsAccount.get()); + return JsonResult.ok("操作成功"); + }else { + return JsonResult.error("参数错误"); + } + } + + @Override + public List getPersonIdentity(String userid) { + return null; + } + + @Override + public PageResult getUserPointDTL(PersonParamBean param) { + return null; + } } diff --git a/src/main/resources/templates/system/function/index.html b/src/main/resources/templates/system/function/index.html index 3696dc7f..4071d7dd 100755 --- a/src/main/resources/templates/system/function/index.html +++ b/src/main/resources/templates/system/function/index.html @@ -10,9 +10,9 @@
搜索:   - - +
@@ -71,11 +71,11 @@ ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { + $('#btn-search-func').click(function () { let key = $('#search-value').val(); table.reload('table', {where: {searchkey: key}, page: {curr: 1}}); }); - $('#btn-add').click(function () { + $('#btn-add-func').click(function () { showModel(); }); let showModel = function (data) { diff --git a/src/main/resources/templates/system/param/paytype.html b/src/main/resources/templates/system/param/paytype.html index 63a0ceeb..f7909f49 100644 --- a/src/main/resources/templates/system/param/paytype.html +++ b/src/main/resources/templates/system/param/paytype.html @@ -11,11 +11,11 @@ 搜索: - - -
@@ -105,12 +105,12 @@ ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { + $('#btn-search-param').click(function () { var paytype = $("#search-paytype").val(); table.reload('paytypeTable', {where: {paytype: paytype}, page: {curr: 1}}); }); - $('#btn-add').click(function () { + $('#btn-add-param').click(function () { admin.popupCenter({ title: "新增支付能力", path: '/param/load4addpaytype', @@ -120,7 +120,7 @@ }); }); - $('#btn-reset').click(function () { + $('#btn-reset-param').click(function () { $("#search-paytypeTable").val(""); }); diff --git a/src/main/resources/templates/system/param/syspara.html b/src/main/resources/templates/system/param/syspara.html index ae17c1d1..79d94ec8 100644 --- a/src/main/resources/templates/system/param/syspara.html +++ b/src/main/resources/templates/system/param/syspara.html @@ -11,9 +11,9 @@ 搜索:   - - +
@@ -50,7 +50,7 @@ ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { + $('#btn-search-sysparam').click(function () { var paraid = $("#search-paraid").val(); var paraname = $("#search-paraname").val(); if (null != paraid && paraid.length > 0 && !(/^\d+$/.test(paraid))) { @@ -60,7 +60,7 @@ } }); - $('#btn-reset').click(function () { + $('#btn-reset-sysparam').click(function () { $("#search-paraid").val(""); $("#search-paraname").val(""); }); diff --git a/src/main/resources/templates/system/role/index.html b/src/main/resources/templates/system/role/index.html index e2208e08..029e3ef8 100644 --- a/src/main/resources/templates/system/role/index.html +++ b/src/main/resources/templates/system/role/index.html @@ -10,9 +10,9 @@
搜索:   - - +
@@ -48,11 +48,11 @@ ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { + $('#btn-search-role').click(function () { let key = $('#search-value').val(); table.reload('roletable', {where: {searchkey: key}, page: {curr: 1}}); }); - $('#btn-add').click(function () { + $('#btn-add-role').click(function () { showModel(); }); let showModel = function (data) { diff --git a/src/main/resources/templates/system/user/account.html b/src/main/resources/templates/system/user/account.html index bd23479b..2475cf9c 100644 --- a/src/main/resources/templates/system/user/account.html +++ b/src/main/resources/templates/system/user/account.html @@ -9,8 +9,8 @@
搜索: -   -
@@ -31,15 +31,18 @@ [ {field: 'accno', title: '账号',fixed: 'left', width: 100}, {field: 'person', title: '名称', width: 80,fixed: 'left', sort: true, templet: function (item) { + if(item.accname!=null){ + return item.accname; + } return item.person.name; - }}, + }}, {field: 'status', title: '状态',fixed: 'left',width: 80 , templet: function (item) { if (item.status == 'normal') { - return '正常' + return '正常' } else if (item.status == 'closed') { - return '注销' + return '注销' } else if (item.status == 'locked') { - return '锁定' + return '锁定' } else { return '异常' } @@ -51,42 +54,23 @@ {field: 'lasttransdate', title: '最后交易日期', width: 120,fixed: 'left', sort: true}, {field: 'opendate', title: '开户日期', width: 100,fixed: 'left', sort: true}, { - field: 'userid', align: 'center', title: '操作', fixed: 'right', templet: function (item) { - let html = ' 初始化支付密码 '; - html += ' 初始化登录密码 '; - return html; + field: 'accno', align: 'center', title: '操作', fixed: 'right', templet: function (item) { + if (item.status != 'closed') { + let html = ' 注销 '; + return html; + }else { + return ''; + } } } ] ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { - let key = $('#search-value').val(); - table.reload('roletable', {where: {searchkey: key}, page: {curr: 1}}); - }); - $('#btn-add').click(function () { - showModel(); + $('#btn-search-account').click(function () { + let key = $('#search-value-account').val(); + table.reload('accounttable', {where: {searchkey: key}, page: {curr: 1}}); }); - let showModel = function (data) { - let title = data ? '编辑角色' : '添加角色'; - admin.putTempData('t_func', data); - admin.popupCenter({ - title: title, - path: '/role/loadadd', - finish: function () { - table.reload('roletable', {}); - } - }); - }; - let showFuncModel = function (data) { - let title = '分配功能'; - admin.putTempData('roleId', data.roleId); - admin.popupCenter({ - title: title, - path: '/role/loadfunc' - }); - }; // 工具条点击事件 table.on('tool(accounttable)', function (obj) { let data = obj.data; @@ -94,19 +78,17 @@ console.log(data); if (layEvent === 'edit') { showModel(data); - } else if (layEvent === 'addfunc') { - showFuncModel(data); } else if (layEvent === 'del') { showDelete(data); } }); let showDelete = function (data) { - layer.confirm('用户分配的该角色都将被删除,确定删除吗?', function (i) { + layer.confirm('确定注销账户吗,注销后该用户将无法使用余额?', function (i) { layer.close(i); layer.load(2); let token = $("meta[name='_csrf_token']").attr("value"); - admin.go('/role/del', { - roleid: data.roleId, + admin.go('/user/delacc', { + accno: data.accno, _csrf: token }, function (data) { console.log(data.code); @@ -121,11 +103,15 @@ } else { layer.msg(data.msg, {icon: 2}); } - table.reload('roletable', {}); + table.reload('accounttable', {}); }, function (ret) { console.log(ret); layer.closeAll('loading'); - layer.msg('请求失败了,请稍后再试', {icon: 2}); + if(ret.status==403){ + layer.msg('没有权限', {icon: 2}); + }else{ + layer.msg('请求失败了,请稍后再试', {icon: 2}); + } }); }); } diff --git a/src/main/resources/templates/system/user/add.html b/src/main/resources/templates/system/user/add.html new file mode 100755 index 00000000..d2893e6d --- /dev/null +++ b/src/main/resources/templates/system/user/add.html @@ -0,0 +1,110 @@ + +
+ +
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/system/user/bind.html b/src/main/resources/templates/system/user/bind.html new file mode 100755 index 00000000..dd5561e2 --- /dev/null +++ b/src/main/resources/templates/system/user/bind.html @@ -0,0 +1,76 @@ +
+ +
+ +
+ diff --git a/src/main/resources/templates/system/user/index.html b/src/main/resources/templates/system/user/index.html index e2a49210..3a9d6fac 100644 --- a/src/main/resources/templates/system/user/index.html +++ b/src/main/resources/templates/system/user/index.html @@ -9,10 +9,10 @@
搜索: -   - - +
@@ -31,14 +31,23 @@ cols: [ [ {field: 'name', title: '名称', width: 80,fixed: 'left', sort: true}, - {field: 'sex', title: '性别',fixed: 'left', width: 80}, + {field: 'sex', title: '性别',fixed: 'left', width: 80, templet: function (item) { + if (item.sex == 'male') { + return '男' + } else if (item.sex == 'female') { + return '女' + } else { + return '男' + } + } + }, {field: 'status', title: '状态',fixed: 'left',width: 80 , templet: function (item) { if (item.status == 'normal') { - return '正常' + return '正常' } else if (item.status == 'closed') { - return '注销' + return '注销' } else if (item.status == 'locked') { - return '锁定' + return '锁定' } else { return '异常' } @@ -61,19 +70,16 @@ } }, {field: 'idno', title: '证件号', width: 120,fixed: 'left', sort: true}, - {field: 'country', title: '国籍', width: 100,fixed: 'left', sort: true}, - {field: 'nation', title: '民族', width: 100,fixed: 'left', sort: true}, {field: 'email', title: '邮箱', width: 100,fixed: 'left', sort: true}, - {field: 'mobile', title: '手机', width: 100,fixed: 'left', sort: true}, + {field: 'mobile', title: '手机', width: 120,fixed: 'left', sort: true}, {field: 'tel', title: '电话', width: 100,fixed: 'left', sort: true}, - {field: 'addr', title: '地址', width: 100,fixed: 'left', sort: true}, - {field: 'zipcode', title: '邮编', width: 100,fixed: 'left', sort: true}, - {field: 'lastsaved', title: '最后修改时间', width: 120,fixed: 'left', sort: true}, + {field: 'addr', title: '地址', width: 200,fixed: 'left', sort: true}, + {field: 'lastsaved', title: '最后修改时间', width: 140,fixed: 'left', sort: true}, { field: 'userid', align: 'center', title: '操作', fixed: 'right', templet: function (item) { let html = ' 编辑 '; - html += ' 绑定关系 '; html +='删除'; + /*html += '交易记录 ';*/ return html; } } @@ -81,52 +87,43 @@ ] }); // 搜索按钮点击事件 - $('#btn-search').click(function () { - let key = $('#search-value').val(); - table.reload('roletable', {where: {searchkey: key}, page: {curr: 1}}); + $('#btn-search-user').click(function () { + let key = $('#search-value-user').val(); + table.reload('usertable', {where: {searchkey: key}, page: {curr: 1}}); }); - $('#btn-add').click(function () { + $('#btn-add-user').click(function () { showModel(); }); let showModel = function (data) { - let title = data ? '编辑角色' : '添加角色'; - admin.putTempData('t_func', data); + let title = data ? '编辑用户' : '添加用户'; + admin.putTempData('t_bean', data); admin.popupCenter({ title: title, - path: '/role/loadadd', + path: '/user/loadadd', finish: function () { - table.reload('roletable', {}); + table.reload('usertable', {}); } }); }; - let showFuncModel = function (data) { - let title = '分配功能'; - admin.putTempData('roleId', data.roleId); - admin.popupCenter({ - title: title, - path: '/role/loadfunc' - }); - }; // 工具条点击事件 table.on('tool(usertable)', function (obj) { let data = obj.data; let layEvent = obj.event; - console.log(data); if (layEvent === 'edit') { showModel(data); - } else if (layEvent === 'addfunc') { - showFuncModel(data); + } else if (layEvent === 'other') { + showOtherModel(data); } else if (layEvent === 'del') { showDelete(data); } }); let showDelete = function (data) { - layer.confirm('用户分配的该角色都将被删除,确定删除吗?', function (i) { + layer.confirm('确定删除该用户吗?', function (i) { layer.close(i); layer.load(2); let token = $("meta[name='_csrf_token']").attr("value"); - admin.go('/role/del', { - roleid: data.roleId, + admin.go('/user/del', { + userid: data.userid, _csrf: token }, function (data) { console.log(data.code); @@ -141,11 +138,15 @@ } else { layer.msg(data.msg, {icon: 2}); } - table.reload('roletable', {}); + table.reload('usertable', {}); }, function (ret) { console.log(ret); layer.closeAll('loading'); - layer.msg('请求失败了,请稍后再试', {icon: 2}); + if(ret.status==403){ + layer.msg('没有权限', {icon: 2}); + }else{ + layer.msg('请求失败了,请稍后再试', {icon: 2}); + } }); }); } diff --git a/src/main/resources/templates/system/user/point.html b/src/main/resources/templates/system/user/point.html new file mode 100644 index 00000000..036815c0 --- /dev/null +++ b/src/main/resources/templates/system/user/point.html @@ -0,0 +1,96 @@ +
+
+

积分管理

+ + 用户中心 + 积分管理 + +
+
+
+ 搜索: +   + +
+
+
+
+ \ No newline at end of file diff --git a/src/main/resources/templates/system/user/pointdtl.html b/src/main/resources/templates/system/user/pointdtl.html new file mode 100644 index 00000000..522063b3 --- /dev/null +++ b/src/main/resources/templates/system/user/pointdtl.html @@ -0,0 +1,97 @@ +
+
+

积分交易记录

+ + 用户中心 + 积分交易记录 + +
+
+
+ 搜索: +   + +
+
+
+ +
+ \ No newline at end of file