|
|
@@ -21,6 +21,7 @@ import java.util.BitSet;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
+ * message send record service
|
|
|
* @author linwenhua
|
|
|
* @date 2022-06-30 17:40
|
|
|
**/
|
|
|
@@ -58,18 +59,26 @@ public class InformMessageRecordServiceImpl extends ServiceImpl<InformMessageRec
|
|
|
List<InformMessageRecordDO> messageRecordDos = this.list(Wrappers
|
|
|
.<InformMessageRecordDO>lambdaQuery()
|
|
|
.eq(InformMessageRecordDO::getContentId, contentId));
|
|
|
- messageRecordDos.forEach(record -> {
|
|
|
- BitSet userBitMap = record.getBitMap();
|
|
|
+ messageRecordDos.forEach(messageRecordDo -> {
|
|
|
+ BitSet userBitMap = messageRecordDo.getBitMap();
|
|
|
userBitMap.and(informBitMap);
|
|
|
if (userBitMap.isEmpty()) {
|
|
|
- record.setInformStatus(0);
|
|
|
+ messageRecordDo.setInformStatus(0);
|
|
|
} else {
|
|
|
- record.setInformFlag((int) userBitMap.toByteArray()[0]);
|
|
|
+ messageRecordDo.setInformStatus((int) userBitMap.toByteArray()[0]);
|
|
|
}
|
|
|
});
|
|
|
this.updateBatchById(messageRecordDos);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * save message content
|
|
|
+ * @param informMessageRecordDto record
|
|
|
+ * @param informStrategyCmd strategy
|
|
|
+ * @param size record count
|
|
|
+ * @return contentId
|
|
|
+ * @throws JsonProcessingException json parse exception
|
|
|
+ */
|
|
|
private Long saveMessageContent(InformMessageRecordDto informMessageRecordDto, ExceptionInformStrategyCmd informStrategyCmd, Integer size) throws JsonProcessingException {
|
|
|
InformMessageContentRecordDto informMessageContentRecordDto = new InformMessageContentRecordDto();
|
|
|
informMessageContentRecordDto.setTenant(informMessageRecordDto.getTenant());
|
|
|
@@ -79,6 +88,17 @@ public class InformMessageRecordServiceImpl extends ServiceImpl<InformMessageRec
|
|
|
return informMessageContentRecordService.saveContentRecord(informMessageContentRecordDto);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * get inform flag by bitMap
|
|
|
+ * 从低位开始
|
|
|
+ * 0 位: note 1
|
|
|
+ * 1 位: email 2
|
|
|
+ * 2 位: weChat 4
|
|
|
+ * 3 位: weChatApplet 8
|
|
|
+ * @param keycloakUserCo user
|
|
|
+ * @param informStrategyCmd strategy
|
|
|
+ * @return flag
|
|
|
+ */
|
|
|
private Integer getInformFlag(KeycloakUserCO keycloakUserCo, ExceptionInformStrategyCmd informStrategyCmd) {
|
|
|
log.info("user: {}", keycloakUserCo);
|
|
|
BitSet userBitSet = keycloakUserCo.getInformFlag();
|