|
|
@@ -30,6 +30,8 @@ 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.DevicePermissChangeEvent;
|
|
|
+import com.zhongshu.card.server.core.event.UserInfoChangeSyncEvent;
|
|
|
import com.zhongshu.card.server.core.service.base.SuperService;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.org.OrganizationUserServiceImpl;
|
|
|
@@ -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,9 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
@Autowired
|
|
|
CardInfoPoolService cardInfoPoolService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ ApplicationContext applicationContext;
|
|
|
+
|
|
|
/**
|
|
|
* 添加或修改卡片信息
|
|
|
*
|
|
|
@@ -159,6 +165,7 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfo.setAboutOid(oidAboutInfo.getOid());
|
|
|
cardInfo.setAboutAuthType(oidAboutInfo.getAuthType());
|
|
|
cardInfoDao.save(cardInfo);
|
|
|
+
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -288,6 +295,11 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoPool.setUseTime(null);
|
|
|
cardInfoPoolDao.save(cardInfoPool);
|
|
|
}
|
|
|
+
|
|
|
+ // 用户可用卡片减少
|
|
|
+ UserInfoChangeSyncEvent event = new UserInfoChangeSyncEvent(this,
|
|
|
+ List.of(cardInfo.getUserId()), cardInfo.getProjectOid());
|
|
|
+ applicationContext.publishEvent(event);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -549,6 +561,10 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Enable);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
|
|
|
+ // 用户可用卡片发生变化
|
|
|
+ UserInfoChangeSyncEvent event = new UserInfoChangeSyncEvent(this,
|
|
|
+ List.of(cardInfo.getUserId()), cardInfo.getProjectOid());
|
|
|
+ applicationContext.publishEvent(event);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -658,6 +674,9 @@ public class CardInfoServiceImpl extends SuperService implements CardInfoService
|
|
|
cardInfoLossRecord.setOperationType(CardOperationType.Enable);
|
|
|
cardInfoLossRecordDao.save(cardInfoLossRecord);
|
|
|
|
|
|
+ UserInfoChangeSyncEvent event = new UserInfoChangeSyncEvent(this,
|
|
|
+ List.of(cardInfo.getUserId()), cardInfo.getProjectOid());
|
|
|
+ applicationContext.publishEvent(event);
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
@@ -745,6 +764,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 +820,16 @@ 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());
|
|
|
}
|
|
|
+
|
|
|
+ UserInfoChangeSyncEvent event = new UserInfoChangeSyncEvent(this,
|
|
|
+ userIds, projectOid);
|
|
|
+ applicationContext.publishEvent(event);
|
|
|
}
|
|
|
model.setSuccess(cardInfoPools.size());
|
|
|
model.setFailDetails(failDetails);
|