device offline

master
wangning 7 years ago
parent 9b7c6ab014
commit 58f40e8248

@ -38,5 +38,7 @@ public interface ClientDeviceMapper {
@AutoSql(type = SqlType.INSERT) @AutoSql(type = SqlType.INSERT)
void save(JSONObject devInfo); void save(JSONObject devInfo);
void updateOfflineDevice(@Param("client_id")int client_id,@Param("account_id")int account_id);
PageList<JSONObject> listDevices(JSONObject params, PageBounds pagination); PageList<JSONObject> listDevices(JSONObject params, PageBounds pagination);
} }

@ -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.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionManager; 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.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.ClientMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper; import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.OrgMapper; 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.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.locale.LocaleSupport; import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.utils.PasswordUtils; import au.com.royalpay.payment.tools.utils.PasswordUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.springframework.cache.annotation.CacheEvict; 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.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware; import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.thymeleaf.context.Context; import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine; import org.thymeleaf.spring4.SpringTemplateEngine;
import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Resource;
/** /**
* account service for sign in * account service for sign in
* Created by yixian on 2016-06-29. * Created by yixian on 2016-06-29.
@ -62,6 +67,8 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
private SpringTemplateEngine thymeleaf; private SpringTemplateEngine thymeleaf;
@Resource @Resource
private SignInStatusManager signInStatusManager; private SignInStatusManager signInStatusManager;
@Resource
private ClientDeviceMapper clientDeviceMapper;
private ApplicationEventPublisher publisher; private ApplicationEventPublisher publisher;
@Override @Override
@ -181,6 +188,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati
} }
@Override @Override
@Transactional
public void changeAccountPassword(JSONObject clientStatus, ChangePwdBean change) { public void changeAccountPassword(JSONObject clientStatus, ChangePwdBean change) {
JSONObject account = clientAccountMapper.findDetail(clientStatus.getString("account_id")); JSONObject account = clientAccountMapper.findDetail(clientStatus.getString("account_id"));
String salt = account.getString("salt"); 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("password_aes", PasswordUtils.encryptAESPwd(change.getPwd()));
account.put("is_password_expired", 0); account.put("is_password_expired", 0);
clientAccountMapper.update(account); clientAccountMapper.update(account);
clientDeviceMapper.updateOfflineDevice(clientStatus.getIntValue("client_id"),clientStatus.getIntValue("account_id"));
} }
@Override @Override

@ -48,4 +48,11 @@
<foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if> <foreach collection="org_ids" item="org_id" open="(" close=")" separator=",">#{org_id}</foreach></if>
</where> </where>
</select> </select>
<update id="updateOfflineDevice">
update sys_clients_devices
set is_offline = 1
where client_id = #{client_id}
and account_id = #{account_id}
</update>
</mapper> </mapper>
Loading…
Cancel
Save