TRX 1 рік тому
батько
коміт
d870c5140b

+ 7 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/devices/DeviceBindAreaParam.java

@@ -26,9 +26,15 @@ public class DeviceBindAreaParam {
     @Schema(description = "区域ID")
     private String areaId;
 
-    @Schema(description = "所属机构信息")
+    @Schema(description = "收款机构信息")
     private String beLongOid;
 
+    @Schema(description = "所属机构oid")
+    private String beToOid;
+
+    @Schema(description = "账单所属机构oid")
+    private String billOid;
+
     @Schema(description = "设备关联的扩展信息")
     private DeviceAboutInfo aboutInfo;
 

+ 35 - 3
FullCardClient/src/main/java/com/zhongshu/card/client/model/devices/DeviceInfoModel.java

@@ -65,13 +65,13 @@ public class DeviceInfoModel extends SuperModel {
     @Schema(description = "关联的项目信息")
     private OrganizationSimpleModel projectInfo;
 
-    @Schema(description = "")
+    @Schema(description = "收款机构")
     private OrganizationMiniModel organization;
 
-    @Schema(description = "所属机构信息")
+    @Schema(description = "收款机构oid")
     private String beLongOid;
 
-    @Schema(description = "所属机构信息")
+    @Schema(description = "收款机构名称")
     private String beLongName;
 
     public String getBeLongOid() {
@@ -88,6 +88,38 @@ public class DeviceInfoModel extends SuperModel {
         return "";
     }
 
+    @Schema(description = "所属机构")
+    private OrganizationMiniModel beToOrganization;
+
+    @Schema(description = "所属机构oid")
+    private String beToOid;
+
+    @Schema(description = "所属机构名称")
+    private String beToName;
+
+    public String getBeToName() {
+        if (beToOrganization != null) {
+            return beToOrganization.getName();
+        }
+        return "";
+    }
+
+    @Schema(description = "账单所属机构")
+    private OrganizationMiniModel billOrganization;
+
+    @Schema(description = "账单所属机构oid")
+    private String billOid;
+
+    @Schema(description = "账单所属机构名称")
+    private String billName;
+
+    public String getBillName() {
+        if (ObjectUtils.isNotEmpty(billOrganization)) {
+            return billOrganization.getName();
+        }
+        return "";
+    }
+
     @Schema(description = "是否在线")
     private OnLineState onLineState = OnLineState.OnLine;
 

+ 1 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/scene/RoleSceneInfoDao.java

@@ -10,7 +10,7 @@ public interface RoleSceneInfoDao extends MongoDao<RoleSceneInfo> {
 
     RoleSceneInfo findTopById(String id);
 
-    RoleSceneInfo findTopByRoleIdAndComponentId(String roleId, SceneComponent component);
+    RoleSceneInfo findTopByRoleIdAndComponent(String roleId, SceneComponent component);
 
     RoleSceneInfo findTopByProjectSceneInfoIdAndRoleId(String projectSceneInfoId, String roleId);
 

+ 18 - 3
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/devices/DeviceInfo.java

@@ -44,15 +44,30 @@ public class DeviceInfo extends SuperMain {
     @Schema(description = "关联的项目Name")
     private String projectInfoName;
 
-    @Schema(description = "所属机构")
+    //----------------------所属机构 start----------------
+    @Schema(description = "所属机构oid")
+    private String beToOid;
+
+    @Schema(description = "所属机构名称")
+    private String beToName;
+
+    //----------------------收款机构 start ---------------
+    @Schema(description = "收款机构")
     @DBRef(lazy = true)
     private Organization organization;
 
-    @Schema(description = "所属机构oid")
+    @Schema(description = "收款机构oid")
     private String beLongOid;
 
-    @Schema(description = "所属机构name")
+    @Schema(description = "收款机构name")
     private String beLongName;
+    //----------------------收款机构 end -----------------
+
+    @Schema(description = "账单所属机构oid")
+    private String billOid;
+
+    @Schema(description = "账单所属机构名称")
+    private String billName;
 
     @Schema(description = "设备类型,如 消费机 门禁机")
     private DeviceType deviceType;

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

@@ -323,6 +323,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
 
     /**
      * 设备包含的 商品、、收款机构等信息 转换
+     *
      * @param entity
      * @return
      */
@@ -345,6 +346,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         if (ObjectUtils.isEmpty(deviceInfo)) {
             return ResultContent.buildFail(String.format(ResultMessage.DATA_NOT_EXIST, param.getId()));
         }
+
         Area area = null;
         List<String> strings = new ArrayList<>();
         // 修改设备 只能绑定 区域 所属机构等信息
@@ -365,7 +367,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         deviceInfo.setAreaPaths(String.join("/", strings));
         deviceInfo.setDeviceName(param.getDeviceName());
 
-        // 设备所属机构
+        // 设备收款机构
         Organization organization = null;
         if (StringUtils.isNotEmpty(param.getBeLongOid())) {
             organization = organizationDao.findTopByOid(param.getBeLongOid());
@@ -377,6 +379,31 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         deviceInfo.setOrganization(organization);
         deviceInfo.setBeLongOid(param.getBeLongOid());
 
+        // 设备所属机构
+        Organization beToOrganization = null;
+        if (StringUtils.isNotEmpty(param.getBeToOid())) {
+            beToOrganization = organizationDao.findTopByOid(param.getBeToOid());
+        }
+        if (ObjectUtils.isNotEmpty(beToOrganization)) {
+            deviceInfo.setAboutOid(beToOrganization.getOid());
+            deviceInfo.setBeToName(beToOrganization.getName());
+        } else {
+            deviceInfo.setBeToName("");
+            deviceInfo.setBeToOid("");
+        }
+
+        Organization billOrganization = null;
+        if (StringUtils.isNotEmpty(param.getBillOid())) {
+            billOrganization = organizationDao.findTopByOid(param.getBillOid());
+        }
+        if (ObjectUtils.isNotEmpty(billOrganization)) {
+            deviceInfo.setBillOid(billOrganization.getOid());
+            deviceInfo.setBillName(billOrganization.getName());
+        } else {
+            deviceInfo.setBillName("");
+            deviceInfo.setBillOid("");
+        }
+
         if (StringUtils.isEmpty(deviceInfo.getProjectOid())) {
             Organization project = organizationDao.findTopByCode(deviceInfo.getProjectInfoCode());
             if (ObjectUtils.isNotEmpty(project)) {
@@ -399,23 +426,6 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         return ResultContent.buildSuccess();
     }
 
-    /**
-     * 查询设备所属机构(设备绑定的那个机构)
-     *
-     * @param deviceId
-     * @return
-     */
-    public Organization getDeviceBelongTo(String deviceId) {
-        Organization organization = null;
-        if (StringUtils.isNotEmpty(deviceId)) {
-            DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
-            if (ObjectUtils.isNotEmpty(deviceInfo)) {
-                organization = deviceInfo.getOrganization();
-            }
-        }
-        return organization;
-    }
-
     /**
      * 启动平台时检查设备 (有些设备没有使用了,没有改变在线状态)
      */
@@ -436,18 +446,6 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         }
     }
 
-    /**
-     * 得到、封装设备的扩展信息
-     *
-     * @param deviceId
-     */
-    public void getDeviceAboutInfo(String deviceId) {
-        DeviceInfo deviceInfo = deviceInfoDao.findTopById(deviceId);
-        if (ObjectUtils.isNotEmpty(deviceInfo)) {
-
-        }
-    }
-
     public List<DeviceInfo> getDevicesByDeviceIds(List<String> deviceIds) {
         if (ObjectUtils.isNotEmpty(deviceIds)) {
             return deviceInfoDao.findByDeviceIdIn(deviceIds);
@@ -501,10 +499,18 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         DeviceInfoModel model = null;
         if (ObjectUtils.isNotEmpty(entity)) {
             model = new DeviceInfoModel();
-            // 所属机构信息
+            // 收款机构信息
             OrganizationMiniModel miniModel = organizationManagerService.toMiniModel(entity.getOrganization());
             model.setOrganization(miniModel);
 
+            // 所属机构
+            OrganizationMiniModel beToMiniModel = organizationManagerService.toMiniModel(organizationServiceImpl.getOrgByOid(entity.getBeToOid()));
+            model.setBeToOrganization(beToMiniModel);
+
+            OrganizationMiniModel billMiniModel = organizationManagerService.toMiniModel(organizationServiceImpl.getOrgByOid(entity.getBillOid()));
+            model.setBillOrganization(billMiniModel);
+
+
             BeanUtils.copyProperties(entity, model);
             model.setProjectInfoName(organizationServiceImpl.getOrgNameByCode(entity.getProjectInfoCode()));
 
@@ -564,6 +570,7 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         Organization organization = null;
         if (ObjectUtils.isNotEmpty(deviceInfo)) {
             String oid = deviceInfo.getBeLongOid();
+
             if (StringUtils.isEmpty(oid)) {
                 // 查找产品绑定的产品
                 DeviceProductBindDevice bindInfo = deviceProductBindDeviceService.getDeviceBindInfo(deviceInfo);
@@ -579,6 +586,23 @@ public class DeviceInfoServiceImpl extends SuperService implements DeviceInfoSer
         return organization;
     }
 
+    /**
+     * 得到所属机构
+     *
+     * @param deviceInfo
+     * @return
+     */
+    public Organization getDeviceBeToOrganization(DeviceInfo deviceInfo) {
+        Organization organization = null;
+        if (ObjectUtils.isNotEmpty(deviceInfo)) {
+            String oid = deviceInfo.getBeToOid();
+            if (StringUtils.isNotEmpty(oid)) {
+                organization = organizationDao.findTopByOid(oid);
+            }
+        }
+        return organization;
+    }
+
     /**
      * 设备信息  简单模型
      *

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

@@ -292,9 +292,11 @@ public class ExpenseFlowServiceImpl extends SuperService implements ExpenseFlowS
                 return;
             }
             Organization organization = deviceInfoService.getDeviceReceiveOrganization(deviceInfo);
-            // 设备所属的商户/机构
+            // 设备收款的商户/机构
             entity.setShopOid(organization.getOid());
+            // 订单关联的机构
             entity.setOid(organization.getOid());
+
             // 设备区域
             entity.setArea(areaService.toSimpleModel(deviceInfo.getArea()));
             // 填充项目信息

+ 6 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/scene/RoleSceneInfoService.java

@@ -82,17 +82,20 @@ public class RoleSceneInfoService extends SuperService {
         long i = 1;
         List<RoleSceneInfo> list = new ArrayList<>();
         for (String id : ids) {
+            // 组件信息
             SceneComponent sceneComponent = sceneComponentDao.findTopById(id);
             if (ObjectUtils.isEmpty(sceneComponent)) {
                 continue;
             }
+            // 所属应用
             SceneInfo sceneInfo = sceneComponent.getSceneInfo();
+            // 项目应用
             ProjectSceneInfo projectSceneInfo = projectSceneInfoDao.findTopBySceneInfoAndProjectOid(sceneInfo, projectOid);
             if (ObjectUtils.isEmpty(projectSceneInfo)) {
                 continue;
             }
 
-            RoleSceneInfo roleSceneInfo = roleSceneInfoDao.findTopByRoleIdAndComponentId(role.getId(), sceneComponent);
+            RoleSceneInfo roleSceneInfo = roleSceneInfoDao.findTopByRoleIdAndComponent(role.getId(), sceneComponent);
             if (ObjectUtils.isEmpty(roleSceneInfo)) {
                 roleSceneInfo = new RoleSceneInfo();
                 initEntityNoCheckOid(roleSceneInfo);
@@ -153,6 +156,8 @@ public class RoleSceneInfoService extends SuperService {
         List<RoleSceneComTreeModel> models = new ArrayList<>();
         List<RoleSceneInfo> list = roleSceneInfoDao.findByRoleIdInOrderBySortAsc(roleIds);
         if (ObjectUtils.isNotEmpty(list)) {
+            list = list.stream().distinct().collect(Collectors.toList());
+
             if (state != null) {
                 list = list.stream().filter(it -> {
                     return it.getProjectSceneInfo().getState() == state && it.getSceneInfo().getState() == state;