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