TRX vor 1 Jahr
Ursprung
Commit
95e928bd9d

+ 2 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/OrganizationMiniModel.java

@@ -25,6 +25,8 @@ public class OrganizationMiniModel {
     @Schema(description = "编码、项目ID、机构编号")
     private String code;
 
+    private String logo;
+
     @Schema(description = "机构类型")
     private AuthType authType = AuthType.Enterprise;
 

+ 2 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/payment/ExpenseFlowPayShowModel.java

@@ -2,6 +2,7 @@ package com.zhongshu.card.client.model.payment;
 
 import com.zhongshu.card.client.model.base.SuperModel;
 import com.zhongshu.card.client.model.devices.DeviceInfoModel;
+import com.zhongshu.card.client.model.org.OrganizationMiniModel;
 import com.zhongshu.card.client.model.org.OrganizationSimpleModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
@@ -38,7 +39,7 @@ public class ExpenseFlowPayShowModel extends SuperModel {
     private DeviceInfoModel deviceInfo;
 
     @Schema(description = "收款机构信息")
-    private OrganizationSimpleModel shopInfo;
+    private OrganizationMiniModel shopInfo;
 
     @Schema(description = "是否可以支付")
     private Boolean isCanPay = Boolean.FALSE;

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

@@ -16,6 +16,7 @@ import com.zhongshu.card.server.core.dao.org.OrganizationDao;
 import com.zhongshu.card.server.core.dao.school.AreaDao;
 import com.zhongshu.card.server.core.dataConfig.DeviceConfig;
 import com.zhongshu.card.server.core.domain.devices.DeviceInfo;
+import com.zhongshu.card.server.core.domain.devices.DeviceProductBindDevice;
 import com.zhongshu.card.server.core.domain.devices.permiss.DevicePermiss;
 import com.zhongshu.card.server.core.domain.org.Organization;
 import com.zhongshu.card.server.core.domain.school.Area;
@@ -468,6 +469,45 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         return model;
     }
 
+    /**
+     * 查询设备的 收款 机构
+     *
+     * @param deviceId
+     * @return
+     */
+    public Organization getDeviceReceiveOrganization(String deviceId) {
+        if (StringUtils.isNotEmpty(deviceId)) {
+            DeviceInfo deviceInfo = deviceInfoDao.findTopByDeviceId(deviceId);
+            return getDeviceReceiveOrganization(deviceInfo);
+        }
+        return null;
+    }
+
+    /**
+     * 查询设备的 收款 机构
+     *
+     * @param deviceInfo
+     * @return
+     */
+    public Organization getDeviceReceiveOrganization(DeviceInfo deviceInfo) {
+        Organization organization = null;
+        if (ObjectUtils.isNotEmpty(deviceInfo)) {
+            String oid = deviceInfo.getBeLongOid();
+            if (StringUtils.isEmpty(oid)) {
+                // 查找产品绑定的产品
+                DeviceProductBindDevice bindInfo = deviceProductBindDeviceService.getDeviceBindInfo(deviceInfo);
+                if (ObjectUtils.isNotEmpty(bindInfo) && bindInfo.getDeviceProduct() != null) {
+                    oid = bindInfo.getDeviceProduct().getBeLongOid();
+                }
+            }
+
+            if (StringUtils.isNotEmpty(oid)) {
+                organization = organizationDao.findTopByOid(oid);
+            }
+        }
+        return organization;
+    }
+
     /**
      * 设备信息  简单模型
      *

+ 12 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/devices/deviceProduct/DeviceProductBindDeviceService.java

@@ -171,6 +171,18 @@ public class DeviceProductBindDeviceService extends SuperService {
         return Lists.newArrayList();
     }
 
+    /**
+     * 得到设备的绑定产品 关系信息
+     *
+     * @param deviceInfo
+     * @return
+     */
+    public DeviceProductBindDevice getDeviceBindInfo(DeviceInfo deviceInfo) {
+        if (deviceInfo != null) {
+            return deviceProductBindDeviceDao.findTopByDeviceIdOrderByCreateTimeDesc(deviceInfo.getDeviceId());
+        }
+        return null;
+    }
 
     private DeviceProductBindDeviceModel toModel(DeviceProductBindDevice entity) {
         DeviceProductBindDeviceModel model = new DeviceProductBindDeviceModel();

+ 16 - 6
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/payment/ExpenseFlowServiceImpl.java

@@ -19,7 +19,7 @@ import com.github.microservice.types.payment.ChargeableType;
 import com.github.microservice.types.payment.PaymentDeviceType;
 import com.github.microservice.types.payment.PaymentType;
 import com.zhongshu.card.client.model.base.SuperSearch;
-import com.zhongshu.card.client.model.org.OrganizationSimpleModel;
+import com.zhongshu.card.client.model.org.OrganizationMiniModel;
 import com.zhongshu.card.client.model.org.UserJoinBusOrgModel;
 import com.zhongshu.card.client.model.payment.*;
 import com.zhongshu.card.client.model.payment.statistic.BusinessMainStatisticModel;
@@ -50,6 +50,7 @@ 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.devices.permiss.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.ProjectPaySettingServiceImpl;
 import com.zhongshu.card.server.core.service.school.AreaServiceImpl;
 import com.zhongshu.card.server.core.util.*;
@@ -116,6 +117,9 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
     @Autowired
     private DeviceInfoServiceImpl deviceInfoService;
 
+    @Autowired
+    private OrganizationManagerServiceImpl organizationManagerService;
+
     /**
      * 创建流水
      *
@@ -284,8 +288,10 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
                 entity.setVerifyError(String.format("设备未绑定机构"));
                 return;
             }
+            Organization organization = deviceInfoService.getDeviceReceiveOrganization(deviceInfo);
             // 设备所属的商户/机构
-            entity.setShopOid(deviceInfo.getBeLongOid());
+            entity.setShopOid(organization.getOid());
+            entity.setOid(organization.getOid());
             // 设备区域
             entity.setArea(areaService.toSimpleModel(deviceInfo.getArea()));
             // 填充项目信息
@@ -838,6 +844,12 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
         return ResultContent.buildSuccess(model);
     }
 
+    /**
+     * 支付订单的详情(简要)转换
+     *
+     * @param entity
+     * @return
+     */
     public ExpenseFlowPayShowModel toPayShowModel(ExpenseFlow entity) {
         ExpenseFlowPayShowModel model = new ExpenseFlowPayShowModel();
         if (ObjectUtils.isNotEmpty(entity)) {
@@ -849,10 +861,8 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
             }
 
             // 收款机构信息
-            ResultContent<OrganizationSimpleModel> orgContent = organizationService.getDetail(entity.getShopOid());
-            if (orgContent.isSuccess()) {
-                model.setShopInfo(orgContent.getContent());
-            }
+            OrganizationMiniModel organizationMiniModel = organizationManagerService.toMiniModel(organizationService.getOrgByOid(entity.getShopOid()));
+            model.setShopInfo(organizationMiniModel);
 
             // 判断是否可以支付
             OrderPayModel payModel = isCanPay(entity);