From f730c8fb42b3288c8f0fea70e2798a0f585cbea4 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Tue, 26 Dec 2017 13:07:56 +0800 Subject: [PATCH] fixbug --- .../impls/CustomersAnalysisServiceImp.java | 2 +- .../appclient/core/RetailAppService.java | 2 +- .../core/impls/RetailAppServiceImp.java | 6 +-- .../appclient/web/RetailAppController.java | 39 +++++++++---------- .../core/impls/PartnerLMServiceImp.java | 2 +- .../core/impls/SignInStatusManagerImpl.java | 19 +++++---- 6 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java index 3978e25d7..42665282d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/analysis/core/impls/CustomersAnalysisServiceImp.java @@ -171,7 +171,7 @@ public class CustomersAnalysisServiceImp implements CustomersAnalysisService { sendLog.put("send_time", new Date()); sendLog.put("open_id", openId); sendLog.put("client_id", clientId); - sendLog.put("account_id", account.getIntValue("account_id")); + sendLog.put("account_id", account.getString("account_id")); sendLog.put("account_name", account.getString("display_name")); sendLog.put("msg_type", "daily_notice"); sendLog.put("status", 0); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index 04a30a26a..284d9df58 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -54,7 +54,7 @@ public interface RetailAppService { JSONObject getNoticeDetailById(JSONObject device, String noticeId); - void changeAccountPassword(JSONObject device, ChangePwdBean change, int account_id); + void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id); JSONObject bankAccountInfo(JSONObject device); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 7d9556312..0d9434462 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -752,11 +752,11 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public void changeAccountPassword(JSONObject device, ChangePwdBean change, int account_id) { + public void changeAccountPassword(JSONObject device, ChangePwdBean change, String account_id) { String clientType = device.getString("client_type"); deviceSupport.findRegister(clientType); //JSONObject client = signInAccountService.getClient(account_id); - if (device.getIntValue("account_id") != account_id) { + if (!account_id.equals(device.getString("account_id"))) { throw new ForbiddenException("You have no permission"); } signInAccountService.changeAccountPassword(device, change); @@ -1039,7 +1039,7 @@ public class RetailAppServiceImp implements RetailAppService { deviceSupport.findRegister(clientType); JSONObject account = clientAccountMapper.findById(device.getString("account_id")); JSONObject operator = new JSONObject(); - operator.put("account_id", device.getIntValue("account_id")); + operator.put("account_id", device.getString("account_id")); operator.put("display_name", account.getString("display_name")); JSONArray clientIds = clientManager.getAllClientIds(device.getIntValue("client_id")); if (!clientIds.contains(client_id)) { diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index bc74bc00c..7016b67d8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -1,14 +1,19 @@ package au.com.royalpay.payment.manage.appclient.web; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; +import au.com.royalpay.payment.core.exceptions.ParamInvalidException; +import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; +import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; +import au.com.royalpay.payment.manage.appclient.core.RetailAppService; +import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; +import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; +import au.com.royalpay.payment.tools.CommonConsts; +import au.com.royalpay.payment.tools.device.advise.AppClientController; +import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import au.com.royalpay.payment.tools.http.HttpUtils; -import javax.annotation.Resource; -import javax.validation.Valid; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; -import au.com.royalpay.payment.tools.device.advise.AppClientController; -import org.apache.http.Consts; import org.springframework.validation.Errors; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; @@ -17,18 +22,12 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; -import au.com.royalpay.payment.core.exceptions.ParamInvalidException; -import au.com.royalpay.payment.manage.appclient.beans.AppClientBean; -import au.com.royalpay.payment.manage.appclient.beans.AppQueryBean; -import au.com.royalpay.payment.manage.appclient.core.RetailAppService; -import au.com.royalpay.payment.manage.signin.beans.ChangePwdBean; -import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; -import au.com.royalpay.payment.tools.CommonConsts; -import au.com.royalpay.payment.tools.exceptions.ForbiddenException; -import au.com.royalpay.payment.tools.http.HttpUtils; +import javax.annotation.Resource; +import javax.validation.Valid; /** * Created by yishuqian on 28/03/2017. @@ -103,7 +102,7 @@ public class RetailAppController { @RequestMapping(value = "/notice/{noticeId}", method = RequestMethod.PUT) public void updateNoticePartnerHasRead(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String noticeId, @RequestBody JSONObject account_param) { - if (device.getIntValue("account_id") != account_param.getIntValue("account_id")) { + if (device.getString("account_id").equals(account_param.getString("account_id")){ throw new ForbiddenException("You have no permission"); } retailAppService.updateReadStatus(device, noticeId); @@ -118,7 +117,7 @@ public class RetailAppController { /*我的页面begin*/ @RequestMapping(value = "/partner_password/{account_id}", method = RequestMethod.PUT) - public void changePassword(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable int account_id, @RequestBody @Valid ChangePwdBean change, Errors errors) { + public void changePassword(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device, @PathVariable String account_id, @RequestBody @Valid ChangePwdBean change, Errors errors) { HttpUtils.handleValidErrors(errors); retailAppService.changeAccountPassword(device, change, account_id); } diff --git a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/PartnerLMServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/PartnerLMServiceImp.java index a7a00d2f0..74bb7000e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/PartnerLMServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/redpack/core/impls/PartnerLMServiceImp.java @@ -392,7 +392,7 @@ public class PartnerLMServiceImp implements PartnerLMService { JSONObject updateObj = new JSONObject(); updateObj.put("client_id", partner.getIntValue("client_id")); updateObj.put("customer_id", customer_id); - updateObj.put("update_id", partner.getIntValue("account_id")); + updateObj.put("update_id", partner.getString("account_id")); updateObj.put("act_id", act_id); updateObj.put("channel", channel); actPartnerWechatRelationMapper.deleteBindWehcat(updateObj); diff --git a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java index d1f260202..8ce8150ec 100644 --- a/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/signin/core/impls/SignInStatusManagerImpl.java @@ -1,14 +1,16 @@ package au.com.royalpay.payment.manage.signin.core.impls; -import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.manage.signin.beans.LoginInfo; import au.com.royalpay.payment.manage.signin.core.SignInAccountService; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; import au.com.royalpay.payment.tools.connections.mpsupport.WechatAppApi; import au.com.royalpay.payment.tools.env.PlatformEnvironment; import au.com.royalpay.payment.tools.exceptions.ForbiddenException; +import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.utils.QRCodeUtils; + import com.alibaba.fastjson.JSONObject; + import org.apache.commons.lang.RandomStringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.BoundValueOperations; @@ -16,9 +18,10 @@ import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import org.springframework.web.servlet.ModelAndView; -import javax.annotation.Resource; import java.util.concurrent.TimeUnit; +import javax.annotation.Resource; + /** * Created by yixian on 2016-06-29. */ @@ -67,7 +70,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { public String partnerSignIn(LoginInfo loginInfo) { JSONObject account = signInAccountService.clientLoginCheck(loginInfo); String statusKey = newStatusKey(); - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); return statusKey; } @@ -206,7 +209,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { public void clientQRCodeSignIn(String codeId, String openid, ModelAndView view) { JSONObject account = signInAccountService.clientWechatSignIn(openid); String statusKey = newStatusKey(); - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(redisPrefix + ":client_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES); JSONObject res = new JSONObject(); res.put("notitle", true); @@ -240,7 +243,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { } } String statusKey = newStatusKey(); - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); account = getCurrentClient(statusKey); account.put("sign_key", statusKey); account.put("app_openid", openId); @@ -251,7 +254,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { public String clientWechatSignIn(String openid) { JSONObject account = signInAccountService.clientWechatSignIn(openid); String statusKey = newStatusKey(); - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getIntValue("account_id") + "", 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set(account.getString("account_id") + "", 30, TimeUnit.MINUTES); return statusKey; } @@ -283,7 +286,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { if (account == null || account.size() <= 0) { throw new ForbiddenException("用户不存在或已禁用"); } - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getIntValue("account_id"), 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES); } @@ -297,7 +300,7 @@ public class SignInStatusManagerImpl implements SignInStatusManager { if (account == null || account.size() <= 0) { throw new ForbiddenException("用户不存在或已禁用"); } - stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getIntValue("account_id"), 30, TimeUnit.MINUTES); + stringRedisTemplate.boundValueOps(partnerLoginRedisKey(statusKey)).set("" + account.getString("account_id"), 30, TimeUnit.MINUTES); stringRedisTemplate.boundValueOps(redisPrefix + ":app_qrcode_signin:code:" + codeId).set(statusKey, 1, TimeUnit.MINUTES); }