You've already forked FrameTour-BE
免费送照片
This commit is contained in:
@@ -93,4 +93,6 @@ public class ScenicConfigEntity {
|
|||||||
private String videoSourcePackHint;
|
private String videoSourcePackHint;
|
||||||
|
|
||||||
private String extraNotificationTime;
|
private String extraNotificationTime;
|
||||||
|
|
||||||
|
private Integer photoFreeNum;
|
||||||
}
|
}
|
||||||
|
@@ -52,11 +52,13 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -296,6 +298,29 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
}
|
}
|
||||||
return memberSourceEntity;
|
return memberSourceEntity;
|
||||||
}).collect(Collectors.toList());
|
}).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()) {
|
if (!memberSourceEntityList.isEmpty()) {
|
||||||
sourceMapper.addRelations(memberSourceEntityList);
|
sourceMapper.addRelations(memberSourceEntityList);
|
||||||
taskTaskService.autoCreateTaskByFaceId(face.getId());
|
taskTaskService.autoCreateTaskByFaceId(face.getId());
|
||||||
|
@@ -126,7 +126,8 @@
|
|||||||
pay_config_json=#{payConfigJson},
|
pay_config_json=#{payConfigJson},
|
||||||
image_source_pack_hint=#{imageSourcePackHint},
|
image_source_pack_hint=#{imageSourcePackHint},
|
||||||
video_source_pack_hint=#{videoSourcePackHint},
|
video_source_pack_hint=#{videoSourcePackHint},
|
||||||
extra_notification_time=#{extraNotificationTime}
|
extra_notification_time=#{extraNotificationTime},
|
||||||
|
photo_free_num= #{photoFreeNum}
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
Reference in New Issue
Block a user