From 58f40e8248059d4145dac69b75fee1dfbd60ab46 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 2 Mar 2018 12:17:32 +0800 Subject: [PATCH 1/3] device offline --- .../manage/mappers/system/ClientDeviceMapper.java | 2 ++ .../signin/core/impls/SignInAccountServiceImpl.java | 11 ++++++++++- .../manage/mappers/system/ClientDeviceMapper.xml | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) 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 From 6b20fe43d6a526cede8936db0242d0f70ba7faf7 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Mon, 5 Mar 2018 15:15:31 +0800 Subject: [PATCH 2/3] device off line --- .../manage/device/core/DeviceManager.java | 2 + .../device/core/impls/DeviceManagerImp.java | 12 +++- .../mappers/system/ClientDeviceMapper.java | 4 +- .../core/impls/ClientManagerImpl.java | 62 +++++++++++++++---- .../core/impls/SignInAccountServiceImpl.java | 6 +- .../mappers/system/ClientDeviceMapper.xml | 8 +-- 6 files changed, 72 insertions(+), 22 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/device/core/DeviceManager.java b/src/main/java/au/com/royalpay/payment/manage/device/core/DeviceManager.java index 79e54c412..8f200db18 100644 --- a/src/main/java/au/com/royalpay/payment/manage/device/core/DeviceManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/device/core/DeviceManager.java @@ -14,5 +14,7 @@ public interface DeviceManager { void toggleDeviceAvailable(JSONObject manager, String devId, boolean enable); + void deviceOffline(String accountId); + JSONObject listDevOrders(JSONObject manager, String devId, TradeLogQuery query); } diff --git a/src/main/java/au/com/royalpay/payment/manage/device/core/impls/DeviceManagerImp.java b/src/main/java/au/com/royalpay/payment/manage/device/core/impls/DeviceManagerImp.java index 32f4a1fbb..c7e513220 100644 --- a/src/main/java/au/com/royalpay/payment/manage/device/core/impls/DeviceManagerImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/device/core/impls/DeviceManagerImp.java @@ -6,20 +6,23 @@ import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.mappers.payment.OrderMapper; import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper; import au.com.royalpay.payment.manage.merchants.core.ClientManager; -import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.manage.tradelog.beans.TradeLogQuery; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.utils.PageListUtils; + import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; + import org.springframework.stereotype.Service; import org.springframework.util.Assert; -import javax.annotation.Resource; import java.util.Arrays; +import javax.annotation.Resource; + import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission; /** @@ -93,6 +96,11 @@ public class DeviceManagerImp implements DeviceManager { clientDeviceMapper.update(device); } + @Override + public void deviceOffline(String accountId) { + clientDeviceMapper.deviceOffline(accountId); + } + @Override public JSONObject listDevOrders(JSONObject manager, String devId,TradeLogQuery query) { JSONObject device = clientDeviceMapper.find(devId); 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 549581ace..401a3a36c 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,7 +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); + + void deviceOffline(@Param("account_id") String accountId); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 13549bb38..f3486c157 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -11,11 +11,31 @@ import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; import au.com.royalpay.payment.core.utils.OrderExpiryRuleResolver; import au.com.royalpay.payment.manage.analysis.mappers.TransactionAnalysisMapper; import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; +import au.com.royalpay.payment.manage.device.core.DeviceManager; import au.com.royalpay.payment.manage.mappers.financial.FinancialBDConfigMapper; import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper; import au.com.royalpay.payment.manage.mappers.redpack.ActClientInvitationCodeMapper; -import au.com.royalpay.payment.manage.mappers.system.*; -import au.com.royalpay.payment.manage.merchants.beans.*; +import au.com.royalpay.payment.manage.mappers.system.ClientAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientApplyMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientAuditProcessMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientBDMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientBankAccountMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientDeviceMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientFilesMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientMapper; +import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper; +import au.com.royalpay.payment.manage.mappers.system.CommoditiesMapper; +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.SysWxMerchantApplyMapper; +import au.com.royalpay.payment.manage.merchants.beans.ActivityPosterBuilder; +import au.com.royalpay.payment.manage.merchants.beans.BankAccountInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientAuthFilesInfo; +import au.com.royalpay.payment.manage.merchants.beans.ClientRateConfig; +import au.com.royalpay.payment.manage.merchants.beans.ClientRegisterInfo; +import au.com.royalpay.payment.manage.merchants.beans.NewAccountBean; +import au.com.royalpay.payment.manage.merchants.beans.PartnerQuery; +import au.com.royalpay.payment.manage.merchants.beans.SubMerchantIdApply; import au.com.royalpay.payment.manage.merchants.core.ClientComplyValidator; import au.com.royalpay.payment.manage.merchants.core.ClientManager; import au.com.royalpay.payment.manage.notice.core.MailService; @@ -43,16 +63,21 @@ import au.com.royalpay.payment.tools.merchants.qrboard.QRBoard; import au.com.royalpay.payment.tools.merchants.qrboard.QRBoardProvider; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; -import au.com.royalpay.payment.tools.utils.*; +import au.com.royalpay.payment.tools.utils.ImageUtils; +import au.com.royalpay.payment.tools.utils.PageListUtils; +import au.com.royalpay.payment.tools.utils.PasswordUtils; +import au.com.royalpay.payment.tools.utils.PdfUtils; +import au.com.royalpay.payment.tools.utils.QRCodeUtils; +import au.com.royalpay.payment.tools.utils.TimeZoneUtils; import au.com.royalpay.payment.tools.websocket.notify.PartnerPageEvent; -import cn.yixblog.platform.http.HttpRequestGenerator; -import cn.yixblog.platform.http.HttpRequestResult; + import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.github.miemiedev.mybatis.paginator.domain.Order; import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; + import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; @@ -75,23 +100,35 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.thymeleaf.context.Context; import org.thymeleaf.spring4.SpringTemplateEngine; -import javax.annotation.Resource; -import javax.imageio.ImageIO; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletResponse; import java.awt.*; import java.awt.image.BufferedImage; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.math.BigDecimal; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; import java.util.List; +import java.util.Objects; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +import javax.annotation.Resource; +import javax.imageio.ImageIO; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; + +import cn.yixblog.platform.http.HttpRequestGenerator; +import cn.yixblog.platform.http.HttpRequestResult; + import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.checkOrgPermission; /** @@ -164,6 +201,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid private SysWxMerchantApplyMapper sysWxMerchantApplyMapper; @Resource private SpringTemplateEngine thymeleaf; + @Resource + private DeviceManager deviceManager; @Resource private FinancialBDConfigMapper financialBDConfigMapper; @@ -898,6 +937,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid account.put("salt", salt); account.put("password_hash", pwdHash); account.put("password_aes", PasswordUtils.encryptAESPwd(pwd)); + deviceManager.deviceOffline(accountId); clientAccountMapper.update(account); signInAccountService.clearAccountCache(accountId); } 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 c2256c7e2..c68879275 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 @@ -1,9 +1,9 @@ package au.com.royalpay.payment.manage.signin.core.impls; import au.com.royalpay.payment.core.exceptions.InvalidShortIdException; +import au.com.royalpay.payment.manage.device.core.DeviceManager; 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; @@ -68,7 +68,7 @@ public class SignInAccountServiceImpl implements SignInAccountService, Applicati @Resource private SignInStatusManager signInStatusManager; @Resource - private ClientDeviceMapper clientDeviceMapper; + private DeviceManager deviceManager; private ApplicationEventPublisher publisher; @Override @@ -203,7 +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")); + deviceManager.deviceOffline(clientStatus.getString("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 f0e729707..af5953388 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 @@ -49,10 +49,10 @@ - + update sys_clients_devices - set is_offline = 1 - where client_id = #{client_id} - and account_id = #{account_id} + set is_offline = 1 + where + account_id = #{account_id} \ No newline at end of file From 3321310500ea78e4909858f141026426c9118ef9 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Mon, 12 Mar 2018 11:05:35 +0800 Subject: [PATCH 3/3] update --- .../payment/manage/merchants/core/impls/ClientManagerImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index f3486c157..2920daa7a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -930,6 +930,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid } @Override + @Transactional public void resetAccountPwd(JSONObject manager, String clientMoniker, String accountId, String pwd) { JSONObject account = checkAndFindAccount(manager, clientMoniker, accountId); String salt = PasswordUtils.newSalt();