Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

wujiefeng 1 год назад
Родитель
Сommit
0764b727e3

+ 3 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/tempMenus/PlatformMenuController.java

@@ -40,7 +40,7 @@ public class PlatformMenuController {
         return ResultContent.buildSuccess();
     }
 
-    @ResourceAuth(value = "openAPIAppManager", type = AuthType.Platform, remark = "OpenAPI_应用管理_40_Menu")
+    @ResourceAuth(value = "platOpenAPIAppManager", type = AuthType.Platform, remark = "OpenAPI_应用管理_40_Menu")
     @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "openAPIAppManager", method = {RequestMethod.GET})
@@ -48,7 +48,7 @@ public class PlatformMenuController {
         return ResultContent.buildSuccess();
     }
 
-    @ResourceAuth(value = "openAPIInterface", type = AuthType.Platform, remark = "OpenAPI_接口管理_50_Menu")
+    @ResourceAuth(value = "platOpenAPIInterface", type = AuthType.Platform, remark = "OpenAPI_接口管理_50_Menu")
     @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "openAPIInterface", method = {RequestMethod.GET})
@@ -56,7 +56,7 @@ public class PlatformMenuController {
         return ResultContent.buildSuccess();
     }
 
-    @ResourceAuth(value = "openAPILog", type = AuthType.Platform, remark = "OpenAPI_日志管理_60_Menu")
+    @ResourceAuth(value = "platOpenAPILog", type = AuthType.Platform, remark = "OpenAPI_日志管理_60_Menu")
     @ResourceAuth(value = AuthConstant.SuperAdmin, type = AuthType.Platform, remark = "")
     @ResourceAuth(value = "user", type = AuthType.User)
     @RequestMapping(value = "openAPILog", method = {RequestMethod.GET})

+ 9 - 9
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/pay/SettleService.java

@@ -40,7 +40,7 @@ public class SettleService {
     SettleService settleService;
 
     @Transactional
-    public ResultContent settle(String projectOid, String oid, Long endTime, String remark, PaymentType paymentType){
+    public ResultContent settle(String projectOid, String oid, Long endTime, String remark, PaymentType paymentType) {
         //获取机构-待结算子账
         PayAccount waitSettleAccount = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.WaitSettle);
         //查询时间内所有待结算账单
@@ -52,7 +52,7 @@ public class SettleService {
 //        queryModel.setFilter(Map.of("meta.paymentType", paymentType));
         queryModel.setFilter(Map.of("meta.paymentType", paymentType, "$or", Arrays.asList(
                 new Document()
-                            .append("meta.settleStatus", new Document()
+                        .append("meta.settleStatus", new Document()
                                 .append("$exists", false)
                         ),
                 new Document()
@@ -61,11 +61,11 @@ public class SettleService {
         ResultContent<TransactionLogAggregateNotPageRetModel> aggregateResult = transactionLogService.aggregateNotPage(queryModel);
 
 
-        if (!aggregateResult.getState().equals(ResultState.Success)){
+        if (!aggregateResult.getState().equals(ResultState.Success)) {
             log.info("资金结算:查询待结算账单失败");
             throw new RuntimeException(aggregateResult.getMsg());
         }
-        if (aggregateResult.getContent().getList().isEmpty()){
+        if (aggregateResult.getContent().getList().isEmpty()) {
             return ResultContent.buildContent(new HashSet<>());
         }
         List<TransactionLogModel> transactionLogModelList = aggregateResult.getContent().getList();
@@ -82,7 +82,7 @@ public class SettleService {
         //收入-支出=可提现金额
         long settleAmount = aggregateResult.getContent().getStatistics().getCreditCount() + aggregateResult.getContent().getStatistics().getDebitCount();
 
-        if (settleAmount<=0L){
+        if (settleAmount <= 0L) {
             log.info("该账户可结算金额小于或等于0, 账户:{},可提现金额:{}, 时间{}", waitSettleAccount.getLedgerId(), settleAmount, endTime);
             throw new RuntimeException("该账户可结算金额小于或等于0");
         }
@@ -100,7 +100,7 @@ public class SettleService {
         sourceTransaction.setTransactionStatus(TransactionStatus.Success);
         sourceTransaction.setAmount(-settleAmount);
         sourceTransaction.setRemark(remark);
-        sourceTransaction.setMeta(Map.of("orderSize", orderNoSet.size(),"transactionLogList", settleList,"paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "结算"));
+        sourceTransaction.setMeta(Map.of("orderSize", orderNoSet.size(), "transactionLogList", settleList, "paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "结算"));
         transferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
         //构建入账账户
         TransferTransactionsModel.GeneralLedgerTransaction destinationTransaction = new TransferTransactionsModel.GeneralLedgerTransaction();
@@ -110,11 +110,11 @@ public class SettleService {
         destinationTransaction.setTransactionStatus(TransactionStatus.Success);
         destinationTransaction.setAmount(settleAmount);
         destinationTransaction.setRemark(remark);
-        destinationTransaction.setMeta(Map.of("orderSize", orderNoSet.size(),"transactionLogList", settleList,"paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "结算"));
+        destinationTransaction.setMeta(Map.of("orderSize", orderNoSet.size(), "transactionLogList", settleList, "paymentType", paymentType, "paymentChannelType", paymentType.getChannelType(), "description", "结算"));
         transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
         ResultContent<List<TransactionLogModel>> transfer = transactionLogService.transfer(transferModel);
 
-        if (!transfer.getState().equals(ResultState.Success)){
+        if (!transfer.getState().equals(ResultState.Success)) {
             log.error("结算划账失败, projectOid: {}, paymentType: {}", projectOid, paymentType);
             throw new RuntimeException(transfer.getMsg());
         }
@@ -122,7 +122,7 @@ public class SettleService {
         updateMetaFieldModel.setIds(settleList);
         updateMetaFieldModel.setMetaField(Map.of("settleStatus", SettleStatus.Settle));
         ResultContent<Void> updateManyMetaField = transactionLogService.updateManyMetaField(updateMetaFieldModel);
-        if (!updateManyMetaField.getState().equals(ResultState.Success)){
+        if (!updateManyMetaField.getState().equals(ResultState.Success)) {
             log.error("修改账单meta字段失败, projectOid: {}, paymentType: {}", projectOid, paymentType);
             throw new RuntimeException(updateManyMetaField.getMsg());
         }

+ 2 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/paySetting/ProjectPaySettingServiceImpl.java

@@ -563,6 +563,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
         fields.add(PayConfigField.builder().name("多应用类型").key("withdrawAppType").type(PayFieldType.Str).isMust(Boolean.TRUE).maxLength(100).payShowField(mainFiled).build());
         fields.add(PayConfigField.builder().name("提现通知地址").key("withdrawNotify").type(PayFieldType.Str).isMust(Boolean.FALSE).payShowField(mainFiled).build());
 
+
         return fields;
     }
 
@@ -684,7 +685,7 @@ public class ProjectPaySettingServiceImpl extends SuperService {
                 appConf.setSysSource(model.getSysSource());
                 appConf.setSysSourceNo(model.getSysSourceNo());
 
-                // 退款
+                // 提现
                 appConf.setWithdrawAppId(model.getWithdrawAppId());
                 appConf.setWithdrawAppKey(model.getWithdrawAppKey());
                 appConf.setWithdrawSysId(model.getWithdrawSysid());

+ 30 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/user/RoleServiceImpl.java

@@ -31,6 +31,7 @@ import com.zhongshu.card.server.core.domain.org.OrganizationUser;
 import com.zhongshu.card.server.core.domain.org.Role;
 import com.zhongshu.card.server.core.domain.org.UserAccount;
 import com.zhongshu.card.server.core.service.base.SuperService;
+import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
 import com.zhongshu.card.server.core.util.AesUtils;
 import com.zhongshu.card.server.core.util.BeanUtils;
 import com.zhongshu.card.server.core.util.CommonUtil;
@@ -73,6 +74,9 @@ public class RoleServiceImpl extends SuperService {
     @Autowired
     private OrganizationUserDao organizationUserDao;
 
+    @Autowired
+    private OrganizationServiceImpl organizationService;
+
 
     /**
      * 添加/编辑角色
@@ -484,7 +488,15 @@ public class RoleServiceImpl extends SuperService {
      * @return
      */
     public ResultContent getCurrentUserProjectAuth(String projectOid) {
-        Set<String> auths = getUserProjectAllAuths(projectOid, getCurrentUserId());
+        String userId = getCurrentUserId();
+        Set<String> auths = getUserProjectAllAuths(projectOid, userId);
+        // 得到平台的权限
+        Organization organization = organizationService.getPlatForm();
+        Set<String> platFormAuths = getUserOrgAllAuths(organization, userId);
+        if (platFormAuths != null && !platFormAuths.isEmpty()) {
+            auths.addAll(platFormAuths);
+        }
+        log.info("auths {}", auths);
         return ResultContent.buildSuccess(AesUtils.encryptAuth(auths));
     }
 
@@ -507,6 +519,23 @@ public class RoleServiceImpl extends SuperService {
         return auth;
     }
 
+    public Set<String> getUserOrgAllAuths(Organization organization, String userId) {
+        Set<String> auth = new HashSet<>();
+        if (StringUtils.isEmpty(userId)) {
+            return auth;
+        }
+        UserAccount userAccount = userCountDao.findTopByUserId(userId);
+        if (ObjectUtils.isEmpty(userAccount)) {
+            return auth;
+        }
+        OrganizationUser organizationUser = organizationUserDao.findTopByOrganizationAndUser(organization, userAccount);
+        if (ObjectUtils.isEmpty(organizationUser)) {
+            return auth;
+        }
+        auth.addAll(getOrganizationUserAuths(organizationUser));
+        return auth;
+    }
+
     /**
      * 得到机构用户数据权限
      *