diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java index 3be51a159..1e57a5460 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ClientMapper.java @@ -58,8 +58,6 @@ public interface ClientMapper { List listClientsForSettlementWithDetail(); - void disableClient(@Param("client_id") int clientId); - @AutoSql(type = SqlType.SELECT) @AdvanceSelect(addonWhereClause = "is_valid=1 and approve_email_id is not null and approve_email_send=3") List listClientsWithEmailNotVerify(); 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 e06664e6f..e946b95f5 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 @@ -48,6 +48,7 @@ import au.com.royalpay.payment.manage.merchants.entity.impls.BDUserModify; import au.com.royalpay.payment.manage.merchants.entity.impls.ClearDaysModify; import au.com.royalpay.payment.manage.merchants.entity.impls.CredentialCodeModify; import au.com.royalpay.payment.manage.merchants.entity.impls.CustomerSurchargeRateModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.DisableModify; import au.com.royalpay.payment.manage.merchants.entity.impls.EmailModify; import au.com.royalpay.payment.manage.merchants.entity.impls.GreenChannelModify; import au.com.royalpay.payment.manage.merchants.entity.impls.LogoModify; @@ -59,6 +60,7 @@ import au.com.royalpay.payment.manage.merchants.entity.impls.ParentIdModify; import au.com.royalpay.payment.manage.merchants.entity.impls.PaypadVersionModify; import au.com.royalpay.payment.manage.merchants.entity.impls.RefundAuditModify; import au.com.royalpay.payment.manage.merchants.entity.impls.AuditModify; +import au.com.royalpay.payment.manage.merchants.entity.impls.RefundPWDModify; import au.com.royalpay.payment.manage.merchants.entity.impls.SettleHourModify; import au.com.royalpay.payment.manage.merchants.entity.impls.SwitchPermissionModify; import au.com.royalpay.payment.manage.merchants.entity.impls.TimeZoneModify; @@ -375,6 +377,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid List children = clientMapper.listChildClients(client.getIntValue("client_id")); client.put("has_children", !children.isEmpty()); } + client.putAll(clientConfigService.find(clientId)); return client; } @@ -1076,7 +1079,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public void toggleAuditRefund(String clientMoniker, boolean enable, JSONObject account) { - clientModifySupport.processClientModify(new RefundAuditModify(account, clientMoniker, enable)); + clientModifySupport.processClientConfigModify(new RefundAuditModify(account, clientMoniker, enable)); } @Override @@ -2218,6 +2221,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid record.put("refund_pwd", pwdHash); record.put("refund_pwd_salt", salt); clientConfigService.update(record); + clientModifySupport.processClientConfigModify(new RefundPWDModify(account,client.getString("client_moniker"),pwd,salt)); } @Override @@ -2299,9 +2303,8 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid @Override public void disableClient(String clientMoniker, JSONObject manager) { JSONObject client = clientDetail(manager, clientMoniker); - int clientId = client.getIntValue("client_id"); - clientMapper.disableClient(clientId); - clientInfoCacheSupport.clearClientCache(clientId); + Assert.notEmpty(client); + clientModifySupport.processClientModify(new DisableModify(manager,clientMoniker,false)); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/DisableModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/DisableModify.java new file mode 100644 index 000000000..9f0c57741 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/DisableModify.java @@ -0,0 +1,30 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class DisableModify extends ClientModify { + private boolean is_valid; + + + public DisableModify(JSONObject account, String clientMoniker, boolean is_valid) { + super(account, clientMoniker); + this.is_valid = is_valid; + } + + @Override + protected String business() { + return is_valid?"开启":"禁用"; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("is_valid", is_valid); + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java index db4d50724..52de0d4be 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundAuditModify.java @@ -1,12 +1,13 @@ package au.com.royalpay.payment.manage.merchants.entity.impls; -import au.com.royalpay.payment.manage.merchants.entity.ClientModify; +import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; + import com.alibaba.fastjson.JSONObject; /** * Create by yixian at 2018-04-12 16:43 */ -public class RefundAuditModify extends ClientModify { +public class RefundAuditModify extends ClientConfigModify { private boolean enable; public RefundAuditModify(JSONObject account, String clientMoniker, boolean enable) { diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java new file mode 100644 index 000000000..15e252685 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/entity/impls/RefundPWDModify.java @@ -0,0 +1,33 @@ +package au.com.royalpay.payment.manage.merchants.entity.impls; + +import au.com.royalpay.payment.manage.merchants.entity.ClientConfigModify; + +import com.alibaba.fastjson.JSONObject; + +/** + * Create by yixian at 2018-04-12 16:43 + */ +public class RefundPWDModify extends ClientConfigModify { + private String refund_pwd; + private String refund_pwd_salt; + + public RefundPWDModify(JSONObject account, String clientMoniker, String refund_pwd, String refund_pwd_salt) { + super(account, clientMoniker); + this.refund_pwd = refund_pwd; + this.refund_pwd_salt = refund_pwd_salt; + } + + @Override + protected String business() { + + return "修改退款密码为:"+refund_pwd; + } + + @Override + protected JSONObject getModifyResult() { + JSONObject modify = new JSONObject(); + modify.put("refund_pwd", refund_pwd); + modify.put("refund_pwd_salt", refund_pwd_salt); + return modify; + } +} diff --git a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/RefundController.java b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/RefundController.java index 6b306a0b8..a2985308b 100644 --- a/src/main/java/au/com/royalpay/payment/manage/tradelog/web/RefundController.java +++ b/src/main/java/au/com/royalpay/payment/manage/tradelog/web/RefundController.java @@ -10,20 +10,13 @@ import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; import au.com.royalpay.payment.tools.permission.enums.PartnerRole; - +import au.com.royalpay.payment.tools.permission.wechat.WechatMapping; import com.alibaba.fastjson.JSONObject; - -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; -import java.math.BigDecimal; - import javax.annotation.Resource; +import java.math.BigDecimal; /** * Created by yixian on 2016-07-04. @@ -68,17 +61,17 @@ public class RefundController { return refundService.notifyRefundReview(); } - @RequestMapping(value = "/auditions", method = RequestMethod.GET) + @WechatMapping(value = "/auditions", method = RequestMethod.GET) public ModelAndView auditionListPage(@ModelAttribute(CommonConsts.WECHATINFO) JSONObject user) { ModelAndView view = new ModelAndView("refund_audit_list"); - view.addAllObjects(refundService.auditionsFromOpenId("o32MzuO4s8c7iFOVxnxejkbhMoEc")); + view.addAllObjects(refundService.auditionsFromOpenId(user.getString("openid"))); return view; } - @RequestMapping(value = "/auditions/{auditionId}", method = RequestMethod.GET) + @WechatMapping(value = "/auditions/{auditionId}", method = RequestMethod.GET) public ModelAndView auditionPage(@PathVariable String auditionId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject user) { ModelAndView view = new ModelAndView("refund_audit"); - view.addAllObjects(refundService.auditionInfo("25", "asd")); + view.addAllObjects(refundService.auditionInfo(auditionId, user.getString("openid"))); return view; } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index b672d6c17..0a984284a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -209,8 +209,9 @@ c.client_id client_id, max(t.transaction_time) transation_time, c.client_moniker client_moniker - FROM pmt_transactions t INNER JOIN sys_clients c - ON t.client_id = c.client_id AND c.enable_refund_auth = 0 + FROM pmt_transactions t + INNER JOIN sys_clients c ON t.client_id = c.client_id + INNER JOIN sys_client_config cc on cc.client_id = c.client_id AND cc.enable_refund_auth = 0 GROUP BY c.client_id) a WHERE a.amount < 0 @@ -237,7 +238,7 @@ c.client_moniker, c.parent_client_id, c.org_id, - c.clean_days, + cc.clean_days, t.transaction_id, t.transaction_type, t.transaction_time, @@ -252,6 +253,7 @@ o.total_amount FROM pmt_transactions t INNER JOIN sys_clients c ON c.client_id = t.client_id + inner join sys_client_config cc on cc.client_id = c.client_id LEFT JOIN pmt_orders o ON o.order_id = t.order_id WHERE t.clearing_order IS NULL AND t.clearing_status = 0 AND t.channel != 'Settlement' AND t.client_id = #{client_id} AND @@ -415,7 +417,7 @@ t.transaction_currency currency, t.order_id FROM pmt_transactions t - INNER JOIN sys_clients c ON t.client_id = c.client_id AND c.skip_clearing = 0 + INNER JOIN sys_client_config c ON t.client_id = c.client_id AND c.skip_clearing = 0 LEFT JOIN sys_client_rates r ON r.client_id = t.client_id AND date(r.expiry_time) >= DATE(t.transaction_time) AND date(r.active_time) <= DATE(t.transaction_time) @@ -434,7 +436,7 @@ (SELECT round(sum(if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount)) * (100 - ifnull(min(r.rate_value), 1.6))) / 100 clearing_amount FROM pmt_transactions t - INNER JOIN sys_clients c ON t.client_id = c.client_id AND c.skip_clearing = 0 + INNER JOIN sys_client_config c ON t.client_id = c.client_id AND c.skip_clearing = 0 LEFT JOIN sys_client_rates r ON r.client_id = t.client_id AND date(r.expiry_time) >= DATE(t.transaction_time) AND date(r.active_time) <= DATE(t.transaction_time) @@ -460,7 +462,8 @@ FROM pmt_transactions t INNER JOIN log_clearing_detail d ON d.clear_detail_id = t.clearing_order INNER JOIN log_clearing c ON c.clearing_id = d.clearing_id AND c.clearing_id = #{clear_id} - INNER JOIN sys_clients cl ON cl.client_id = t.client_id AND cl.is_valid = 1 + INNER JOIN sys_clients cl ON cl.client_id = t.client_id + inner join sys_client_config cc on cc.clear_id = cl.client_id and cc.is_valid = 1 WHERE t.transaction_type = 'Credit' OR t.refund_id IS NOT NULL ORDER BY t.order_id ASC @@ -575,6 +578,7 @@ ifnull(so.rate_value, 1) rate_value FROM pmt_transactions t INNER JOIN sys_clients c ON c.client_id = t.client_id + inner join sys_client_config cc on cc.client_id = c.client_id INNER JOIN sys_org so ON c.referrer_id = so.org_id AND so.is_valid = 1 AND so.type = 1 AND so.commission = 1 WHERE year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} AND t.channel != 'Settlement' diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml index 553a48705..f955ba1c2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientMapper.xml @@ -1,13 +1,8 @@ - - UPDATE sys_clients - SET is_valid = 0 - WHERE client_id = #{client_id} - SELECT DISTINCT c.*,o.name org_name FROM sys_clients c - inner join sys_client_config on scc.client_id = c.client_id inner join sys_org o on o.org_id=c.org_id @@ -166,7 +160,6 @@ @@ -257,22 +252,22 @@ \ No newline at end of file