TRX 1 год назад
Родитель
Сommit
98d85720ef

+ 5 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/devices/DeviceInfoDao.java

@@ -1,6 +1,7 @@
 package com.zhongshu.card.server.core.dao.devices;
 
 import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.card.client.type.OnLineState;
 import com.zhongshu.card.server.core.dao.devices.extend.DeviceInfoDaoExtend;
 import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
 
@@ -24,4 +25,8 @@ public interface DeviceInfoDao extends MongoDao<DeviceInfo>, DeviceInfoDaoExtend
 
     List<DeviceInfo> findByDeviceIdIn(List<String> deviceIds);
 
+    long countByProjectOid(String projectOid);
+
+    long countByProjectIdAndOnLineState(String projectId, OnLineState onLineState);
+
 }

+ 2 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/org/OrganizationUserDao.java

@@ -49,6 +49,8 @@ public interface OrganizationUserDao extends MongoDao<OrganizationUser>, Organiz
 
     long countByUserAndStateAndAuthType(UserAccount user, UserState state, AuthType authType);
 
+    long countByProjectOid(String projectOid);
+
     long countByOrganization(Organization organization);
 
     void deleteByOrganization(Organization organization);

+ 11 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/devices/DeviceInfoServiceImpl.java

@@ -26,10 +26,10 @@ import com.zhongshu.card.server.core.service.base.CommonService;
 import com.zhongshu.card.server.core.service.base.SuperService;
 import com.zhongshu.card.server.core.service.devices.deviceProduct.DeviceProductBindDeviceService;
 import com.zhongshu.card.server.core.service.devices.permiss.DevicePermissEventService;
-import com.zhongshu.card.server.core.service.permissVerify.DevicePermissVerifyService;
 import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
 import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
 import com.zhongshu.card.server.core.service.paySetting.OrgPaySettingJudgmentService;
+import com.zhongshu.card.server.core.service.permissVerify.DevicePermissVerifyService;
 import com.zhongshu.card.server.core.service.school.AreaServiceImpl;
 import com.zhongshu.card.server.core.util.BeanUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -607,6 +607,16 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         return organization;
     }
 
+    public Long countProjectTotal(String projectOid, OnLineState onLineState) {
+        if (StringUtils.isEmpty(projectOid)) {
+            return 0L;
+        }
+        if (onLineState == null) {
+            return deviceInfoDao.countByProjectOid(projectOid);
+        }
+        return deviceInfoDao.countByProjectIdAndOnLineState(projectOid, onLineState);
+    }
+
     /**
      * 设备信息  简单模型
      *

+ 11 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java

@@ -26,6 +26,7 @@ import com.zhongshu.card.server.core.dao.org.*;
 import com.zhongshu.card.server.core.dataConfig.CardSystemDefault;
 import com.zhongshu.card.server.core.domain.org.*;
 import com.zhongshu.card.server.core.service.base.SuperService;
+import com.zhongshu.card.server.core.service.devices.DeviceInfoServiceImpl;
 import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
 import com.zhongshu.card.server.core.service.orgManager.ProjectBindOrgServiceImpl;
 import com.zhongshu.card.server.core.service.projectAbout.ProjectCommonConfigService;
@@ -131,6 +132,9 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
     @Autowired
     private NetDiskAccountService netDiskAccountService;
 
+    @Autowired
+    private DeviceInfoServiceImpl deviceInfoService;
+
     /**
      * 保存项目信息
      *
@@ -1239,7 +1243,13 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
 
             model.setManagerUserList(userAccountService.toListSimpleModel(userAccountService.getUserAccounts(entity.getManagerUserIds())));
 
-            // 在线设备数量
+            String projectOid = entity.getOid();
+            // 用户数量
+            model.setUserNumber(organizationUserServiceImpl.countProjectUser(projectOid));
+
+            // 设备数量
+            model.setDeviceNumber(deviceInfoService.countProjectTotal(projectOid, null));
+            model.setOnLineNumber(deviceInfoService.countProjectTotal(projectOid, OnLineState.OnLine));
 
             // 是否完成配置
             model.setIsFinishWeChat(projectWeChatInfoService.isFinishConfig(entity.getOid()));

+ 12 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationUserServiceImpl.java

@@ -989,6 +989,18 @@ public class OrganizationUserServiceImpl extends SuperService {
         return ResultContent.buildSuccess(model);
     }
 
+    /**
+     * 统计项目人数
+     * @param projectOid
+     * @return
+     */
+    public Long countProjectUser(String projectOid) {
+        if (StringUtils.isEmpty(projectOid)) {
+            return 0L;
+        }
+        return organizationUserDao.countByProjectOid(projectOid);
+    }
+
     /**
      * 导出项目用户
      *

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

@@ -44,12 +44,12 @@ public class WechatPayService extends SuperService {
     @Autowired
     TransactionLogService transactionLogService;
 
-    public ResultContent<Object> prepay(WeChatPrepayParam param){
+    public ResultContent<Object> prepay(WeChatPrepayParam param) {
         String projectOid = getCurrentProjectOid();
         String userId = getCurrentUserId();
         String appId = getCurrentAppId();
 
-        if (StringUtils.isBlank(projectOid)){
+        if (StringUtils.isBlank(projectOid)) {
             return com.github.microservice.net.ResultContent.buildFail("获取项目id失败");
         }
 
@@ -57,7 +57,6 @@ public class WechatPayService extends SuperService {
         param.setUserId(userId);
         param.setAppid(appId);
 
-
         //根据项目id和支付渠道获取支付账户名
         String accountName = orgPayAccountService.queryOgPayAccount(param.getOid(), PaymentType.WeChatPay);
 
@@ -72,7 +71,7 @@ public class WechatPayService extends SuperService {
         return com.github.microservice.net.ResultContent.buildContent(prepay.getContent());
     }
 
-    public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handleTransactions(String projectOid, String oid, String userId, String orderNo, BigDecimal total){
+    public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handleTransactions(String projectOid, String oid, String userId, String orderNo, BigDecimal total) {
 
         //获取机构待结算账户
         PayAccount orgWaitSettle = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.WaitSettle);
@@ -89,7 +88,7 @@ public class WechatPayService extends SuperService {
         sourceTransaction.setTransactionStatus(TransactionStatus.Success);
         sourceTransaction.setAmount(total.negate().longValue());
         sourceTransaction.setRemark("微信小程序支付");
-        sourceTransaction.setMeta(Map.of("paymentType",PaymentType.WeChat, "description","微信小程序支付", "summary", "微信小程序支付"));
+        sourceTransaction.setMeta(Map.of("paymentType", PaymentType.WeChat, "description", "微信小程序支付", "summary", "微信小程序支付"));
         transferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
 
         //构建入账账户
@@ -98,7 +97,7 @@ public class WechatPayService extends SuperService {
         destinationTransaction.setOrderNumber(orderNo);
         destinationTransaction.setAmount(total.longValue());
         destinationTransaction.setRemark("微信小程序支付");
-        destinationTransaction.setMeta(Map.of("paymentType",PaymentType.WeChat, "description","微信小程序支付", "summary", "微信小程序支付"));
+        destinationTransaction.setMeta(Map.of("paymentType", PaymentType.WeChat, "description", "微信小程序支付", "summary", "微信小程序支付"));
         transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
         return transactionLogService.transfer(transferModel);
     }
@@ -121,7 +120,7 @@ public class WechatPayService extends SuperService {
         return ResultContent.buildFail(refundResult.getMsg());
     }
 
-    public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handleRefundTransactions(String projectOid, String oid, String userId, String refundOrderNo, BigDecimal refundTotal){
+    public com.github.microservice.pay.client.ret.ResultContent<List<TransactionLogModel>> handleRefundTransactions(String projectOid, String oid, String userId, String refundOrderNo, BigDecimal refundTotal) {
         //获取机构待结算账户
         PayAccount orgWaitSettle = payAccountService.getOrgChildren(projectOid, oid, PaymentChannelType.WaitSettle);
         //获取用户余额支付子账
@@ -137,7 +136,7 @@ public class WechatPayService extends SuperService {
         sourceTransaction.setTransactionStatus(TransactionStatus.Success);
         sourceTransaction.setAmount(refundTotal.negate().longValue());
         sourceTransaction.setRemark("微信小程序支付");
-        sourceTransaction.setMeta(Map.of("paymentType",PaymentType.WeChat, "description","微信小程序支付", "summary", "微信小程序支付"));
+        sourceTransaction.setMeta(Map.of("paymentType", PaymentType.WeChat, "description", "微信小程序支付", "summary", "微信小程序支付"));
         transferModel.setSource(new TransferTransactionsModel.GeneralLedgerTransaction[]{sourceTransaction});
 
         //构建入账账户
@@ -146,7 +145,7 @@ public class WechatPayService extends SuperService {
         destinationTransaction.setOrderNumber(refundOrderNo);
         destinationTransaction.setAmount(refundTotal.longValue());
         destinationTransaction.setRemark("微信小程序支付");
-        destinationTransaction.setMeta(Map.of("paymentType",PaymentType.WeChat, "description","微信小程序支付", "summary", "微信小程序支付"));
+        destinationTransaction.setMeta(Map.of("paymentType", PaymentType.WeChat, "description", "微信小程序支付", "summary", "微信小程序支付"));
         transferModel.setDestinations(new TransferTransactionsModel.GeneralLedgerTransaction[]{destinationTransaction});
         return transactionLogService.transfer(transferModel);
     }

+ 10 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/test/Test.java

@@ -1,9 +1,11 @@
 package com.zhongshu.card.server.core.test;
 
-import com.github.microservice.types.deviceUse.DeviceType;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.github.microservice.models.property.PostGetPropertyParam;
 import com.zhongshu.card.client.type.CommonEnum;
 
-import java.util.*;
+import java.util.Calendar;
 
 /**
  * @author TRX
@@ -44,8 +46,13 @@ public class Test {
 //        } catch (Exception e) {
 //            e.printStackTrace();
 //        }
+        PostGetPropertyParam propertyParam = new PostGetPropertyParam();
+        propertyParam.addProperty("a001", "name");
+        propertyParam.addProperty("a001", "name");
+        propertyParam.addProperty("a001", "age");
 
-        test(DeviceType.values());
+        JSONObject data = JSONUtil.parseObj(propertyParam);
+        System.out.println(JSONUtil.toJsonStr(data));
 
         Calendar calendar = Calendar.getInstance();
         calendar.add(Calendar.DATE, 5);