diff --git a/pom.xml b/pom.xml index 351b5ceee..fcc8224a2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ au.com.royalpay.payment payment-parent - 0.2.0 + 0.2.0-dev 4.0.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java index 34c828f70..745a34693 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/clearing/core/impl/CleanServiceImpl.java @@ -205,6 +205,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider total.put("wechat_charge", 0); total.put("royalpay_charge", 0); total.put("net_amount", 0); + total.put("total_charge", 0); + total.put("tax_amount", 0); + total.put("charge_cashback", 0); List details = new ArrayList<>(); for (JSONObject log : logs) { @@ -214,6 +217,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider addBigDecimal(total, log, "wechat_charge"); addBigDecimal(total, log, "royalpay_charge"); addBigDecimal(total, log, "net_amount"); + addBigDecimal(total, log, "total_charge"); + addBigDecimal(total, log, "charge_cashback"); + addBigDecimal(total, log, "tax_amount"); int clearingId = log.getIntValue("clearing_id"); List logDetails = clearingDetailMapper.listReportsOfSettlement(clearingId); details.addAll(logDetails); @@ -226,6 +232,9 @@ public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider .map(detail -> detail.getBigDecimal("clearing_amount")) .reduce(BigDecimal::add) ); + data.put("clients", logDetails.stream() + .filter(detail -> bank.equals(detail.getString("settle_bank"))) + .count()); return data; }).collect(Collectors.toList()); log.put("bank_statistics", bankStatistics); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java index 2400f4759..c91f8f756 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/PermissionPartnerManager.java @@ -3,6 +3,8 @@ package au.com.royalpay.payment.manage.management.sysconfig.core; import au.com.royalpay.payment.manage.management.sysconfig.beans.FuncInfo; import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleInfo; import au.com.royalpay.payment.tools.permission.enums.ManagerRole; +import au.com.royalpay.payment.tools.permission.enums.PartnerRole; + import com.alibaba.fastjson.JSONObject; import java.util.List; @@ -27,7 +29,7 @@ public interface PermissionPartnerManager { List listRoleFunctions(ManagerRole role); - void authorizeRole(ManagerRole role, List functions); + void authorizeRole(PartnerRole role, List functions); List listUserFunctions(int role); diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java index 42c34d40b..a70c7997d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/core/impls/PermissionPartnerManagerImpl.java @@ -12,6 +12,7 @@ import au.com.royalpay.payment.manage.permission.manager.scanner.PermissionPartn import au.com.royalpay.payment.manage.system.core.PermissionClientModulesService; 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.utils.id.IdUtil; import com.alibaba.fastjson.JSONObject; @@ -175,7 +176,7 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { } @Override - @CacheEvict(value = ":login:managers:", allEntries = true) + @CacheEvict(value = ":login:partners:", allEntries = true) public void setFunctionModule(String funcId, String moduleName) { if (moduleName == null) { throw new BadRequestException("module name not provided"); @@ -204,10 +205,11 @@ public class PermissionPartnerManagerImpl implements PermissionPartnerManager { @Override @Transactional - @CacheEvict(value = ":login:managers:", allEntries = true) - public void authorizeRole(ManagerRole role, List functions) { - permissionPartnerFunctionMapper.clearRolePermission(role.getInverseMask()); - permissionPartnerFunctionMapper.authorizeRole(role.getMask(), functions); + @CacheEvict(value = ":login:partners:", allEntries = true) + public void authorizeRole(PartnerRole role, List functions) { + + permissionPartnerFunctionMapper.clearRolePermission(role.getCode()); + permissionPartnerFunctionMapper.authorizeRole(role.getCode(), functions); } @Override diff --git a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java index d24d76633..2e8c67b39 100644 --- a/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java +++ b/src/main/java/au/com/royalpay/payment/manage/management/sysconfig/web/SysPermissionPartnerConfigController.java @@ -5,6 +5,7 @@ import au.com.royalpay.payment.manage.management.sysconfig.beans.PartnerModuleIn import au.com.royalpay.payment.manage.management.sysconfig.core.PermissionPartnerManager; 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 com.alibaba.fastjson.JSONObject; @@ -81,8 +82,8 @@ public class SysPermissionPartnerConfigController { public void authorizeRole(@PathVariable String roleMask, @RequestBody List functions){ try { int mask = Integer.parseInt(roleMask, 2); - for (ManagerRole role : ManagerRole.values()) { - if (mask == role.getMask()) { + for (PartnerRole role : PartnerRole.values()) { + if (mask == role.getCode()) { permissionPartnerManager.authorizeRole(role,functions); return; } diff --git a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java index 712ac48ca..8881b2a62 100644 --- a/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java +++ b/src/main/java/au/com/royalpay/payment/manage/mappers/system/ManagerMapper.java @@ -45,6 +45,7 @@ public interface ManagerMapper { List listByRole(JSONObject params); @AutoSql(type = SqlType.SELECT) + @AdvanceSelect(addonWhereClause = "is_valid=1") JSONObject findByWxOpenId(@Param("wx_openid") String openid); List listOpenIdsOfCompliances(); diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java index f94e4351b..05a99e1f0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/PermissionClientModulesServiceImpl.java @@ -73,18 +73,21 @@ public class PermissionClientModulesServiceImpl implements PermissionClientModul } private void saveMongoLog(JSONObject account, JSONObject oldRecord, JSONObject modifyData, String business) { - modifyData.remove("id"); - PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog(); - mongoRecord.setBusiness(business); - mongoRecord.setClientId(oldRecord.getIntValue("client_id")); - mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); - mongoRecord.setCreateTime(new Date()); - mongoRecord.setId(IdUtil.getId()); - mongoRecord.setUserId(account.getString("manager_id")); - mongoRecord.setUserName(account.getString("display_name")); - mongoRecord.setNewData(modifyData.toJSONString()); - Map beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get)); - mongoRecord.setOriginData(JSON.toJSONString(beforeModify)); - mongoTemplate.insert(mongoRecord); + try { + modifyData.remove("id"); + PermissionClientModuleLog mongoRecord = new PermissionClientModuleLog(); + mongoRecord.setBusiness(business); + mongoRecord.setClientId(oldRecord.getIntValue("client_id")); + mongoRecord.setClientMoniker(oldRecord.getString("client_moniker")); + mongoRecord.setCreateTime(new Date()); + mongoRecord.setId(IdUtil.getId()); + mongoRecord.setUserId(account.getString("manager_id")); + mongoRecord.setUserName(account.getString("display_name")); + mongoRecord.setNewData(modifyData.toJSONString()); + Map beforeModify = modifyData.keySet().stream().collect(Collectors.toMap(key -> key, oldRecord::get)); + mongoRecord.setOriginData(JSON.toJSONString(beforeModify)); + mongoTemplate.insert(mongoRecord); + }catch (Exception ignore){ + } } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml index cd677f123..0abaa2209 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/PermissionPartnerFunctionMapper.xml @@ -13,13 +13,13 @@ @@ -29,7 +29,7 @@