yujian
2019-08-28 d88c167fc5973a2c15ff1539e4cdab36e4a7842c
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenHWServiceImpl.java
@@ -20,18 +20,18 @@
   private DeviceTokenHWMapper deviceTokenHWMapper;
   @Override
   public List<DeviceTokenHW> getDeviceTokenList(int page, int pageSize) {
      return deviceTokenHWMapper.selectList((page - 1) * pageSize, pageSize);
   public List<DeviceTokenHW> getDeviceTokenList(int page, int pageSize, List<Integer> versionList) {
      return deviceTokenHWMapper.selectList((page - 1) * pageSize, pageSize, versionList);
   }
   @Override
   public Long getDeviceTokenCount() {
      Long count = deviceTokenHWMapper.selectCount();
   public Long countDeviceToken(List<Integer> versionList) {
      Long count = deviceTokenHWMapper.selectCount(versionList);
      return count == null ? 0 : count;
   }
   @Override
   public void addDeviceToken(String token, String device, Long uid) {
   public void addDeviceToken(String token, String device, Long uid, int version) {
      if (StringUtil.isNullOrEmpty(device))
         return;
      //
@@ -43,6 +43,8 @@
         DeviceTokenHW deviceTokenHW = new DeviceTokenHW();
         deviceTokenHW.setDevice(device);
         deviceTokenHW.setDeviceToken(token);
         deviceTokenHW.setDeviceTokenMd5(StringUtil.Md5(token));
         deviceTokenHW.setVersion(version);
         deviceTokenHW.setUpdateTime(new Date());
         if (uid != null)
            deviceTokenHW.setUser(new UserInfo(uid));
@@ -51,8 +53,11 @@
         for (DeviceTokenHW deviceTokenHW : list) {
            DeviceTokenHW update = new DeviceTokenHW();
            update.setId(deviceTokenHW.getId());
            if (!StringUtil.isNullOrEmpty(token))
            if (!StringUtil.isNullOrEmpty(token)) {
               update.setDeviceToken(token);
               update.setDeviceTokenMd5(StringUtil.Md5(token));
               update.setVersion(version);
            }
            update.setUpdateTime(new Date());
            if (uid != null)
               update.setUser(new UserInfo(uid));
@@ -65,7 +70,7 @@
   public List<DeviceTokenHW> getDeviceTokenByUid(Long uid) {
      if (uid == null)
         return null;
      return deviceTokenHWMapper.selectByUid(uid);
      return deviceTokenHWMapper.selectByUid(uid, null);
   }
   @Override
@@ -80,4 +85,20 @@
      }
   }
   @Override
   public void bindUid(String device, Long uid) {
      deviceTokenHWMapper.bindUidByDevice(uid, device);
   }
   @Override
   public List<DeviceTokenHW> getDeviceTokenByUid(Long uid, List<Integer> versionList) {
      if (uid == null)
         return null;
      if (versionList != null && versionList.size() == 0)
         return null;
      return deviceTokenHWMapper.selectByUid(uid, versionList);
   }
}