diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.java index 1dc6105c5..549581ace 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.java @@ -38,5 +38,7 @@ public interface ClientDeviceMapper { @AutoSql(type = SqlType.INSERT) void save(JSONObject devInfo); + void updateOfflineDevice(@Param("client_id")int client_id,@Param("account_id")int account_id); + PageList listDevices(JSONObject params, PageBounds pagination); } diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java index b6a861943..c2256c7e2 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInAccountServiceImpl.java @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.signin.core.impls; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionManager; import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper; import au.com.royalpay.payment.manage.mappers.system.ClientMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.OrgMapper; @@ -20,7 +21,9 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.utils.PasswordUtils; + import com.alibaba.fastjson.JSONObject; + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; import org.springframework.cache.annotation.CacheEvict; @@ -28,16 +31,18 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; -import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.annotation.Resource; + /** * account service for sign in * Created by yixian on 2016-06-29. @@ -62,6 +67,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati private SpringTemplateEngine thymeleaf; @Resource private SignInStatusManager signInStatusManager; + @Resource + private ClientDeviceMapper clientDeviceMapper; private ApplicationEventPublisher publisher; @Override @@ -181,6 +188,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati } @Override + @Transactional public void changeAccountPassword(JSONObject clientStatus, ChangePwdBean change) { JSONObject account = clientAccountMapper.findDetail(clientStatus.getString("account_id")); String salt = account.getString("salt"); @@ -195,6 +203,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati account.put("password_aes", PasswordUtils.encryptAESPwd(change.getPwd())); account.put("is_password_expired", 0); clientAccountMapper.update(account); + clientDeviceMapper.updateOfflineDevice(clientStatus.getIntValue("client_id"),clientStatus.getIntValue("account_id")); } @Override diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.xml index e3b828184..f0e729707 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientDeviceMapper.xml @@ -48,4 +48,11 @@ #{org_id} + + + update sys_clients_devices + set is_offline = 1 + where client_id = #{client_id} + and account_id = #{account_id} + \ No newline at end of file