You've already forked FrameTour-BE
免费送照片
This commit is contained in:
@@ -93,4 +93,6 @@ public class ScenicConfigEntity {
|
||||
private String videoSourcePackHint;
|
||||
|
||||
private String extraNotificationTime;
|
||||
|
||||
private Integer photoFreeNum;
|
||||
}
|
||||
|
@@ -52,11 +52,13 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -296,6 +298,29 @@ public class FaceServiceImpl implements FaceService {
|
||||
}
|
||||
return memberSourceEntity;
|
||||
}).collect(Collectors.toList());
|
||||
if (isNew) {
|
||||
if (scenicConfig != null && scenicConfig.getPhotoFreeNum() != null && scenicConfig.getPhotoFreeNum() > 0) {
|
||||
List<Integer> randInt = new ArrayList<>();
|
||||
if (scenicConfig.getPhotoFreeNum() > memberSourceEntityList.size()) {
|
||||
for (MemberSourceEntity memberSourceEntity : memberSourceEntityList) {
|
||||
memberSourceEntity.setIsFree(1);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < scenicConfig.getPhotoFreeNum(); i++) {
|
||||
// 随机
|
||||
Integer idx;
|
||||
while (true) {
|
||||
idx = new Random().nextInt(memberSourceEntityList.size());
|
||||
if (!randInt.contains(idx)) {
|
||||
randInt.add(idx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
memberSourceEntityList.get(idx).setIsFree(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!memberSourceEntityList.isEmpty()) {
|
||||
sourceMapper.addRelations(memberSourceEntityList);
|
||||
taskTaskService.autoCreateTaskByFaceId(face.getId());
|
||||
|
Reference in New Issue
Block a user