|
|
@@ -30,7 +30,9 @@ import com.zhongshu.card.server.core.domain.org.UserAccount;
|
|
|
import com.zhongshu.card.server.core.domain.school.CardInfo;
|
|
|
import com.zhongshu.card.server.core.domain.school.CardInfoLossRecord;
|
|
|
import com.zhongshu.card.server.core.domain.school.CardInfoPool;
|
|
|
+import com.zhongshu.card.server.core.event.UserInfoChangeSyncEvent;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
+import com.zhongshu.card.server.core.service.devices.DevicePermissEventService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationUserServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.orgManager.OrganizationManagerServiceImpl;
|
|
|
@@ -45,6 +47,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
@@ -105,6 +108,12 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
@Autowired
|
|
|
CardInfoPoolService cardInfoPoolService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ApplicationContext applicationContext;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DevicePermissEventService devicePermissEventService;
|
|
|
+
|
|
|
/**
|
|
|
* 添加或修改卡片信息
|
|
|
*
|
|
|
@@ -159,6 +168,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfo.setAboutOid(oidAboutInfo.getOid());
|
|
|
cardInfo.setAboutAuthType(oidAboutInfo.getAuthType());
|
|
|
cardInfoDao.save(cardInfo);
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -262,6 +272,9 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoPool.setUseUserId(userId);
|
|
|
cardInfoPool.setUseTime(System.currentTimeMillis());
|
|
|
cardInfoPoolDao.save(cardInfoPool);
|
|
|
+
|
|
|
+ // 用户卡片增多
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -288,6 +301,9 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoPool.setUseTime(null);
|
|
|
cardInfoPoolDao.save(cardInfoPool);
|
|
|
}
|
|
|
+
|
|
|
+ // 用户可用卡片减少
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -453,6 +469,9 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setCardUserAccount(cardUserAccount);
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Loss);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
+
|
|
|
+ // 卡片信息发送变化
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -487,7 +506,8 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setCardUserAccount(userAccount);
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Enable);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
-
|
|
|
+ // 卡片信息发送变化
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -549,6 +569,8 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Enable);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
|
|
|
+ // 用户可用卡片发生变化
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -658,6 +680,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Enable);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(cardInfo.getUserId(), cardInfo.getProjectOid());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -745,6 +768,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
List<String> failDetails = new ArrayList<>();
|
|
|
List<CardInfoPoolBind2OrgUserParam> cardInfoPools = new ArrayList<>();
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
+ List<String> userIds = new ArrayList<>();
|
|
|
for (CardInfoBindImportParam bindImportParam : list) {
|
|
|
startRow++;
|
|
|
CardInfoPoolBind2OrgUserParam bind2OrgUserParam = new CardInfoPoolBind2OrgUserParam();
|
|
|
@@ -800,11 +824,14 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
codeMap.put(code, phone);
|
|
|
bind2OrgUserParam.setId(organizationUser.getId());
|
|
|
cardInfoPools.add(bind2OrgUserParam);
|
|
|
+ userIds.add(userAccount.getUserId());
|
|
|
}
|
|
|
if (ObjectUtils.isNotEmpty(cardInfoPools)) {
|
|
|
for (CardInfoPoolBind2OrgUserParam bind2OrgUserParam : cardInfoPools) {
|
|
|
bindCardFromPoolByOrgId(bind2OrgUserParam.getPoolId(), bind2OrgUserParam.getId(), bind2OrgUserParam.getRemark());
|
|
|
}
|
|
|
+
|
|
|
+ devicePermissEventService.sendUserInfoChangeEvent(userIds, projectOid);
|
|
|
}
|
|
|
model.setSuccess(cardInfoPools.size());
|
|
|
model.setFailDetails(failDetails);
|