From 1a8973c9ce32617993ae1137ff399bff7e42b1ac Mon Sep 17 00:00:00 2001 From: qiurunze123 Date: Sat, 26 Jan 2019 23:45:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/geekq/admin/entity/Userinfo.java | 1 + .../service/impl/AccountServiceImpl.java | 51 +++++++++++++ .../impl/SystemDictionaryServiceImpl.java | 5 +- .../service/impl/SystemDictionaryUtil.java | 25 +++++++ .../applicationContext-dubbo-provider.xml | 6 ++ .../web/controller/PersonController.java | 6 +- .../interceptor/AddGlobalUtilInterceptor.java | 7 +- .../applicationContext-dubbo-consumer.xml | 6 ++ .../webapp/WEB-INF/views/common/head-tpl.ftl | 2 +- .../main/webapp/WEB-INF/views/personal.ftl | 75 +------------------ 10 files changed, 102 insertions(+), 82 deletions(-) create mode 100644 miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/AccountServiceImpl.java create mode 100644 miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryUtil.java diff --git a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Userinfo.java b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Userinfo.java index b915e94..1bb6b7b 100644 --- a/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Userinfo.java +++ b/miaosha-admin/miaosha-admin-api/src/main/java/com/geekq/admin/entity/Userinfo.java @@ -86,6 +86,7 @@ public class Userinfo extends BaseDomain { } public boolean getIsBindPhone() { + return BitStatesUtils.hasState(bitState, BitStatesUtils.OP_BIND_PHONE); } diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/AccountServiceImpl.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/AccountServiceImpl.java new file mode 100644 index 0000000..8ab7ad0 --- /dev/null +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/AccountServiceImpl.java @@ -0,0 +1,51 @@ +package com.geekq.admin.service.impl; + +import com.geekq.admin.entity.Account; +import com.geekq.admin.mapper.AccountMapper; +import com.geekq.admin.service.IAccountService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("accountServiceImpl") +public class AccountServiceImpl implements IAccountService { + + @Autowired + private AccountMapper accountMapper; + + @Override + public void update(Account account) { + int ret = accountMapper.updateByPrimaryKey(account); +// if (ret <= 0) { +// throw new RuntimeException("Account对象:" + account.getId() +// + " 乐观锁失败!"); +// } + } + + @Override + public Account get(Long id) { + Account account = accountMapper.selectByPrimaryKey(id); + if (!account.checkAbstractInfo()) { + throw new RuntimeException("账户信息被篡改:" + id); + } + return account; + } + + /** + * 重建account表的摘要信息 + */ + @Override + public void recreateAbstractInfo() { + List accounts = this.accountMapper.selectAll(); + for (Account account : accounts) { + this.accountMapper.updateByPrimaryKey(account); + } + } + + @Override + public List listAll() { + return this.accountMapper.selectAll(); + } + +} diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryServiceImpl.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryServiceImpl.java index 6422b90..943c36d 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryServiceImpl.java +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryServiceImpl.java @@ -12,10 +12,7 @@ import org.springframework.stereotype.Service; import java.util.List; -/** - * @author 邱润泽 - */ -@Service +@Service("iSystemDictionaryServiceImpl") public class SystemDictionaryServiceImpl implements ISystemDictionaryService { @Autowired private SystemDictionaryMapper systemDictionaryMapper; diff --git a/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryUtil.java b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryUtil.java new file mode 100644 index 0000000..d40a2db --- /dev/null +++ b/miaosha-admin/miaosha-admin-service/src/main/java/com/geekq/admin/service/impl/SystemDictionaryUtil.java @@ -0,0 +1,25 @@ +package com.geekq.admin.service.impl; + +import com.geekq.admin.entity.SystemDictionaryItem; +import com.geekq.admin.service.ISystemDictionaryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 数据字典工具类 + * @author Administrator + * + */ +@Component +public class SystemDictionaryUtil { + + @Autowired + private ISystemDictionaryService systemDictionaryService; + + public List list(String sn) { + return systemDictionaryService.queryBySn(sn); + } + +} diff --git a/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml b/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml index c4afc86..b77e571 100644 --- a/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml +++ b/miaosha-admin/miaosha-admin-service/src/main/resources/spring/applicationContext-dubbo-provider.xml @@ -27,4 +27,10 @@ + + + + diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PersonController.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PersonController.java index 7c3c51f..dbbcc14 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PersonController.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/controller/PersonController.java @@ -20,6 +20,8 @@ public class PersonController extends BaseController { @Autowired private IAccountService accountService; + + @Autowired private RedisCacheStorageService redisService; @@ -29,7 +31,9 @@ public class PersonController extends BaseController { //从中拿到 用户信息对象 Logininfo info = redisService.get("Loginqiurunze11"); model.addAttribute("userinfo", userinfoService.get(info.getId())); -// model.addAttribute("account", accountService.get(info.getId())); + model.addAttribute("account", accountService.get(info.getId())); + model.addAttribute("logininfo", info); + return "personal"; } } diff --git a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/AddGlobalUtilInterceptor.java b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/AddGlobalUtilInterceptor.java index 1738e25..9b2904f 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/AddGlobalUtilInterceptor.java +++ b/miaosha-admin/miaosha-admin-web/src/main/java/com/geekq/web/interceptor/AddGlobalUtilInterceptor.java @@ -1,5 +1,6 @@ package com.geekq.web.interceptor; +import com.geekq.admin.service.impl.SystemDictionaryUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; @@ -9,17 +10,15 @@ import javax.servlet.http.HttpServletResponse; public class AddGlobalUtilInterceptor extends HandlerInterceptorAdapter { -/* @Autowired - private SystemDictionaryUtil systemDicUtil;*/ + @Autowired + private SystemDictionaryUtil systemDicUtil; @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if (modelAndView != null) { -/* modelAndView.addObject("_DicUtil", systemDicUtil); -*/ } super.postHandle(request, response, handler, modelAndView); } diff --git a/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml b/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml index 75f7a8b..c173b97 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml +++ b/miaosha-admin/miaosha-admin-web/src/main/resources/spring/applicationContext-dubbo-consumer.xml @@ -28,4 +28,10 @@ + + + + diff --git a/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/common/head-tpl.ftl b/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/common/head-tpl.ftl index 0de2769..26f0129 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/common/head-tpl.ftl +++ b/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/common/head-tpl.ftl @@ -8,7 +8,7 @@ <#else>
  • - ${logininfo.username} + ${logininfo.nickname}
  • diff --git a/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/personal.ftl b/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/personal.ftl index 5caa943..0041fa0 100644 --- a/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/personal.ftl +++ b/miaosha-admin/miaosha-admin-web/src/main/webapp/WEB-INF/views/personal.ftl @@ -9,76 +9,7 @@ @@ -105,7 +36,7 @@
    -

    用户名:${logininfo.username}

    +

    用户名:${logininfo.nickname}

    最后登录时间:2015-01-25 15:30:10

    @@ -167,7 +98,7 @@
    - + _DicUtil
    手机认证