You've already forked FrameTour-BE
Compare commits
23 Commits
da20a44049
...
077698cdaa
Author | SHA1 | Date | |
---|---|---|---|
077698cdaa | |||
b141b39e50 | |||
c366495805 | |||
870e79cde5 | |||
2bf8bb4df5 | |||
164e76495e | |||
d9360acb5f | |||
2e92cf5c91 | |||
ef978529ac | |||
6197f13e8e | |||
00f38c949c | |||
c45dffa0a0 | |||
f8f49891a5 | |||
7771f85618 | |||
7583c9e22e | |||
bb26fa43bf | |||
46a8b254b5 | |||
2e41f72e0e | |||
e9d80cecc7 | |||
5a4f6a5af3 | |||
8ef2ef4b15 | |||
3863c0d963 | |||
b36da6ff35 |
2
pom.xml
2
pom.xml
@ -36,7 +36,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||||
<artifactId>wechatpay-java</artifactId>
|
<artifactId>wechatpay-java</artifactId>
|
||||||
<version>0.2.12</version>
|
<version>0.2.14</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 引入aop相关 -->
|
<!-- 引入aop相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.ycwl.basic.constant;
|
package com.ycwl.basic.constant;
|
||||||
|
|
||||||
import com.ycwl.basic.utils.StringUtil;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -40,7 +40,13 @@ public class BaseContextHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getToken() {
|
public static String getToken() {
|
||||||
return StringUtil.a(get("currentUserToken"));
|
if (get("currentUserToken") == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(get("currentUserToken").toString())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return get("currentUserToken").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getAccount() {
|
public static String getAccount() {
|
||||||
|
@ -5,4 +5,6 @@ public class StorageConstant {
|
|||||||
public static final String VIDEO_PIECE_PATH = "source_video";
|
public static final String VIDEO_PIECE_PATH = "source_video";
|
||||||
public static final String PHOTO_PATH = "source_photo";
|
public static final String PHOTO_PATH = "source_photo";
|
||||||
public static final String PHOTO_WATERMARKED_PATH = "photo_w";
|
public static final String PHOTO_WATERMARKED_PATH = "photo_w";
|
||||||
|
public static final String VIID_FACE = "viid_face";
|
||||||
|
public static final String USER_FACE = "user_face";
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,13 @@ public class AppGoodsController {
|
|||||||
return ApiResponse.success(goodsDetailVOS);
|
return ApiResponse.success(goodsDetailVOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("源素材(原片/照片)商品数量")
|
||||||
|
@PostMapping("/sourceGoodsCount")
|
||||||
|
public ApiResponse<Integer> sourceGoodsCount(@RequestBody GoodsReqQuery query) {
|
||||||
|
Integer count = goodsService.sourceGoodsCount(query);
|
||||||
|
return ApiResponse.success(count);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/sourceGoodsList/preview")
|
@PostMapping("/sourceGoodsList/preview")
|
||||||
public ApiResponse<List<GoodsUrlVO>> sourceGoodsListPreview(@RequestBody GoodsReqQuery query) {
|
public ApiResponse<List<GoodsUrlVO>> sourceGoodsListPreview(@RequestBody GoodsReqQuery query) {
|
||||||
List<GoodsUrlVO> goodsUrlList = goodsService.sourceGoodsListPreview(query);
|
List<GoodsUrlVO> goodsUrlList = goodsService.sourceGoodsListPreview(query);
|
||||||
|
@ -2,6 +2,7 @@ package com.ycwl.basic.controller.task;
|
|||||||
|
|
||||||
import com.ycwl.basic.annotation.IgnoreLogReq;
|
import com.ycwl.basic.annotation.IgnoreLogReq;
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
|
||||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.model.task.req.TaskReqVo;
|
import com.ycwl.basic.model.task.req.TaskReqVo;
|
||||||
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||||
@ -11,6 +12,7 @@ import com.ycwl.basic.service.task.TaskService;
|
|||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@ -35,6 +37,11 @@ public class TaskTaskController {
|
|||||||
return ApiResponse.success(respVo);
|
return ApiResponse.success(respVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{taskId}/info")
|
||||||
|
public ApiResponse<TaskRespVO> taskInfo(@PathVariable Long taskId) {
|
||||||
|
return ApiResponse.success(taskService.taskInfo(taskId));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/template/{templateId}")
|
@PostMapping("/template/{templateId}")
|
||||||
public ApiResponse<TemplateRespVO> getTemplateById(@PathVariable Long templateId, @RequestBody WorkerAuthReqVo req) {
|
public ApiResponse<TemplateRespVO> getTemplateById(@PathVariable Long templateId, @RequestBody WorkerAuthReqVo req) {
|
||||||
return ApiResponse.success(taskService.workerGetTemplate(templateId, req));
|
return ApiResponse.success(taskService.workerGetTemplate(templateId, req));
|
||||||
@ -43,7 +50,6 @@ public class TaskTaskController {
|
|||||||
@PostMapping("/{taskId}/uploadUrl")
|
@PostMapping("/{taskId}/uploadUrl")
|
||||||
public ApiResponse<String> getUploadUrl(@PathVariable Long taskId, @RequestBody WorkerAuthReqVo req) {
|
public ApiResponse<String> getUploadUrl(@PathVariable Long taskId, @RequestBody WorkerAuthReqVo req) {
|
||||||
String urlForUpload = taskService.getUploadUrl(taskId, req);
|
String urlForUpload = taskService.getUploadUrl(taskId, req);
|
||||||
urlForUpload = urlForUpload.replace("-internal.aliyuncs.com", ".aliyuncs.com");
|
|
||||||
return ApiResponse.success(urlForUpload);
|
return ApiResponse.success(urlForUpload);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.ycwl.basic.constant.StorageConstant.PHOTO_PATH;
|
import static com.ycwl.basic.constant.StorageConstant.PHOTO_PATH;
|
||||||
|
import static com.ycwl.basic.constant.StorageConstant.VIID_FACE;
|
||||||
|
|
||||||
@IgnoreToken
|
@IgnoreToken
|
||||||
@RestController
|
@RestController
|
||||||
@ -97,8 +98,8 @@ public class ViidController {
|
|||||||
.setNamePrefix("VIID-" + scenicId + "-t")
|
.setNamePrefix("VIID-" + scenicId + "-t")
|
||||||
.build();
|
.build();
|
||||||
return new ThreadPoolExecutor(
|
return new ThreadPoolExecutor(
|
||||||
4, 4096, 0L, TimeUnit.MILLISECONDS,
|
4, 1024, 0L, TimeUnit.MILLISECONDS,
|
||||||
new ArrayBlockingQueue<>(4096),
|
new ArrayBlockingQueue<>(1024),
|
||||||
threadFactory);
|
threadFactory);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -304,7 +305,7 @@ public class ViidController {
|
|||||||
faceSample.setDeviceId(device.getId());
|
faceSample.setDeviceId(device.getId());
|
||||||
faceSample.setStatus(0);
|
faceSample.setStatus(0);
|
||||||
faceSample.setCreateAt(shotTime);
|
faceSample.setCreateAt(shotTime);
|
||||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
String url = adapter.uploadFile(file, VIID_FACE, UUID.randomUUID() + "." + ext);
|
||||||
faceSample.setFaceUrl(url);
|
faceSample.setFaceUrl(url);
|
||||||
faceSampleMapper.add(faceSample);
|
faceSampleMapper.add(faceSample);
|
||||||
ThreadPoolExecutor executor = getExecutor(scenicId);
|
ThreadPoolExecutor executor = getExecutor(scenicId);
|
||||||
@ -365,7 +366,7 @@ public class ViidController {
|
|||||||
faceSample.setDeviceId(device.getId());
|
faceSample.setDeviceId(device.getId());
|
||||||
faceSample.setStatus(0);
|
faceSample.setStatus(0);
|
||||||
faceSample.setCreateAt(shotTime);
|
faceSample.setCreateAt(shotTime);
|
||||||
String url = adapter.uploadFile(file, "user-face", UUID.randomUUID() + "." + ext);
|
String url = adapter.uploadFile(file, VIID_FACE, UUID.randomUUID() + "." + ext);
|
||||||
faceSample.setFaceUrl(url);
|
faceSample.setFaceUrl(url);
|
||||||
faceSampleMapper.add(faceSample);
|
faceSampleMapper.add(faceSample);
|
||||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.ycwl.basic.device.operator;
|
package com.ycwl.basic.device.operator;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ycwl.basic.device.entity.common.FileObject;
|
import com.ycwl.basic.device.entity.common.FileObject;
|
||||||
import com.ycwl.basic.device.entity.vpt_passive.VptPassiveStorageConfig;
|
import com.ycwl.basic.device.entity.vpt_passive.VptPassiveStorageConfig;
|
||||||
import com.ycwl.basic.device.entity.wvp_passive.WvpPassiveStorageConfig;
|
import com.ycwl.basic.device.entity.wvp_passive.WvpPassiveStorageConfig;
|
||||||
@ -9,6 +11,7 @@ import com.ycwl.basic.storage.utils.StorageUtil;
|
|||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -16,6 +19,7 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -25,12 +29,18 @@ public class VptPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
public Long scenicId;
|
public Long scenicId;
|
||||||
public Long deviceId;
|
public Long deviceId;
|
||||||
public String deviceNo;
|
public String deviceNo;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
public Date startTime;
|
public Date startTime;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
public Date endTime;
|
public Date endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Task> taskList = new CopyOnWriteArrayList<>();
|
private static List<Task> taskList = new CopyOnWriteArrayList<>();
|
||||||
private static ConcurrentHashMap<Long, FileObject> fileListMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<Long, FileObject> fileListMap = new ConcurrentHashMap<>();
|
||||||
|
private static RedisTemplate<String, String> redisTemplate = null;
|
||||||
|
private static final String TASK_KEY = "vpt:task:s%s:d%s:";
|
||||||
|
|
||||||
private VptPassiveStorageConfig config;
|
private VptPassiveStorageConfig config;
|
||||||
|
|
||||||
@ -38,6 +48,10 @@ public class VptPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
loadConfig(configJson);
|
loadConfig(configJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setRedisTemplate(RedisTemplate<String, String> redisTemplate) {
|
||||||
|
VptPassiveStorageOperator.redisTemplate = redisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
public static void onReceiveResult(Long taskId, FileObject fileObject) {
|
public static void onReceiveResult(Long taskId, FileObject fileObject) {
|
||||||
if (fileObject == null) {
|
if (fileObject == null) {
|
||||||
log.info("任务{}获取视频失败!", taskId);
|
log.info("任务{}获取视频失败!", taskId);
|
||||||
@ -77,7 +91,11 @@ public class VptPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
}
|
}
|
||||||
task.startTime = startDate;
|
task.startTime = startDate;
|
||||||
task.endTime = endDate;
|
task.endTime = endDate;
|
||||||
taskList.add(task);
|
if (redisTemplate == null) {
|
||||||
|
taskList.add(task);
|
||||||
|
} else {
|
||||||
|
redisTemplate.opsForValue().set(String.format(TASK_KEY, task.scenicId, task.deviceNo) + task.taskId, JSON.toJSONString(task), 10 * 60L, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
log.info("任务{}获取视频开始!共{}", task.taskId, taskList.size());
|
log.info("任务{}获取视频开始!共{}", task.taskId, taskList.size());
|
||||||
Date taskStartTime = new Date();
|
Date taskStartTime = new Date();
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package com.ycwl.basic.device.operator;
|
package com.ycwl.basic.device.operator;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ycwl.basic.device.entity.common.FileObject;
|
import com.ycwl.basic.device.entity.common.FileObject;
|
||||||
import com.ycwl.basic.device.entity.wvp_passive.WvpPassiveStorageConfig;
|
import com.ycwl.basic.device.entity.wvp_passive.WvpPassiveStorageConfig;
|
||||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
import com.ycwl.basic.storage.utils.StorageUtil;
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -14,21 +17,29 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
||||||
|
|
||||||
public static class Task {
|
public static class Task {
|
||||||
public Long taskId;
|
public Long taskId;
|
||||||
public Long scenicId;
|
public Long scenicId;
|
||||||
public Long deviceId;
|
public Long deviceId;
|
||||||
public String deviceNo;
|
public String deviceNo;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
public Date startTime;
|
public Date startTime;
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
public Date endTime;
|
public Date endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Task> taskList = new CopyOnWriteArrayList<>();
|
private static List<Task> taskList = new CopyOnWriteArrayList<>();
|
||||||
private static ConcurrentHashMap<Long, FileObject> fileListMap = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<Long, FileObject> fileListMap = new ConcurrentHashMap<>();
|
||||||
|
private static RedisTemplate<String, String> redisTemplate = null;
|
||||||
|
private static final String TASK_KEY = "wvp:task:s%s:d%s:";
|
||||||
|
|
||||||
private WvpPassiveStorageConfig config;
|
private WvpPassiveStorageConfig config;
|
||||||
|
|
||||||
@ -36,6 +47,11 @@ public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
loadConfig(configJson);
|
loadConfig(configJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void setRedisTemplate(RedisTemplate<String, String> redisTemplate) {
|
||||||
|
WvpPassiveStorageOperator.redisTemplate = redisTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
public static void onReceiveResult(Long taskId, FileObject fileObject) {
|
public static void onReceiveResult(Long taskId, FileObject fileObject) {
|
||||||
if (fileObject == null) {
|
if (fileObject == null) {
|
||||||
log.info("任务{}获取视频失败!", taskId);
|
log.info("任务{}获取视频失败!", taskId);
|
||||||
@ -72,7 +88,11 @@ public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
|||||||
}
|
}
|
||||||
task.startTime = startDate;
|
task.startTime = startDate;
|
||||||
task.endTime = endDate;
|
task.endTime = endDate;
|
||||||
taskList.add(task);
|
if (redisTemplate == null) {
|
||||||
|
taskList.add(task);
|
||||||
|
} else {
|
||||||
|
redisTemplate.opsForValue().set(String.format(TASK_KEY, task.scenicId, task.deviceNo) + task.taskId, JSON.toJSONString(task), 10 * 60L, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
Date taskStartTime = new Date();
|
Date taskStartTime = new Date();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (new Date().getTime() - taskStartTime.getTime() > 60000L) {
|
if (new Date().getTime() - taskStartTime.getTime() > 60000L) {
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.ycwl.basic.device.starter;
|
||||||
|
|
||||||
|
import com.ycwl.basic.device.operator.VptPassiveStorageOperator;
|
||||||
|
import com.ycwl.basic.device.operator.WvpPassiveStorageOperator;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class DeviceStorageOperatorStarter implements InitializingBean {
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
WvpPassiveStorageOperator.setRedisTemplate(redisTemplate);
|
||||||
|
VptPassiveStorageOperator.setRedisTemplate(redisTemplate);
|
||||||
|
}
|
||||||
|
}
|
@ -109,6 +109,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
|||||||
IRateLimiter deleteEntityLimiter = getLimiter(LOCK_TYPE.DELETE_ENTITY);
|
IRateLimiter deleteEntityLimiter = getLimiter(LOCK_TYPE.DELETE_ENTITY);
|
||||||
IRateLimiter deleteDbLimiter = getLimiter(LOCK_TYPE.DELETE_DB);
|
IRateLimiter deleteDbLimiter = getLimiter(LOCK_TYPE.DELETE_DB);
|
||||||
request.setDbName(dbName);
|
request.setDbName(dbName);
|
||||||
|
request.setOrder("asc");
|
||||||
request.setLimit(200);
|
request.setLimit(200);
|
||||||
try (ClientWrapper clientWrapper = getClient()) {
|
try (ClientWrapper clientWrapper = getClient()) {
|
||||||
IAcsClient client = clientWrapper.getClient();
|
IAcsClient client = clientWrapper.getClient();
|
||||||
|
@ -23,6 +23,7 @@ public interface FaceMapper {
|
|||||||
FaceEntity get(Long id);
|
FaceEntity get(Long id);
|
||||||
int add(FaceEntity face);
|
int add(FaceEntity face);
|
||||||
int deleteById(Long id);
|
int deleteById(Long id);
|
||||||
|
int forceDeleteById(Long id);
|
||||||
int deleteByIds(@Param("list") List<Long> ids);
|
int deleteByIds(@Param("list") List<Long> ids);
|
||||||
int update(FaceEntity face);
|
int update(FaceEntity face);
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ public interface SourceMapper {
|
|||||||
int addRelation(MemberSourceEntity source);
|
int addRelation(MemberSourceEntity source);
|
||||||
|
|
||||||
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
|
List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
|
||||||
|
Integer countUser(SourceReqQuery sourceReqQuery);
|
||||||
SourceRespVO listUserOne(Long userId, Long sourceId);
|
SourceRespVO listUserOne(Long userId, Long sourceId);
|
||||||
|
|
||||||
int addRelations(List<MemberSourceEntity> list);
|
int addRelations(List<MemberSourceEntity> list);
|
||||||
|
@ -3,7 +3,9 @@ package com.ycwl.basic.model.mobile.goods;
|
|||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -21,14 +23,8 @@ public class GoodsDetailVO {
|
|||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
@ApiModelProperty("景区名称")
|
@ApiModelProperty("景区名称")
|
||||||
private String scenicName;
|
private String scenicName;
|
||||||
@ApiModelProperty("经度")
|
|
||||||
private BigDecimal longitude;
|
|
||||||
@ApiModelProperty("纬度")
|
|
||||||
private BigDecimal latitude;
|
|
||||||
@ApiModelProperty("商品类型 1:成片视频 2:源素材")
|
@ApiModelProperty("商品类型 1:成片视频 2:源素材")
|
||||||
private Integer goodsType;
|
private Integer goodsType;
|
||||||
@ApiModelProperty("源素材类型 1:视频 2:图片")
|
|
||||||
private Integer sourceType;
|
|
||||||
@ApiModelProperty("商品id goodsType=1时为videoId,goodsType=2时为sourceId")
|
@ApiModelProperty("商品id goodsType=1时为videoId,goodsType=2时为sourceId")
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
@ApiModelProperty("模版封面图片")
|
@ApiModelProperty("模版封面图片")
|
||||||
@ -44,4 +40,8 @@ public class GoodsDetailVO {
|
|||||||
@ApiModelProperty("是否已购买 0否 1是")
|
@ApiModelProperty("是否已购买 0否 1是")
|
||||||
private Integer isBuy;
|
private Integer isBuy;
|
||||||
private Integer isFree;
|
private Integer isFree;
|
||||||
|
private Integer parts;
|
||||||
|
public Integer getSourceType() {
|
||||||
|
return goodsType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ public class DeviceRespVO {
|
|||||||
private Integer online;
|
private Integer online;
|
||||||
private String coverUrl;
|
private String coverUrl;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date coverTime;
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
|
||||||
private Date createAt;
|
private Date createAt;
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date updateAt;
|
private Date updateAt;
|
||||||
|
@ -27,31 +27,6 @@ public class FaceSampleReqQuery extends BaseQueryParameterReq {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("来源设备")
|
@ApiModelProperty("来源设备")
|
||||||
private Long deviceId;
|
private Long deviceId;
|
||||||
/**
|
|
||||||
* 来源ID
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("来源ID")
|
|
||||||
private Long sourceId;
|
|
||||||
/**
|
|
||||||
* 人脸照片
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("人脸照片")
|
|
||||||
private String faceUrl;
|
|
||||||
/**
|
|
||||||
* 与样本匹配的ID,逗号隔开
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("与样本匹配的ID,逗号隔开")
|
|
||||||
private String matchSampleIds;
|
|
||||||
/**
|
|
||||||
* 匹配率
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("匹配率")
|
|
||||||
private String firstMatchRate;
|
|
||||||
/**
|
|
||||||
* 匹配的结果,JSON字符串
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("匹配的结果,JSON字符串")
|
|
||||||
private String matchResult;
|
|
||||||
/**
|
/**
|
||||||
* 是否匹配,0未匹配,1已匹配
|
* 是否匹配,0未匹配,1已匹配
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.ycwl.basic.model.pc.order.resp;
|
package com.ycwl.basic.model.pc.order.resp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
|
||||||
import com.ycwl.basic.model.pc.order.entity.OrderItemEntity;
|
import com.ycwl.basic.model.pc.order.entity.OrderItemEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@ -111,6 +112,7 @@ public class OrderRespVO {
|
|||||||
private List<OrderItemVO> orderItemList;
|
private List<OrderItemVO> orderItemList;
|
||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
private String scenicName;
|
private String scenicName;
|
||||||
|
private List<GoodsDetailVO> goodsList;
|
||||||
|
|
||||||
public BigDecimal getDiscountPrice() {
|
public BigDecimal getDiscountPrice() {
|
||||||
if (slashPrice == null) {
|
if (slashPrice == null) {
|
||||||
|
@ -2,6 +2,7 @@ package com.ycwl.basic.model.pc.renderWorker.entity;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.ycwl.basic.storage.enums.StorageType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@ -77,4 +78,12 @@ public class RenderWorkerEntity {
|
|||||||
private Date updateAt;
|
private Date updateAt;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储类型
|
||||||
|
*/
|
||||||
|
private StorageType storeType;
|
||||||
|
/**
|
||||||
|
* 存储配置
|
||||||
|
*/
|
||||||
|
private String storeConfigJson;
|
||||||
}
|
}
|
||||||
|
@ -91,4 +91,6 @@ public class ScenicConfigEntity {
|
|||||||
|
|
||||||
private String imageSourcePackHint;
|
private String imageSourcePackHint;
|
||||||
private String videoSourcePackHint;
|
private String videoSourcePackHint;
|
||||||
|
|
||||||
|
private String extraNotificationTime;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,6 @@ public class ScenicConfigResp {
|
|||||||
private Integer userSourceExpireDay;
|
private Integer userSourceExpireDay;
|
||||||
private BigDecimal brokerDirectRate;
|
private BigDecimal brokerDirectRate;
|
||||||
|
|
||||||
private String imageSourcePackHint;
|
private String imageSourcePackHint = "";
|
||||||
private String videoSourcePackHint;
|
private String videoSourcePackHint = "";
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,6 @@ public class SourceRespVO {
|
|||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
@ApiModelProperty("景区名称")
|
@ApiModelProperty("景区名称")
|
||||||
private String scenicName;
|
private String scenicName;
|
||||||
@ApiModelProperty("经度")
|
|
||||||
private BigDecimal longitude;
|
|
||||||
@ApiModelProperty("纬度")
|
|
||||||
private BigDecimal latitude;
|
|
||||||
/**
|
/**
|
||||||
* 来源设备id
|
* 来源设备id
|
||||||
*/
|
*/
|
||||||
@ -49,6 +45,6 @@ public class SourceRespVO {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
@ApiModelProperty("是否购买:0未购买,1已购买")
|
@ApiModelProperty("是否购买:0未购买,1已购买")
|
||||||
private Integer isBuy;
|
private int isBuy;
|
||||||
private Integer isFree;
|
private int isFree;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.ycwl.basic.pay.adapter;
|
|||||||
|
|
||||||
import com.wechat.pay.java.core.Config;
|
import com.wechat.pay.java.core.Config;
|
||||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||||
|
import com.wechat.pay.java.core.RSAPublicKeyConfig;
|
||||||
import com.wechat.pay.java.core.notification.NotificationConfig;
|
import com.wechat.pay.java.core.notification.NotificationConfig;
|
||||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
import com.wechat.pay.java.core.notification.RequestParam;
|
import com.wechat.pay.java.core.notification.RequestParam;
|
||||||
@ -30,6 +31,7 @@ import com.ycwl.basic.pay.entity.RefundOrderRequest;
|
|||||||
import com.ycwl.basic.pay.entity.RefundOrderResponse;
|
import com.ycwl.basic.pay.entity.RefundOrderResponse;
|
||||||
import com.ycwl.basic.pay.entity.WxMpPayConfig;
|
import com.ycwl.basic.pay.entity.WxMpPayConfig;
|
||||||
import com.ycwl.basic.pay.exceptions.PayWrongConfigException;
|
import com.ycwl.basic.pay.exceptions.PayWrongConfigException;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.util.Base64Utils;
|
import org.springframework.util.Base64Utils;
|
||||||
|
|
||||||
import javax.servlet.ServletInputStream;
|
import javax.servlet.ServletInputStream;
|
||||||
@ -72,6 +74,8 @@ public class WxMpPayAdapter implements IPayAdapter {
|
|||||||
this.config.setAppId(_config.get("appId"));
|
this.config.setAppId(_config.get("appId"));
|
||||||
this.config.setPrivateKey(_config.get("privateKey"));
|
this.config.setPrivateKey(_config.get("privateKey"));
|
||||||
this.config.setSerialNumber(_config.get("serialNumber"));
|
this.config.setSerialNumber(_config.get("serialNumber"));
|
||||||
|
this.config.setWxPublicKey(_config.get("wxPublicKey"));
|
||||||
|
this.config.setWxPublicKeyId(_config.get("wxPublicKeyId"));
|
||||||
this.config.setApiV3Key(_config.get("apiV3Key"));
|
this.config.setApiV3Key(_config.get("apiV3Key"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,12 +84,23 @@ public class WxMpPayAdapter implements IPayAdapter {
|
|||||||
|
|
||||||
private Config getConfig() {
|
private Config getConfig() {
|
||||||
if (clientConfig == null) {
|
if (clientConfig == null) {
|
||||||
clientConfig = new RSAAutoCertificateConfig.Builder()
|
if (StringUtils.isNotBlank(config.getWxPublicKeyId())) {
|
||||||
.merchantId(config.getMerchantId())
|
clientConfig = new RSAPublicKeyConfig.Builder()
|
||||||
.privateKey(config.getPrivateKey())
|
.merchantId(config.getMerchantId())
|
||||||
.merchantSerialNumber(config.getSerialNumber())
|
.privateKey(config.getPrivateKey())
|
||||||
.apiV3Key(config.getApiV3Key())
|
.merchantSerialNumber(config.getSerialNumber())
|
||||||
.build();
|
.publicKey(config.getWxPublicKey())
|
||||||
|
.publicKeyId(config.getWxPublicKeyId())
|
||||||
|
.apiV3Key(config.getApiV3Key())
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
clientConfig = new RSAAutoCertificateConfig.Builder()
|
||||||
|
.merchantId(config.getMerchantId())
|
||||||
|
.privateKey(config.getPrivateKey())
|
||||||
|
.merchantSerialNumber(config.getSerialNumber())
|
||||||
|
.apiV3Key(config.getApiV3Key())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return clientConfig;
|
return clientConfig;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ public class WxMpPayConfig {
|
|||||||
private String merchantId;
|
private String merchantId;
|
||||||
private String appId;
|
private String appId;
|
||||||
private String privateKey;
|
private String privateKey;
|
||||||
|
private String wxPublicKey;
|
||||||
|
private String wxPublicKeyId;
|
||||||
private String serialNumber;
|
private String serialNumber;
|
||||||
private String apiV3Key;
|
private String apiV3Key;
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,10 @@ public class PriceRepository {
|
|||||||
priceConfigEntity = JSON.parseObject(redisTemplate.opsForValue().get(cacheKey), PriceConfigEntity.class);
|
priceConfigEntity = JSON.parseObject(redisTemplate.opsForValue().get(cacheKey), PriceConfigEntity.class);
|
||||||
}
|
}
|
||||||
if (priceConfigEntity == null) {
|
if (priceConfigEntity == null) {
|
||||||
PriceConfigEntity priceConfig = mapper.getPriceByScenicTypeGoods(scenicId, type, goodsId);
|
priceConfigEntity = mapper.getPriceByScenicTypeGoods(scenicId, type, goodsId);
|
||||||
if (priceConfig != null) {
|
if (priceConfigEntity != null) {
|
||||||
redisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(priceConfig));
|
redisTemplate.opsForValue().set(cacheKey, JSON.toJSONString(priceConfigEntity));
|
||||||
redisTemplate.opsForValue().set(String.format(PRICE_ID_CACHE, priceConfig.getId()), JSON.toJSONString(priceConfig));
|
redisTemplate.opsForValue().set(String.format(PRICE_ID_CACHE, priceConfigEntity.getId()), JSON.toJSONString(priceConfigEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return priceConfigEntity;
|
return priceConfigEntity;
|
||||||
|
@ -33,7 +33,6 @@ public class TemplateRepository {
|
|||||||
return template.getChildren().stream()
|
return template.getChildren().stream()
|
||||||
.filter(item -> item.getIsPlaceholder() == 1)
|
.filter(item -> item.getIsPlaceholder() == 1)
|
||||||
.map(TemplateRespVO::getSourceUrl)
|
.map(TemplateRespVO::getSourceUrl)
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,4 +48,6 @@ public interface GoodsService {
|
|||||||
List<GoodsUrlVO> sourceGoodsListPreview(GoodsReqQuery query);
|
List<GoodsUrlVO> sourceGoodsListPreview(GoodsReqQuery query);
|
||||||
|
|
||||||
List<GoodsUrlVO> sourceGoodsListDownload(GoodsReqQuery query);
|
List<GoodsUrlVO> sourceGoodsListDownload(GoodsReqQuery query);
|
||||||
|
|
||||||
|
Integer sourceGoodsCount(GoodsReqQuery query);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
|||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
||||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||||
@ -29,6 +30,7 @@ import com.ycwl.basic.repository.ScenicRepository;
|
|||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.service.pc.SourceService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -73,6 +75,8 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
private VideoTaskRepository videoTaskRepository;
|
private VideoTaskRepository videoTaskRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private VideoRepository videoRepository;
|
private VideoRepository videoRepository;
|
||||||
|
@Autowired
|
||||||
|
private SourceService sourceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
||||||
@ -166,6 +170,12 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
} else {
|
} else {
|
||||||
sourceImageContent.setIsBuy(0);
|
sourceImageContent.setIsBuy(0);
|
||||||
}
|
}
|
||||||
|
List<SourceEntity> sourceEntities = sourceMapper.listImageByFaceRelation(faceRespVO.getMemberId(), faceId);
|
||||||
|
if (!sourceEntities.isEmpty()) {
|
||||||
|
sourceImageContent.setLockType(-1);
|
||||||
|
} else {
|
||||||
|
sourceImageContent.setLockType(1);
|
||||||
|
}
|
||||||
contentList.add(sourceImageContent);
|
contentList.add(sourceImageContent);
|
||||||
}
|
}
|
||||||
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
if (!Integer.valueOf(1).equals(scenicConfig.getDisableSourceVideo())) {
|
||||||
@ -177,6 +187,12 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
} else {
|
} else {
|
||||||
sourceVideoContent.setIsBuy(0);
|
sourceVideoContent.setIsBuy(0);
|
||||||
}
|
}
|
||||||
|
List<SourceEntity> sourceEntities = sourceMapper.listVideoByFaceRelation(faceRespVO.getMemberId(), faceId);
|
||||||
|
if (!sourceEntities.isEmpty()) {
|
||||||
|
sourceVideoContent.setLockType(-1);
|
||||||
|
} else {
|
||||||
|
sourceVideoContent.setLockType(1);
|
||||||
|
}
|
||||||
contentList.add(sourceVideoContent);
|
contentList.add(sourceVideoContent);
|
||||||
}
|
}
|
||||||
sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> {
|
sourceList.stream().collect(Collectors.groupingBy(SourceRespVO::getType)).forEach((type, list) -> {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.ycwl.basic.service.mobile.impl;
|
package com.ycwl.basic.service.mobile.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.ycwl.basic.enums.StatisticEnum;
|
import com.ycwl.basic.enums.StatisticEnum;
|
||||||
import com.ycwl.basic.mapper.StatisticsMapper;
|
import com.ycwl.basic.mapper.StatisticsMapper;
|
||||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||||
@ -11,7 +13,6 @@ import com.ycwl.basic.model.mobile.statistic.resp.AppSta3VO;
|
|||||||
import com.ycwl.basic.model.mobile.statistic.resp.AppStatisticsFunnelVO;
|
import com.ycwl.basic.model.mobile.statistic.resp.AppStatisticsFunnelVO;
|
||||||
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.DateUtils;
|
|
||||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -395,26 +396,25 @@ public class AppStatisticsServiceImpl implements AppStatisticsService {
|
|||||||
*/
|
*/
|
||||||
private void standardToNewSpecificTime(CommonQueryReq query) {
|
private void standardToNewSpecificTime(CommonQueryReq query) {
|
||||||
Integer standard = query.getStandard();
|
Integer standard = query.getStandard();
|
||||||
Date newDate = new Date();
|
Date newDate = DateUtil.beginOfDay(new Date());
|
||||||
Date startDate = new Date();
|
Date startDate = new Date();
|
||||||
Date endDate = new Date();
|
Date endDate = new Date();
|
||||||
switch (standard) {
|
switch (standard) {
|
||||||
case 4://年
|
case 4://年
|
||||||
startDate = DateUtils.addDateYears(newDate, -1);
|
startDate = DateUtil.offset(newDate, DateField.YEAR, -1);
|
||||||
break;
|
break;
|
||||||
case 3://月
|
case 3://月
|
||||||
startDate = DateUtils.addDateMonths(newDate, -1);
|
startDate = DateUtil.offset(newDate, DateField.MONTH, -1);
|
||||||
break;
|
break;
|
||||||
case 2://周
|
case 2://周
|
||||||
startDate = DateUtils.addDateWeeks(newDate, -1);
|
startDate = DateUtil.offsetWeek(newDate, -1);
|
||||||
break;
|
break;
|
||||||
case 1://昨天
|
case 1://昨天
|
||||||
Date yesterday = DateUtils.addDateDays(newDate, -1);
|
startDate = DateUtil.offsetDay(newDate, -1);
|
||||||
startDate = DateUtils.getStartOfDay(yesterday);
|
endDate = DateUtil.endOfDay(startDate);
|
||||||
endDate = DateUtils.getEndOfDay(yesterday);
|
|
||||||
break;
|
break;
|
||||||
case 0://今天
|
case 0://今天
|
||||||
startDate = DateUtils.getStartOfDay(newDate);
|
startDate = DateUtil.beginOfDay(newDate);
|
||||||
break;
|
break;
|
||||||
case 9://历史累计
|
case 9://历史累计
|
||||||
startDate = null;
|
startDate = null;
|
||||||
@ -433,31 +433,29 @@ public class AppStatisticsServiceImpl implements AppStatisticsService {
|
|||||||
*/
|
*/
|
||||||
private void standardToPreviousSpecificTime(CommonQueryReq query) {
|
private void standardToPreviousSpecificTime(CommonQueryReq query) {
|
||||||
Integer standard = query.getStandard();
|
Integer standard = query.getStandard();
|
||||||
Date newDate = new Date();
|
Date newDate = DateUtil.beginOfDay(new Date());
|
||||||
Date startDate = new Date();
|
Date startDate = new Date();
|
||||||
Date endDate = new Date();
|
Date endDate = new Date();
|
||||||
switch (standard) {
|
switch (standard) {
|
||||||
case 4://年,近一年的前一年
|
case 4://年,近一年的前一年
|
||||||
startDate = DateUtils.addDateYears(newDate, -2);
|
startDate = DateUtil.offset(newDate, DateField.YEAR, -2);
|
||||||
endDate = DateUtils.addDateYears(newDate, -1);
|
endDate = DateUtil.offset(newDate, DateField.YEAR, -1);
|
||||||
break;
|
break;
|
||||||
case 3://月,近一月的前一个月
|
case 3://月,近一月的前一个月
|
||||||
startDate = DateUtils.addDateMonths(newDate, -2);
|
startDate = DateUtil.offset(newDate, DateField.MONTH, -2);
|
||||||
endDate = DateUtils.addDateMonths(newDate, -1);
|
endDate = DateUtil.offset(newDate, DateField.MONTH, -1);
|
||||||
break;
|
break;
|
||||||
case 2://周,近一周的前一周
|
case 2://周,近一周的前一周
|
||||||
startDate = DateUtils.addDateWeeks(newDate, -2);
|
startDate = DateUtil.offsetWeek(newDate, -2);
|
||||||
endDate = DateUtils.addDateWeeks(newDate, -1);
|
endDate = DateUtil.offsetWeek(newDate, -1);
|
||||||
break;
|
break;
|
||||||
case 1://昨天,昨天的前一天
|
case 1://昨天,昨天的前一天
|
||||||
Date theDayBeforeYesterday = DateUtils.addDateDays(newDate, -2);
|
startDate = DateUtil.offsetDay(newDate, -2);
|
||||||
startDate = DateUtils.getStartOfDay(theDayBeforeYesterday);
|
endDate = DateUtil.offsetDay(newDate, -1);
|
||||||
endDate = DateUtils.getEndOfDay(theDayBeforeYesterday);
|
|
||||||
break;
|
break;
|
||||||
case 0://今天,今天的前一天
|
case 0://今天,今天的前一天
|
||||||
Date yesterday = DateUtils.addDateDays(newDate, -1);
|
startDate = DateUtil.offsetDay(newDate, -1);
|
||||||
startDate = DateUtils.getStartOfDay(yesterday);
|
endDate = DateUtil.endOfDay(startDate);
|
||||||
endDate = DateUtils.getEndOfDay(yesterday);
|
|
||||||
break;
|
break;
|
||||||
case 9://历史累计
|
case 9://历史累计
|
||||||
startDate = null;
|
startDate = null;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.ycwl.basic.service.mobile.impl;
|
package com.ycwl.basic.service.mobile.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ycwl.basic.biz.OrderBiz;
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
import com.ycwl.basic.biz.TaskStatusBiz;
|
import com.ycwl.basic.biz.TaskStatusBiz;
|
||||||
@ -40,14 +42,11 @@ import com.ycwl.basic.storage.StorageFactory;
|
|||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.DateUtils;
|
|
||||||
import com.ycwl.basic.utils.WxMpUtil;
|
import com.ycwl.basic.utils.WxMpUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
@ -57,6 +56,7 @@ import java.util.Collections;
|
|||||||
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.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +190,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
for (SourceRespVO sourceRespVO : list) {
|
for (SourceRespVO sourceRespVO : list) {
|
||||||
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
GoodsDetailVO goodsDetailVO = new GoodsDetailVO();
|
||||||
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||||
String shootingTime = DateUtils.format(sourceRespVO.getCreateTime(), "yyyy.MM.dd HH:mm:ss");
|
String shootingTime = DateUtil.format(sourceRespVO.getCreateTime(), "yyyy.MM.dd HH:mm:ss");
|
||||||
if (i < 10) {
|
if (i < 10) {
|
||||||
goodsDetailVO.setGoodsName(goodsNamePrefix + "0" + i + " " + shootingTime);
|
goodsDetailVO.setGoodsName(goodsNamePrefix + "0" + i + " " + shootingTime);
|
||||||
} else {
|
} else {
|
||||||
@ -198,11 +198,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
goodsDetailVO.setScenicId(sourceRespVO.getScenicId());
|
goodsDetailVO.setScenicId(sourceRespVO.getScenicId());
|
||||||
goodsDetailVO.setScenicName(sourceRespVO.getScenicName());
|
goodsDetailVO.setScenicName(sourceRespVO.getScenicName());
|
||||||
goodsDetailVO.setLongitude(sourceRespVO.getLongitude());
|
|
||||||
goodsDetailVO.setLatitude(sourceRespVO.getLatitude());
|
|
||||||
goodsDetailVO.setGoodsType(sourceType);
|
goodsDetailVO.setGoodsType(sourceType);
|
||||||
goodsDetailVO.setSourceType(sourceType);
|
|
||||||
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||||
|
goodsDetailVO.setIsFree(sourceRespVO.getIsFree());
|
||||||
|
goodsDetailVO.setIsBuy(sourceRespVO.getIsBuy());
|
||||||
if (sourceRespVO.getVideoUrl() != null) {
|
if (sourceRespVO.getVideoUrl() != null) {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(sourceRespVO.getVideoUrl());
|
URL url = new URL(sourceRespVO.getVideoUrl());
|
||||||
@ -273,18 +272,27 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
TaskEntity task = videoTaskRepository.getTaskById(videoRespVO.getTaskId());
|
||||||
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
||||||
long deviceCount;
|
AtomicInteger deviceCount = new AtomicInteger();
|
||||||
goodsDetailVO.setShotTime(taskTaskService.getTaskShotDate(task.getId()));
|
goodsDetailVO.setShotTime(taskTaskService.getTaskShotDate(task.getId()));
|
||||||
if (paramJson == null) {
|
if (paramJson == null) {
|
||||||
deviceCount = 1;
|
deviceCount.set(1);
|
||||||
} else {
|
} else {
|
||||||
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(task.getTemplateId());
|
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(task.getTemplateId());
|
||||||
deviceCount = paramJson.keySet().stream()
|
paramJson.entrySet().stream()
|
||||||
.filter(StringUtils::isNumeric)
|
.filter(entry -> StringUtils.isNumeric(entry.getKey()))
|
||||||
.filter(templatePlaceholder::contains)
|
.forEach(entry -> {
|
||||||
.count();
|
JSONArray jsonArray = paramJson.getJSONArray(entry.getKey());
|
||||||
|
if (jsonArray != null && !jsonArray.isEmpty()) {
|
||||||
|
for (Object ignored : jsonArray) {
|
||||||
|
if (templatePlaceholder.contains(entry.getKey())) {
|
||||||
|
deviceCount.getAndIncrement();
|
||||||
|
templatePlaceholder.remove(entry.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
goodsDetailVO.setLensNum((int) deviceCount);
|
goodsDetailVO.setLensNum(deviceCount.get());
|
||||||
return ApiResponse.success(goodsDetailVO);
|
return ApiResponse.success(goodsDetailVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +350,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return taskById.getStatus() == 1;
|
return taskById.getStatus() == 1;
|
||||||
}).count();
|
})
|
||||||
|
.map(MemberVideoEntity::getTemplateId)
|
||||||
|
.distinct()
|
||||||
|
.count();
|
||||||
response.setCount(finishedTask);
|
response.setCount(finishedTask);
|
||||||
if (!notFinishedTasks.isEmpty()) {
|
if (!notFinishedTasks.isEmpty()) {
|
||||||
response.setTemplateId(notFinishedTasks.get(0).getTemplateId());
|
response.setTemplateId(notFinishedTasks.get(0).getTemplateId());
|
||||||
@ -525,7 +536,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
IOperator operator = ImageWatermarkFactory.get(ImageWatermarkOperatorEnum.WATERMARK);
|
IOperator operator = ImageWatermarkFactory.get(ImageWatermarkOperatorEnum.WATERMARK);
|
||||||
List<SourceWatermarkEntity> watermarkEntityList = sourceMapper.listSourceWatermark(defaultUrlList.stream().map(GoodsUrlVO::getGoodsId).collect(Collectors.toList()), null, ImageWatermarkOperatorEnum.WATERMARK.getType());
|
List<SourceWatermarkEntity> watermarkEntityList = sourceMapper.listSourceWatermark(defaultUrlList.stream().map(GoodsUrlVO::getGoodsId).collect(Collectors.toList()), null, ImageWatermarkOperatorEnum.WATERMARK.getType());
|
||||||
List<GoodsUrlVO> collect = defaultUrlList.stream().peek(item -> {
|
List<GoodsUrlVO> collect = defaultUrlList.stream().parallel().peek(item -> {
|
||||||
Optional<SourceWatermarkEntity> any = watermarkEntityList.stream()
|
Optional<SourceWatermarkEntity> any = watermarkEntityList.stream()
|
||||||
.filter(watermark -> watermark.getSourceId().equals(item.getGoodsId()))
|
.filter(watermark -> watermark.getSourceId().equals(item.getGoodsId()))
|
||||||
.findAny();
|
.findAny();
|
||||||
@ -573,14 +584,9 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
if (face == null) {
|
if (face == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), query.getScenicId(), query.getSourceType(), query.getFaceId());
|
|
||||||
if (!isBuy.isBuy()) {
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
Integer sourceType = query.getSourceType();
|
Integer sourceType = query.getSourceType();
|
||||||
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||||
sourceReqQuery.setScenicId(query.getScenicId());
|
sourceReqQuery.setScenicId(face.getScenicId());
|
||||||
sourceReqQuery.setIsBuy(query.getIsBuy());
|
|
||||||
sourceReqQuery.setMemberId(face.getMemberId());
|
sourceReqQuery.setMemberId(face.getMemberId());
|
||||||
sourceReqQuery.setType(sourceType);
|
sourceReqQuery.setType(sourceType);
|
||||||
sourceReqQuery.setFaceId(query.getFaceId());
|
sourceReqQuery.setFaceId(query.getFaceId());
|
||||||
@ -598,6 +604,21 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
return goodsUrlVO;
|
return goodsUrlVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
long count = list.stream().filter((item) -> {
|
||||||
|
if (item.getIsFree() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (item.getIsBuy() > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).count();
|
||||||
|
if (count > 0) {
|
||||||
|
IsBuyRespVO isBuy = orderBiz.isBuy(face.getMemberId(), query.getScenicId(), query.getSourceType(), query.getFaceId());
|
||||||
|
if (!isBuy.isBuy()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
List<GoodsUrlVO> defaultUrlList = list.stream().map(source -> {
|
List<GoodsUrlVO> defaultUrlList = list.stream().map(source -> {
|
||||||
GoodsUrlVO goodsUrlVO = new GoodsUrlVO();
|
GoodsUrlVO goodsUrlVO = new GoodsUrlVO();
|
||||||
goodsUrlVO.setGoodsType(source.getType());
|
goodsUrlVO.setGoodsType(source.getType());
|
||||||
@ -678,4 +699,20 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
}
|
}
|
||||||
return defaultUrlList;
|
return defaultUrlList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer sourceGoodsCount(GoodsReqQuery query) {
|
||||||
|
FaceEntity face = faceRepository.getFace(query.getFaceId());
|
||||||
|
if (face == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Integer sourceType = query.getSourceType();
|
||||||
|
SourceReqQuery sourceReqQuery = new SourceReqQuery();
|
||||||
|
sourceReqQuery.setScenicId(query.getScenicId());
|
||||||
|
sourceReqQuery.setIsBuy(query.getIsBuy());
|
||||||
|
sourceReqQuery.setMemberId(face.getMemberId());
|
||||||
|
sourceReqQuery.setType(sourceType);
|
||||||
|
sourceReqQuery.setFaceId(query.getFaceId());
|
||||||
|
return sourceMapper.countUser(sourceReqQuery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|||||||
paymentParams.put("needPay", !order.isSkipPay());
|
paymentParams.put("needPay", !order.isSkipPay());
|
||||||
return paymentParams;
|
return paymentParams;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.error("[微信支付]createOrder error", e);
|
||||||
throw new AppException(BizCodeEnum.ADVANCE_PAYMENT_FAILED, e.toString());
|
throw new AppException(BizCodeEnum.ADVANCE_PAYMENT_FAILED, e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.ycwl.basic.service.pc.impl;
|
package com.ycwl.basic.service.pc.impl;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ycwl.basic.biz.OrderBiz;
|
import com.ycwl.basic.biz.OrderBiz;
|
||||||
@ -49,6 +49,7 @@ import java.util.UUID;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.ycwl.basic.constant.FaceConstant.USER_FACE_DB_NAME;
|
import static com.ycwl.basic.constant.FaceConstant.USER_FACE_DB_NAME;
|
||||||
|
import static com.ycwl.basic.constant.StorageConstant.USER_FACE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
@ -129,7 +130,7 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
public FaceRecognizeResp faceUpload(MultipartFile file, Long scenicId, Long userId) {
|
public FaceRecognizeResp faceUpload(MultipartFile file, Long scenicId, Long userId) {
|
||||||
//1、上传人脸照片
|
//1、上传人脸照片
|
||||||
IStorageAdapter adapter = StorageFactory.use("faces");
|
IStorageAdapter adapter = StorageFactory.use("faces");
|
||||||
String filePath = StorageUtil.joinPath("user-faces", DateUtils.format(new Date(),"yyyy-MM-dd"));
|
String filePath = StorageUtil.joinPath(USER_FACE, DateUtil.format(new Date(),"yyyy-MM-dd"));
|
||||||
String originalFilename = file.getOriginalFilename();
|
String originalFilename = file.getOriginalFilename();
|
||||||
String suffix = originalFilename.split("\\.", 2)[1];
|
String suffix = originalFilename.split("\\.", 2)[1];
|
||||||
String fileName = UUID.randomUUID().toString() + "." + suffix;
|
String fileName = UUID.randomUUID().toString() + "." + suffix;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.ycwl.basic.service.pc.impl;
|
package com.ycwl.basic.service.pc.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.ycwl.basic.biz.CouponBiz;
|
import com.ycwl.basic.biz.CouponBiz;
|
||||||
@ -10,6 +12,7 @@ import com.ycwl.basic.constant.NumberConstant;
|
|||||||
import com.ycwl.basic.enums.*;
|
import com.ycwl.basic.enums.*;
|
||||||
import com.ycwl.basic.exception.AppException;
|
import com.ycwl.basic.exception.AppException;
|
||||||
import com.ycwl.basic.mapper.*;
|
import com.ycwl.basic.mapper.*;
|
||||||
|
import com.ycwl.basic.model.mobile.goods.GoodsDetailVO;
|
||||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||||
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
import com.ycwl.basic.model.mobile.order.OrderAppPageReq;
|
||||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||||
@ -31,23 +34,27 @@ import com.ycwl.basic.model.pc.price.entity.PriceConfigEntity;
|
|||||||
import com.ycwl.basic.model.pc.price.resp.GoodsListRespVO;
|
import com.ycwl.basic.model.pc.price.resp.GoodsListRespVO;
|
||||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||||
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||||
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
import com.ycwl.basic.repository.PriceRepository;
|
import com.ycwl.basic.repository.PriceRepository;
|
||||||
|
import com.ycwl.basic.repository.TemplateRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
import com.ycwl.basic.service.mobile.WxPayService;
|
import com.ycwl.basic.service.mobile.WxPayService;
|
||||||
import com.ycwl.basic.service.pc.OrderService;
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
|
import com.ycwl.basic.service.task.impl.TaskTaskServiceImpl;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.BigDecimalUtil;
|
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -90,6 +97,10 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
private FaceRepository faceRepository;
|
private FaceRepository faceRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CouponBiz couponBiz;
|
private CouponBiz couponBiz;
|
||||||
|
@Autowired
|
||||||
|
private TemplateRepository templateRepository;
|
||||||
|
@Autowired
|
||||||
|
private TaskTaskServiceImpl taskTaskService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query) {
|
public ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query) {
|
||||||
@ -141,28 +152,84 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
public ApiResponse<OrderRespVO> detail(Long orderId) {
|
public ApiResponse<OrderRespVO> detail(Long orderId) {
|
||||||
OrderRespVO byId = orderMapper.getById(orderId);
|
OrderRespVO byId = orderMapper.getById(orderId);
|
||||||
List<OrderItemVO> orderItemList = byId.getOrderItemList();
|
List<OrderItemVO> orderItemList = byId.getOrderItemList();
|
||||||
|
List<GoodsDetailVO> goodsList = new ArrayList<>();
|
||||||
|
List<Integer> _f = new ArrayList<>();
|
||||||
orderItemList.forEach(item -> {
|
orderItemList.forEach(item -> {
|
||||||
if (Integer.valueOf(1).equals(item.getGoodsType())) { // 原片 goodsId就是人脸ID
|
if (Integer.valueOf(1).equals(item.getGoodsType())) { // 原片 goodsId就是人脸ID
|
||||||
List<SourceEntity> memberVideoEntityList = sourceMapper.listVideoByFaceRelation(byId.getMemberId(), item.getGoodsId());
|
List<SourceEntity> memberVideoEntityList = sourceMapper.listVideoByFaceRelation(byId.getMemberId(), item.getGoodsId());
|
||||||
item.setCoverList(memberVideoEntityList.stream().map(SourceEntity::getUrl).collect(Collectors.toList()));
|
item.setCoverList(memberVideoEntityList.stream().map(SourceEntity::getUrl).collect(Collectors.toList()));
|
||||||
if (!memberVideoEntityList.isEmpty()) {
|
if (!_f.contains(1)) {
|
||||||
item.setShootingTime(memberVideoEntityList.get(0).getCreateTime());
|
_f.add(1);
|
||||||
|
if (!memberVideoEntityList.isEmpty()) {
|
||||||
|
for (SourceEntity sourceEntity : memberVideoEntityList) {
|
||||||
|
GoodsDetailVO goods = new GoodsDetailVO();
|
||||||
|
goods.setGoodsId(sourceEntity.getId());
|
||||||
|
goods.setGoodsName("录像集录像");
|
||||||
|
goods.setUrl(sourceEntity.getUrl());
|
||||||
|
goods.setGoodsType(sourceEntity.getType());
|
||||||
|
goods.setScenicId(sourceEntity.getScenicId());
|
||||||
|
goods.setUrl(sourceEntity.getVideoUrl());
|
||||||
|
goods.setTemplateCoverUrl(sourceEntity.getUrl());
|
||||||
|
goods.setCreateTime(sourceEntity.getCreateTime());
|
||||||
|
goodsList.add(goods);
|
||||||
|
}
|
||||||
|
item.setShootingTime(memberVideoEntityList.get(0).getCreateTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (Integer.valueOf(2).equals(item.getGoodsType())) { // 照片 goodsId就是人脸ID
|
} else if (Integer.valueOf(2).equals(item.getGoodsType())) { // 照片 goodsId就是人脸ID
|
||||||
List<SourceEntity> memberVideoEntityList = sourceMapper.listImageByFaceRelation(byId.getMemberId(), item.getGoodsId());
|
List<SourceEntity> memberVideoEntityList = sourceMapper.listImageByFaceRelation(byId.getMemberId(), item.getGoodsId());
|
||||||
item.setCoverList(memberVideoEntityList.stream().map(SourceEntity::getUrl).collect(Collectors.toList()));
|
item.setCoverList(memberVideoEntityList.stream().map(SourceEntity::getUrl).collect(Collectors.toList()));
|
||||||
if (!memberVideoEntityList.isEmpty()) {
|
if (!_f.contains(2)) {
|
||||||
item.setShootingTime(memberVideoEntityList.get(0).getCreateTime());
|
_f.add(2);
|
||||||
|
if (!memberVideoEntityList.isEmpty()) {
|
||||||
|
for (SourceEntity sourceEntity : memberVideoEntityList) {
|
||||||
|
GoodsDetailVO goods = new GoodsDetailVO();
|
||||||
|
goods.setGoodsId(sourceEntity.getId());
|
||||||
|
goods.setGoodsName("照片集照片");
|
||||||
|
goods.setUrl(sourceEntity.getUrl());
|
||||||
|
goods.setGoodsType(sourceEntity.getType());
|
||||||
|
goods.setScenicId(sourceEntity.getScenicId());
|
||||||
|
goods.setUrl(sourceEntity.getUrl());
|
||||||
|
goods.setTemplateCoverUrl(sourceEntity.getUrl());
|
||||||
|
goods.setScenicId(sourceEntity.getScenicId());
|
||||||
|
goods.setCreateTime(sourceEntity.getCreateTime());
|
||||||
|
goodsList.add(goods);
|
||||||
|
}
|
||||||
|
item.setShootingTime(memberVideoEntityList.get(0).getCreateTime());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.setCoverList(Collections.singletonList(item.getCoverUrl()));
|
item.setCoverList(Collections.singletonList(item.getCoverUrl()));
|
||||||
VideoEntity videoMapperById = videoRepository.getVideoByTaskId(item.getGoodsId());
|
VideoEntity videoMapperById = videoRepository.getVideo(item.getGoodsId());
|
||||||
if (videoMapperById != null) {
|
if (videoMapperById != null) {
|
||||||
|
TaskEntity task = videoTaskRepository.getTaskById(videoMapperById.getTaskId());
|
||||||
|
TemplateRespVO template = templateRepository.getTemplate(videoMapperById.getTemplateId());
|
||||||
|
GoodsDetailVO goods = new GoodsDetailVO();
|
||||||
|
goods.setGoodsId(videoMapperById.getId());
|
||||||
|
goods.setGoodsName(template.getName());
|
||||||
|
goods.setUrl(videoMapperById.getVideoUrl());
|
||||||
|
goods.setGoodsType(0);
|
||||||
|
goods.setTemplateCoverUrl(template.getCoverUrl());
|
||||||
|
long deviceCount;
|
||||||
|
if (task.getTaskParams() == null) {
|
||||||
|
deviceCount = 1;
|
||||||
|
} else {
|
||||||
|
JSONObject paramJson = JSON.parseObject(task.getTaskParams());
|
||||||
|
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(task.getTemplateId());
|
||||||
|
deviceCount = paramJson.keySet().stream()
|
||||||
|
.filter(StringUtils::isNumeric)
|
||||||
|
.filter(templatePlaceholder::contains)
|
||||||
|
.count();
|
||||||
|
}
|
||||||
|
goods.setCreateTime(videoTaskRepository.getTaskShotDate(task.getId()));
|
||||||
|
goods.setParts(Math.toIntExact(deviceCount));
|
||||||
|
goodsList.add(goods);
|
||||||
item.setShootingTime(videoTaskRepository.getTaskShotDate(videoMapperById.getTaskId()));
|
item.setShootingTime(videoTaskRepository.getTaskShotDate(videoMapperById.getTaskId()));
|
||||||
item.setVideoUrl(videoMapperById.getVideoUrl());
|
item.setVideoUrl(videoMapperById.getVideoUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
byId.setGoodsList(goodsList);
|
||||||
return ApiResponse.success(byId);
|
return ApiResponse.success(byId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +258,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
wxPayOrderReqVO.setOpenId(order.getOpenId())
|
wxPayOrderReqVO.setOpenId(order.getOpenId())
|
||||||
.setMemberId(order.getMemberId())
|
.setMemberId(order.getMemberId())
|
||||||
.setOrderSn(order.getId())
|
.setOrderSn(order.getId())
|
||||||
.setTotalPrice(BigDecimalUtil.convertToCents(order.getPayPrice()))
|
.setTotalPrice(order.getPayPrice().setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal(100)).intValueExact())
|
||||||
.setGoodsName(goodsName)
|
.setGoodsName(goodsName)
|
||||||
.setDescription(goodsName);
|
.setDescription(goodsName);
|
||||||
|
|
||||||
|
@ -132,6 +132,7 @@ public class SourceServiceImpl implements SourceService {
|
|||||||
// 下载切片
|
// 下载切片
|
||||||
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
VideoPieceGetter.Task task = new VideoPieceGetter.Task();
|
||||||
task.faceSampleIds = Collections.singletonList(source.getFaceSampleId());
|
task.faceSampleIds = Collections.singletonList(source.getFaceSampleId());
|
||||||
|
task.force = true;
|
||||||
VideoPieceGetter.addTask(task);
|
VideoPieceGetter.addTask(task);
|
||||||
}
|
}
|
||||||
return ApiResponse.success("任务已下发");
|
return ApiResponse.success("任务已下发");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.service.task;
|
package com.ycwl.basic.service.task;
|
||||||
|
|
||||||
|
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
|
||||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.model.task.req.TaskReqVo;
|
import com.ycwl.basic.model.task.req.TaskReqVo;
|
||||||
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
import com.ycwl.basic.model.task.req.TaskSuccessReqVo;
|
||||||
@ -32,4 +33,6 @@ public interface TaskService {
|
|||||||
Date getTaskShotDate(Long taskId);
|
Date getTaskShotDate(Long taskId);
|
||||||
|
|
||||||
void sendVideoGeneratedServiceNotification(Long taskId, Long memberId);
|
void sendVideoGeneratedServiceNotification(Long taskId, Long memberId);
|
||||||
|
|
||||||
|
TaskRespVO taskInfo(Long taskId);
|
||||||
}
|
}
|
||||||
|
@ -33,11 +33,7 @@ import com.ycwl.basic.repository.FaceRepository;
|
|||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.service.pc.ScenicService;
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.service.task.TaskFaceService;
|
import com.ycwl.basic.service.task.TaskFaceService;
|
||||||
import com.ycwl.basic.storage.StorageFactory;
|
|
||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
|
||||||
import com.ycwl.basic.storage.utils.StorageUtil;
|
|
||||||
import com.ycwl.basic.task.VideoPieceGetter;
|
import com.ycwl.basic.task.VideoPieceGetter;
|
||||||
import com.ycwl.basic.utils.DateUtils;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -206,14 +202,11 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
|||||||
SearchFaceRespVo respVo = new SearchFaceRespVo();
|
SearchFaceRespVo respVo = new SearchFaceRespVo();
|
||||||
List<SearchFaceResultItem> records = response.getResult();
|
List<SearchFaceResultItem> records = response.getResult();
|
||||||
respVo.setScore(response.getOriginalFaceScore());
|
respVo.setScore(response.getOriginalFaceScore());
|
||||||
if (records.isEmpty()) {
|
|
||||||
return respVo;
|
|
||||||
}
|
|
||||||
respVo.setSearchResultJson(JSON.toJSONString(records));
|
respVo.setSearchResultJson(JSON.toJSONString(records));
|
||||||
|
logEntity.setMatchRawRecord(records);
|
||||||
if (records.isEmpty()) {
|
if (records.isEmpty()) {
|
||||||
return respVo;
|
return respVo;
|
||||||
}
|
}
|
||||||
logEntity.setMatchRawRecord(records);
|
|
||||||
acceptFaceSampleIds = records.stream()
|
acceptFaceSampleIds = records.stream()
|
||||||
.filter(record -> record.getScore() > _threshold)
|
.filter(record -> record.getScore() > _threshold)
|
||||||
.map(SearchFaceResultItem::getExtData)
|
.map(SearchFaceResultItem::getExtData)
|
||||||
@ -272,12 +265,12 @@ public class TaskFaceServiceImpl implements TaskFaceService {
|
|||||||
record.setMatched(item.getScore() > _threshold);
|
record.setMatched(item.getScore() > _threshold);
|
||||||
collect.add(record);
|
collect.add(record);
|
||||||
}
|
}
|
||||||
|
logEntity.setMatchLocalRecord(JSONObject.toJSONString(collect));
|
||||||
if (acceptFaceSampleIds.isEmpty()) {
|
if (acceptFaceSampleIds.isEmpty()) {
|
||||||
respVo.setFirstMatchRate(0f);
|
respVo.setFirstMatchRate(0f);
|
||||||
respVo.setSampleListIds(Collections.emptyList());
|
respVo.setSampleListIds(Collections.emptyList());
|
||||||
return respVo;
|
return respVo;
|
||||||
}
|
}
|
||||||
logEntity.setMatchLocalRecord(JSONObject.toJSONString(collect));
|
|
||||||
respVo.setFirstMatchRate(response.getFirstMatchRate());
|
respVo.setFirstMatchRate(response.getFirstMatchRate());
|
||||||
respVo.setSampleListIds(acceptFaceSampleIds);
|
respVo.setSampleListIds(acceptFaceSampleIds);
|
||||||
return respVo;
|
return respVo;
|
||||||
|
@ -45,7 +45,6 @@ import com.ycwl.basic.notify.entity.NotifyContent;
|
|||||||
import com.ycwl.basic.notify.enums.NotifyType;
|
import com.ycwl.basic.notify.enums.NotifyType;
|
||||||
import com.ycwl.basic.repository.DeviceRepository;
|
import com.ycwl.basic.repository.DeviceRepository;
|
||||||
import com.ycwl.basic.repository.FaceRepository;
|
import com.ycwl.basic.repository.FaceRepository;
|
||||||
import com.ycwl.basic.repository.OrderRepository;
|
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||||
@ -74,10 +73,7 @@ import java.util.Date;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.locks.ReentrantLock;
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -274,10 +270,15 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
log.info("task callback: 没有视频源");
|
log.info("task callback: 没有视频源");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sourcesMap.forEach((key, value) -> {
|
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(templateId);
|
||||||
// 每个value只保留第一个
|
if (templatePlaceholder.stream().distinct().count() == templatePlaceholder.size()) {
|
||||||
value.removeIf(item -> !value.get(0).equals(item));
|
sourcesMap.forEach((key, value) -> {
|
||||||
});
|
// 每个value只保留第一个
|
||||||
|
value.removeIf(item -> !value.get(0).equals(item));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
log.info("task callback: 模板占位符有重复,templateId: {}", templateId);
|
||||||
|
}
|
||||||
TaskReqQuery taskReqQuery = new TaskReqQuery();
|
TaskReqQuery taskReqQuery = new TaskReqQuery();
|
||||||
taskReqQuery.setFaceId(faceId);
|
taskReqQuery.setFaceId(faceId);
|
||||||
taskReqQuery.setTemplateId(templateId);
|
taskReqQuery.setTemplateId(templateId);
|
||||||
@ -469,10 +470,15 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
log.info("task callback: 没有视频源,templateId: {}", templateId);
|
log.info("task callback: 没有视频源,templateId: {}", templateId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sourcesMap.forEach((key, value) -> {
|
List<String> templatePlaceholder = templateRepository.getTemplatePlaceholder(templateId);
|
||||||
// 每个value只保留第一个
|
if (templatePlaceholder.stream().distinct().count() == templatePlaceholder.size()) {
|
||||||
value.removeIf(item -> !value.get(0).equals(item));
|
sourcesMap.forEach((key, value) -> {
|
||||||
});
|
// 每个value只保留第一个
|
||||||
|
value.removeIf(item -> !value.get(0).equals(item));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
log.info("task callback: 模板占位符有重复,templateId: {}", templateId);
|
||||||
|
}
|
||||||
TaskReqQuery taskReqQuery = new TaskReqQuery();
|
TaskReqQuery taskReqQuery = new TaskReqQuery();
|
||||||
taskReqQuery.setFaceId(faceId);
|
taskReqQuery.setFaceId(faceId);
|
||||||
taskReqQuery.setTemplateId(templateId);
|
taskReqQuery.setTemplateId(templateId);
|
||||||
@ -593,7 +599,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
||||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
||||||
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
adapter.setAcl(StorageAcl.PUBLIC_READ, filename);
|
||||||
videoReUploader.addVideoTask(task.getVideoUrl(), video.getId());
|
videoReUploader.addVideoTask(video.getId());
|
||||||
int isBuy = 0;
|
int isBuy = 0;
|
||||||
FaceEntity face = faceRepository.getFace(task.getFaceId());
|
FaceEntity face = faceRepository.getFace(task.getFaceId());
|
||||||
if (face != null) {
|
if (face != null) {
|
||||||
@ -650,18 +656,23 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
if (task == null) {
|
if (task == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IStorageAdapter adapter = scenicService.getScenicTmpStorageAdapter(task.getScenicId());
|
RenderWorkerEntity worker = getWorker(req);
|
||||||
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
IStorageAdapter adapter;
|
||||||
if (StringUtils.isBlank(task.getVideoUrl())) {
|
try {
|
||||||
// 生成
|
adapter = StorageFactory.get(worker.getStoreType());
|
||||||
String url = adapter.getUrl(filename);
|
adapter.loadConfig(JSONObject.parseObject(worker.getStoreConfigJson(), Map.class));
|
||||||
TaskEntity updateTask = new TaskEntity();
|
} catch (Exception e) {
|
||||||
updateTask.setId(taskId);
|
adapter = scenicService.getScenicStorageAdapter(task.getScenicId());
|
||||||
updateTask.setVideoUrl(url);
|
|
||||||
taskMapper.update(updateTask);
|
|
||||||
videoTaskRepository.clearTaskCache(updateTask.getId());
|
|
||||||
}
|
}
|
||||||
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 60 * 60), "video/mp4", filename);
|
String filename = StorageUtil.joinPath(StorageConstant.VLOG_PATH, task.getId() + "_" + task.getScenicId() + ".mp4");
|
||||||
|
// 生成
|
||||||
|
String url = adapter.getUrl(filename);
|
||||||
|
TaskEntity updateTask = new TaskEntity();
|
||||||
|
updateTask.setId(taskId);
|
||||||
|
updateTask.setVideoUrl(url);
|
||||||
|
taskMapper.update(updateTask);
|
||||||
|
videoTaskRepository.clearTaskCache(updateTask.getId());
|
||||||
|
return adapter.getUrlForUpload(new Date(System.currentTimeMillis() + 1000 * 3600), "video/mp4", filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendVideoGeneratedServiceNotification(Long taskId) {
|
public void sendVideoGeneratedServiceNotification(Long taskId) {
|
||||||
@ -733,4 +744,9 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
adapter.sendTo(new NotifyContent(title, page, params), openId);
|
adapter.sendTo(new NotifyContent(title, page, params), openId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TaskRespVO taskInfo(Long taskId) {
|
||||||
|
return taskMapper.getById(taskId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@ import com.ycwl.basic.annotation.IgnoreToken;
|
|||||||
import com.ycwl.basic.stats.dto.AddTraceReq;
|
import com.ycwl.basic.stats.dto.AddTraceReq;
|
||||||
import com.ycwl.basic.stats.service.StatsService;
|
import com.ycwl.basic.stats.service.StatsService;
|
||||||
import com.ycwl.basic.stats.util.StatsUtil;
|
import com.ycwl.basic.stats.util.StatsUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -38,6 +38,9 @@ public class TraceController {
|
|||||||
traceId = StatsUtil.createUuid();
|
traceId = StatsUtil.createUuid();
|
||||||
response.setHeader("Set-TraceId", traceId);
|
response.setHeader("Set-TraceId", traceId);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isEmpty(req.getParams())) {
|
||||||
|
req.setParams(null);
|
||||||
|
}
|
||||||
statsService.addRecord(traceId, req.getAction(), req.getIdentifier(), req.getParams());
|
statsService.addRecord(traceId, req.getAction(), req.getIdentifier(), req.getParams());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,10 @@ public class StatsInterceptor implements HandlerInterceptor {
|
|||||||
if (!(handler instanceof HandlerMethod)) {
|
if (!(handler instanceof HandlerMethod)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
// HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||||
request.setAttribute("startTime", System.currentTimeMillis());
|
// request.setAttribute("startTime", System.currentTimeMillis());
|
||||||
String requestURI = request.getRequestURI();
|
// String requestURI = request.getRequestURI();
|
||||||
String method = request.getMethod();
|
// String method = request.getMethod();
|
||||||
String traceId = request.getHeader("traceId");
|
String traceId = request.getHeader("traceId");
|
||||||
if (StringUtils.isEmpty(traceId)) {
|
if (StringUtils.isEmpty(traceId)) {
|
||||||
return true;
|
return true;
|
||||||
@ -38,9 +38,9 @@ public class StatsInterceptor implements HandlerInterceptor {
|
|||||||
// response.setHeader("Set-TraceId", traceId);
|
// response.setHeader("Set-TraceId", traceId);
|
||||||
// statsService.addStats(traceId, null);
|
// statsService.addStats(traceId, null);
|
||||||
}
|
}
|
||||||
if (handlerMethod.getMethodAnnotation(IgnoreLogReq.class) == null) {
|
// if (handlerMethod.getMethodAnnotation(IgnoreLogReq.class) == null) {
|
||||||
statsService.addRecord(traceId, "REQUEST",method + " " + requestURI, null);
|
// statsService.addRecord(traceId, "REQUEST",method + " " + requestURI, null);
|
||||||
}
|
// }
|
||||||
if (StringUtils.isNotEmpty(BaseContextHandler.getUserId())) {
|
if (StringUtils.isNotEmpty(BaseContextHandler.getUserId())) {
|
||||||
statsService.updateStats(traceId, Long.valueOf(BaseContextHandler.getUserId()));
|
statsService.updateStats(traceId, Long.valueOf(BaseContextHandler.getUserId()));
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,7 @@ final public class AliOssAdapter extends AStorageAdapter {
|
|||||||
object.setPath(getRelativePath(item.getKey().substring(0, item.getKey().lastIndexOf("/"))));
|
object.setPath(getRelativePath(item.getKey().substring(0, item.getKey().lastIndexOf("/"))));
|
||||||
object.setName(item.getKey().substring(item.getKey().lastIndexOf("/") + 1));
|
object.setName(item.getKey().substring(item.getKey().lastIndexOf("/") + 1));
|
||||||
object.setSize(item.getSize());
|
object.setSize(item.getSize());
|
||||||
|
object.setModifyTime(item.getLastModified());
|
||||||
object.setRawObject(item);
|
object.setRawObject(item);
|
||||||
return object;
|
return object;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
@ -2,11 +2,14 @@ package com.ycwl.basic.task;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.ycwl.basic.mapper.MemberMapper;
|
import com.ycwl.basic.mapper.MemberMapper;
|
||||||
|
import com.ycwl.basic.mapper.ScenicMapper;
|
||||||
import com.ycwl.basic.mapper.VideoMapper;
|
import com.ycwl.basic.mapper.VideoMapper;
|
||||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||||
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||||
import com.ycwl.basic.notify.NotifyFactory;
|
import com.ycwl.basic.notify.NotifyFactory;
|
||||||
import com.ycwl.basic.notify.adapters.INotifyAdapter;
|
import com.ycwl.basic.notify.adapters.INotifyAdapter;
|
||||||
@ -22,8 +25,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@ -39,6 +45,8 @@ public class DownloadNotificationTasker {
|
|||||||
private MemberMapper memberMapper;
|
private MemberMapper memberMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TemplateRepository templateRepository;
|
private TemplateRepository templateRepository;
|
||||||
|
@Autowired
|
||||||
|
private ScenicMapper scenicMapper;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 21 * * *")
|
@Scheduled(cron = "0 0 21 * * *")
|
||||||
public void sendDownloadNotification() {
|
public void sendDownloadNotification() {
|
||||||
@ -131,4 +139,69 @@ public class DownloadNotificationTasker {
|
|||||||
adapter.sendTo(new NotifyContent(title, page, params), member.getOpenId());
|
adapter.sendTo(new NotifyContent(title, page, params), member.getOpenId());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Scheduled(cron = "0 0 * * * *")
|
||||||
|
public void sendExtraDownloadNotification() {
|
||||||
|
log.info("开始执行定时任务");
|
||||||
|
List<ScenicRespVO> scenicList = scenicMapper.list(new ScenicReqQuery());
|
||||||
|
if (scenicList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(new Date());
|
||||||
|
int currentHour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
|
calendar.clear();
|
||||||
|
scenicList.parallelStream().forEach(scenic -> {
|
||||||
|
Long scenicId = scenic.getId();
|
||||||
|
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(scenicId);
|
||||||
|
if (scenicConfig == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(scenicConfig.getExtraNotificationTime())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<String> timeList = Arrays.asList(StringUtils.split(scenicConfig.getExtraNotificationTime(), ","));
|
||||||
|
if (!timeList.contains(String.valueOf(currentHour))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("当前景区{},配置了{}", scenic.getName(), scenicConfig.getExtraNotificationTime());
|
||||||
|
|
||||||
|
videoMapper.listRelationByCreateTime(DateUtil.beginOfDay(new Date()), new Date())
|
||||||
|
.stream()
|
||||||
|
.filter(item -> item.getIsBuy() == 0)
|
||||||
|
.filter(item -> item.getScenicId().equals(scenicId))
|
||||||
|
.parallel()
|
||||||
|
.forEach(item -> {
|
||||||
|
MemberRespVO member = memberMapper.getById(item.getMemberId());
|
||||||
|
MpConfigEntity scenicMp = scenicRepository.getScenicMpConfig(member.getScenicId());
|
||||||
|
// 发送模板消息
|
||||||
|
String templateId = scenicRepository.getVideoDownloadTemplateId(item.getScenicId());
|
||||||
|
if (StringUtils.isBlank(templateId)) {
|
||||||
|
log.info("模板消息为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("发送模板消息");
|
||||||
|
String title = "您在【" + scenic.getName() + "】的专属影像";
|
||||||
|
String page = "pages/videoSynthesis/index?type=2&scenicId=" + item.getScenicId() + "&faceId=" + item.getFaceId();
|
||||||
|
/**
|
||||||
|
* 景区 {{thing1.DATA}}
|
||||||
|
* 备注 {{thing3.DATA}}
|
||||||
|
*/
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
Map<String, Object> dataParam = new HashMap<>();
|
||||||
|
Map<String, String> videoMap = new HashMap<>();
|
||||||
|
videoMap.put("value", title);
|
||||||
|
dataParam.put("thing1", videoMap);
|
||||||
|
Map<String, String> remarkMap = new HashMap<>();
|
||||||
|
remarkMap.put("value", "请及时购买并下载好您的旅行视频");
|
||||||
|
dataParam.put("thing3", remarkMap);
|
||||||
|
params.put("data", dataParam);
|
||||||
|
params.put("page", page);
|
||||||
|
params.put("template_id", templateId);
|
||||||
|
log.info("视频下载通知模板参数:{},用户ID:{}", params, member.getOpenId());
|
||||||
|
INotifyAdapter adapter = NotifyFactory.get(NotifyType.WX_MP_SRV, scenicMp.toMap());
|
||||||
|
adapter.sendTo(new NotifyContent(title, page, params), member.getOpenId());
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.ycwl.basic.mapper.FaceSampleMapper;
|
|||||||
import com.ycwl.basic.mapper.ScenicMapper;
|
import com.ycwl.basic.mapper.ScenicMapper;
|
||||||
import com.ycwl.basic.mapper.SourceMapper;
|
import com.ycwl.basic.mapper.SourceMapper;
|
||||||
import com.ycwl.basic.mapper.VideoMapper;
|
import com.ycwl.basic.mapper.VideoMapper;
|
||||||
|
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||||
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
import com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity;
|
||||||
@ -105,21 +106,27 @@ public class FaceCleaner {
|
|||||||
}
|
}
|
||||||
FaceReqQuery req = new FaceReqQuery();
|
FaceReqQuery req = new FaceReqQuery();
|
||||||
req.setScenicId(scenic.getId());
|
req.setScenicId(scenic.getId());
|
||||||
req.setUpdateEndTime(DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -faceStoreDay));
|
Date faceEndDate = DateUtil.offsetDay(DateUtil.beginOfDay(new Date()), -faceStoreDay);
|
||||||
List<FaceRespVO> list = faceMapper.list(req);
|
List<FaceEntity> list = faceMapper.listEntityBeforeDate(scenic.getId(), faceEndDate);
|
||||||
list.forEach(face -> {
|
list.forEach(face -> {
|
||||||
boolean result = adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId(), face.getId().toString());
|
boolean result = adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId(), face.getId().toString());
|
||||||
if (result) {
|
if (result) {
|
||||||
log.info("当前景区{},人脸样本ID{},删除成功", scenic.getId(), face.getId());
|
log.info("当前景区{},人脸样本ID{},删除成功", scenic.getId(), face.getId());
|
||||||
faceMapper.deleteById(face.getId());
|
|
||||||
} else {
|
} else {
|
||||||
log.info("当前景区{},人脸样本ID{},删除失败", scenic.getId(), face.getId());
|
result = adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId(), face.getId().toString());
|
||||||
|
if (result) {
|
||||||
|
log.info("当前景区{},人脸样本ID{},删除成功", scenic.getId(), face.getId());
|
||||||
|
} else {
|
||||||
|
log.info("当前景区{},人脸样本ID{},删除失败", scenic.getId(), face.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
faceMapper.forceDeleteById(face.getId());
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 3 * * ?")
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
public void deleteNotBuySource(){
|
public void deleteNotBuySource(){
|
||||||
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
||||||
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
||||||
@ -140,7 +147,7 @@ public class FaceCleaner {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 15 3 * * ?")
|
@Scheduled(cron = "0 15 1 * * ?")
|
||||||
public void deleteNotBuyVideos(){
|
public void deleteNotBuyVideos(){
|
||||||
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
||||||
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
||||||
@ -161,7 +168,7 @@ public class FaceCleaner {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 30 3 * * ?")
|
@Scheduled(cron = "0 30 1 * * ?")
|
||||||
public void deleteExpiredSource(){
|
public void deleteExpiredSource(){
|
||||||
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
ScenicReqQuery scenicQuery = new ScenicReqQuery();
|
||||||
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
|
||||||
@ -200,7 +207,7 @@ public class FaceCleaner {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(cron = "0 0 1 * * ?")
|
@Scheduled(cron = "0 0 2 * * ?")
|
||||||
public void clearOss(){
|
public void clearOss(){
|
||||||
cleanFaceSampleOss();
|
cleanFaceSampleOss();
|
||||||
cleanSourceOss();
|
cleanSourceOss();
|
||||||
@ -218,13 +225,13 @@ public class FaceCleaner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(faceSampleRespVOS.parallelStream().noneMatch(faceSampleRespVO -> faceSampleRespVO.getFaceUrl().contains(fileObject.getFullPath()))){
|
if(faceSampleRespVOS.parallelStream().noneMatch(faceSampleRespVO -> faceSampleRespVO.getFaceUrl().contains(fileObject.getName()))){
|
||||||
log.info("删除人脸文件:{}", fileObject);
|
log.info("删除人脸文件:{}", fileObject);
|
||||||
adapter.deleteFile(fileObject.getFullPath());
|
adapter.deleteFile(fileObject.getFullPath());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void cleanSourceOss() {
|
public void cleanSourceOss() {
|
||||||
log.info("开始清理源视频素材文件");
|
log.info("开始清理源视频素材文件");
|
||||||
List<SourceRespVO> list = sourceMapper.list(new SourceReqQuery());
|
List<SourceRespVO> list = sourceMapper.list(new SourceReqQuery());
|
||||||
scenicMapper.list(new ScenicReqQuery()).forEach(scenic -> {
|
scenicMapper.list(new ScenicReqQuery()).forEach(scenic -> {
|
||||||
@ -238,7 +245,7 @@ public class FaceCleaner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getVideoUrl())).noneMatch(videoRespVO -> videoRespVO.getVideoUrl().contains(fileObject.getFullPath()))){
|
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getVideoUrl())).noneMatch(videoRespVO -> videoRespVO.getVideoUrl().contains(fileObject.getName()))){
|
||||||
log.info("删除文件:{}", fileObject);
|
log.info("删除文件:{}", fileObject);
|
||||||
adapter.deleteFile(fileObject.getFullPath());
|
adapter.deleteFile(fileObject.getFullPath());
|
||||||
} else {
|
} else {
|
||||||
@ -254,7 +261,7 @@ public class FaceCleaner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getUrl())).noneMatch(videoRespVO -> videoRespVO.getUrl().contains(fileObject.getFullPath()))){
|
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getUrl())).noneMatch(videoRespVO -> videoRespVO.getUrl().contains(fileObject.getName()))){
|
||||||
log.info("删除文件:{}", fileObject);
|
log.info("删除文件:{}", fileObject);
|
||||||
adapter.deleteFile(fileObject.getFullPath());
|
adapter.deleteFile(fileObject.getFullPath());
|
||||||
} else {
|
} else {
|
||||||
@ -263,7 +270,7 @@ public class FaceCleaner {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private void cleanVideoOss() {
|
public void cleanVideoOss() {
|
||||||
log.info("开始清理视频文件");
|
log.info("开始清理视频文件");
|
||||||
List<VideoRespVO> list = videoMapper.list(new VideoReqQuery());
|
List<VideoRespVO> list = videoMapper.list(new VideoReqQuery());
|
||||||
scenicMapper.list(new ScenicReqQuery()).forEach(scenic -> {
|
scenicMapper.list(new ScenicReqQuery()).forEach(scenic -> {
|
||||||
@ -277,7 +284,7 @@ public class FaceCleaner {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getVideoUrl())).noneMatch(videoRespVO -> videoRespVO.getVideoUrl().contains(fileObject.getFullPath()))){
|
if (list.parallelStream().filter(videoRespVO -> Objects.nonNull(videoRespVO.getVideoUrl())).noneMatch(videoRespVO -> videoRespVO.getVideoUrl().contains(fileObject.getName()))){
|
||||||
log.info("删除文件:{}", fileObject);
|
log.info("删除文件:{}", fileObject);
|
||||||
adapter.deleteFile(fileObject.getFullPath());
|
adapter.deleteFile(fileObject.getFullPath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,6 +75,7 @@ public class VideoPieceGetter {
|
|||||||
public Long memberId;
|
public Long memberId;
|
||||||
public Long faceId;
|
public Long faceId;
|
||||||
public Long templateId;
|
public Long templateId;
|
||||||
|
public boolean force;
|
||||||
|
|
||||||
public static interface Callback {
|
public static interface Callback {
|
||||||
void onInvoke();
|
void onInvoke();
|
||||||
@ -125,11 +126,11 @@ public class VideoPieceGetter {
|
|||||||
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
final ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
||||||
.setNamePrefix("VPG-" + task.faceId + "-t")
|
.setNamePrefix("VPG-" + task.faceId + "-t")
|
||||||
.build();
|
.build();
|
||||||
final ThreadPoolExecutor executor = new ThreadPoolExecutor(16, 512, 0L, TimeUnit.MILLISECONDS,
|
final ThreadPoolExecutor executor = new ThreadPoolExecutor(16, 128, 0L, TimeUnit.MILLISECONDS,
|
||||||
new ArrayBlockingQueue<>(512),
|
new ArrayBlockingQueue<>(128),
|
||||||
threadFactory
|
threadFactory
|
||||||
);
|
);
|
||||||
List<String> currentPlaceholder = new ArrayList<>();
|
List<String> currentUnFinPlaceholder = new ArrayList<>();
|
||||||
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
|
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
|
||||||
Map<Long, Long> pairDeviceMap = new ConcurrentHashMap<>();
|
Map<Long, Long> pairDeviceMap = new ConcurrentHashMap<>();
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
@ -143,16 +144,24 @@ public class VideoPieceGetter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Collection<List<FaceSampleEntity>> collection = list.stream()
|
Map<Long, List<FaceSampleEntity>> collection = list.stream()
|
||||||
.filter(faceSample -> {
|
.filter(faceSample -> {
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
return templatePlaceholder.contains(faceSample.getDeviceId().toString());
|
return templatePlaceholder.contains(faceSample.getDeviceId().toString());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
|
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId));
|
||||||
.values();
|
if (templatePlaceholder != null) {
|
||||||
collection.forEach(faceSampleList -> {
|
IntStream.range(0, templatePlaceholder.size()).forEach(i -> {
|
||||||
|
currentUnFinPlaceholder.add(templatePlaceholder.get(i));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
collection.keySet().forEach(i -> {
|
||||||
|
currentUnFinPlaceholder.add(i.toString());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
collection.values().forEach(faceSampleList -> {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
AtomicBoolean isFirst = new AtomicBoolean(true);
|
AtomicBoolean isFirst = new AtomicBoolean(true);
|
||||||
faceSampleList.forEach(faceSample -> {
|
faceSampleList.forEach(faceSample -> {
|
||||||
@ -162,6 +171,7 @@ public class VideoPieceGetter {
|
|||||||
} catch (InterruptedException ignore) {
|
} catch (InterruptedException ignore) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isFirst.set(false);
|
||||||
if (pairDeviceMap.containsValue(faceSample.getDeviceId())) {
|
if (pairDeviceMap.containsValue(faceSample.getDeviceId())) {
|
||||||
// 有关联设备!
|
// 有关联设备!
|
||||||
// 找到对应的deviceId
|
// 找到对应的deviceId
|
||||||
@ -171,40 +181,18 @@ public class VideoPieceGetter {
|
|||||||
log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId());
|
log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId());
|
||||||
if (pairDeviceId != null) {
|
if (pairDeviceId != null) {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
boolean result = doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
if (templatePlaceholder != null) {
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
|
||||||
if (!currentPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
|
||||||
if (result) {
|
|
||||||
currentPlaceholder.add(faceSample.getDeviceId().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info("当前进度:{}/{}", currentPlaceholder.size(), collection.size());
|
|
||||||
if (currentPlaceholder.size() >= collection.size()) {
|
|
||||||
if (!invoke.get()) {
|
|
||||||
invoke.set(true);
|
|
||||||
task.getCallback().onInvoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
isFirst.set(false);
|
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
boolean result = doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
if (templatePlaceholder.contains(faceSample.getDeviceId().toString())) {
|
log.info("当前进度:!{}/{}", currentUnFinPlaceholder.size(), templatePlaceholder.size());
|
||||||
if (!currentPlaceholder.contains(faceSample.getDeviceId().toString())) {
|
if (currentUnFinPlaceholder.isEmpty()) {
|
||||||
if (result) {
|
|
||||||
currentPlaceholder.add(faceSample.getDeviceId().toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log.info("当前进度:{}/{}", currentPlaceholder.size(), collection.size());
|
|
||||||
if (currentPlaceholder.size() >= collection.size()) {
|
|
||||||
if (!invoke.get()) {
|
if (!invoke.get()) {
|
||||||
invoke.set(true);
|
invoke.set(true);
|
||||||
task.getCallback().onInvoke();
|
task.getCallback().onInvoke();
|
||||||
@ -242,7 +230,7 @@ public class VideoPieceGetter {
|
|||||||
|
|
||||||
SourceEntity source = sourceMapper.querySameVideo(faceSampleId, device.getId());
|
SourceEntity source = sourceMapper.querySameVideo(faceSampleId, device.getId());
|
||||||
|
|
||||||
if (source == null) {
|
if (source == null || task.force) {
|
||||||
BigDecimal cutPre = BigDecimal.valueOf(5L);
|
BigDecimal cutPre = BigDecimal.valueOf(5L);
|
||||||
BigDecimal cutPost = BigDecimal.valueOf(4L);
|
BigDecimal cutPost = BigDecimal.valueOf(4L);
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
@ -291,38 +279,44 @@ public class VideoPieceGetter {
|
|||||||
// 上传成功后删除文件
|
// 上传成功后删除文件
|
||||||
outFile.delete();
|
outFile.delete();
|
||||||
}
|
}
|
||||||
SourceEntity imgSource = sourceMapper.findBySampleId(faceSampleId);
|
if (source == null) {
|
||||||
SourceEntity sourceEntity = new SourceEntity();
|
SourceEntity imgSource = sourceMapper.findBySampleId(faceSampleId);
|
||||||
sourceEntity.setId(SnowFlakeUtil.getLongId());
|
SourceEntity sourceEntity = new SourceEntity();
|
||||||
sourceEntity.setCreateTime(baseTime);
|
sourceEntity.setId(SnowFlakeUtil.getLongId());
|
||||||
if (imgSource != null) {
|
sourceEntity.setCreateTime(baseTime);
|
||||||
sourceEntity.setUrl(imgSource.getUrl());
|
if (imgSource != null) {
|
||||||
sourceEntity.setPosJson(imgSource.getPosJson());
|
sourceEntity.setUrl(imgSource.getUrl());
|
||||||
}
|
sourceEntity.setPosJson(imgSource.getPosJson());
|
||||||
sourceEntity.setVideoUrl(url);
|
|
||||||
sourceEntity.setFaceSampleId(faceSampleId);
|
|
||||||
sourceEntity.setScenicId(device.getScenicId());
|
|
||||||
sourceEntity.setDeviceId(deviceId);
|
|
||||||
sourceEntity.setType(1);
|
|
||||||
if (task.memberId != null && task.faceId != null) {
|
|
||||||
MemberSourceEntity videoSource = new MemberSourceEntity();
|
|
||||||
videoSource.setMemberId(task.getMemberId());
|
|
||||||
videoSource.setType(1);
|
|
||||||
videoSource.setFaceId(task.getFaceId());
|
|
||||||
videoSource.setScenicId(device.getScenicId());
|
|
||||||
videoSource.setSourceId(sourceEntity.getId());
|
|
||||||
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), device.getScenicId(), 1, task.getFaceId());
|
|
||||||
if (isBuy.isBuy()) { // 如果用户买过
|
|
||||||
videoSource.setIsBuy(1);
|
|
||||||
} else if (isBuy.isFree()) { // 全免费逻辑
|
|
||||||
videoSource.setIsBuy(1);
|
|
||||||
} else {
|
|
||||||
videoSource.setIsBuy(0);
|
|
||||||
}
|
}
|
||||||
sourceMapper.addRelation(videoSource);
|
sourceEntity.setVideoUrl(url);
|
||||||
|
sourceEntity.setFaceSampleId(faceSampleId);
|
||||||
|
sourceEntity.setScenicId(device.getScenicId());
|
||||||
|
sourceEntity.setDeviceId(deviceId);
|
||||||
|
sourceEntity.setType(1);
|
||||||
|
if (task.memberId != null && task.faceId != null) {
|
||||||
|
MemberSourceEntity videoSource = new MemberSourceEntity();
|
||||||
|
videoSource.setMemberId(task.getMemberId());
|
||||||
|
videoSource.setType(1);
|
||||||
|
videoSource.setFaceId(task.getFaceId());
|
||||||
|
videoSource.setScenicId(device.getScenicId());
|
||||||
|
videoSource.setSourceId(sourceEntity.getId());
|
||||||
|
IsBuyRespVO isBuy = orderBiz.isBuy(task.getMemberId(), device.getScenicId(), 1, task.getFaceId());
|
||||||
|
if (isBuy.isBuy()) { // 如果用户买过
|
||||||
|
videoSource.setIsBuy(1);
|
||||||
|
} else if (isBuy.isFree()) { // 全免费逻辑
|
||||||
|
videoSource.setIsBuy(1);
|
||||||
|
} else {
|
||||||
|
videoSource.setIsBuy(0);
|
||||||
|
}
|
||||||
|
sourceMapper.addRelation(videoSource);
|
||||||
|
}
|
||||||
|
sourceMapper.add(sourceEntity);
|
||||||
|
videoReUploader.addTask(sourceEntity.getId());
|
||||||
|
} else {
|
||||||
|
source.setVideoUrl(url);
|
||||||
|
sourceMapper.update(source);
|
||||||
|
videoReUploader.addTask(source.getId());
|
||||||
}
|
}
|
||||||
sourceMapper.add(sourceEntity);
|
|
||||||
videoReUploader.addTask(sourceEntity.getVideoUrl(), sourceEntity.getId());
|
|
||||||
} else {
|
} else {
|
||||||
// 有原视频
|
// 有原视频
|
||||||
if (task.memberId != null && task.faceId != null) {
|
if (task.memberId != null && task.faceId != null) {
|
||||||
|
@ -84,7 +84,7 @@ public class VideoTaskGenerator {
|
|||||||
query.setStartTime(DateUtil.beginOfDay(new Date()));
|
query.setStartTime(DateUtil.beginOfDay(new Date()));
|
||||||
query.setEndTime(DateUtil.endOfDay(new Date()));
|
query.setEndTime(DateUtil.endOfDay(new Date()));
|
||||||
List<FaceRespVO> list = faceMapper.list(query);
|
List<FaceRespVO> list = faceMapper.list(query);
|
||||||
list.stream().parallel().forEach(face -> {
|
list.forEach(face -> {
|
||||||
faceService.matchFaceId(face.getId(), false);
|
faceService.matchFaceId(face.getId(), false);
|
||||||
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
if (Integer.valueOf(3).equals(scenicConfig.getBookRoutine())) {
|
||||||
// 全部生成
|
// 全部生成
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
package com.ycwl.basic.utils;
|
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: songmingsong
|
|
||||||
* @CreateTime: 2024-12-06
|
|
||||||
* @Description: 小数转换
|
|
||||||
* @Version: 1.0
|
|
||||||
*/
|
|
||||||
public class BigDecimalUtil {
|
|
||||||
public static int convertToCents(BigDecimal price) {
|
|
||||||
if (price == null) {
|
|
||||||
throw new IllegalArgumentException("Price cannot be null");
|
|
||||||
}
|
|
||||||
return price
|
|
||||||
.setScale(2, RoundingMode.HALF_UP) // 保留两位小数
|
|
||||||
.multiply(new BigDecimal(100)) // 转换为分
|
|
||||||
.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,186 +0,0 @@
|
|||||||
package com.ycwl.basic.utils;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.PrintWriter;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.security.SecureRandom;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021年05月26日 23:02
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class CommonUtil {
|
|
||||||
/**
|
|
||||||
* 生成指定长度随机字母和数字
|
|
||||||
*/
|
|
||||||
private static final String ALL_CHAR_NUM = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
||||||
|
|
||||||
private static SecureRandom random;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
random = SecureRandom.getInstance("SHA1PRNG");
|
|
||||||
} catch (NoSuchAlgorithmException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取ip
|
|
||||||
*
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getIpAddr(HttpServletRequest request) {
|
|
||||||
String ipAddress = null;
|
|
||||||
try {
|
|
||||||
ipAddress = request.getHeader("x-forwarded-for");
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getHeader("WL-Proxy-Client-IP");
|
|
||||||
}
|
|
||||||
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
|
|
||||||
ipAddress = request.getRemoteAddr();
|
|
||||||
if ("127.0.0.1".equals(ipAddress)) {
|
|
||||||
// 根据网卡取本机配置的IP
|
|
||||||
InetAddress inet = null;
|
|
||||||
try {
|
|
||||||
inet = InetAddress.getLocalHost();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
ipAddress = inet.getHostAddress();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 对于通过多个代理的情况,第一个IP为客户端真实IP,多个IP按照','分割
|
|
||||||
if (ipAddress != null && ipAddress.length() > 15) {
|
|
||||||
// "***.***.***.***".length()
|
|
||||||
// = 15
|
|
||||||
if (ipAddress.indexOf(",") > 0) {
|
|
||||||
ipAddress = ipAddress.substring(0, ipAddress.indexOf(","));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
ipAddress = "";
|
|
||||||
}
|
|
||||||
return ipAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* md5加密
|
|
||||||
*
|
|
||||||
* @param data 需要加密的字符串
|
|
||||||
* @return java.lang.String
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/5/26 23:02
|
|
||||||
*/
|
|
||||||
public static String MD5(String data) {
|
|
||||||
try {
|
|
||||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
|
||||||
byte[] array = md.digest(data.getBytes(StandardCharsets.UTF_8));
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (byte item : array) {
|
|
||||||
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString().toUpperCase();
|
|
||||||
} catch (Exception exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成随机数
|
|
||||||
*
|
|
||||||
* @param length 生成的随机数的长度
|
|
||||||
* @return java.lang.String
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/5/27 16:38
|
|
||||||
*/
|
|
||||||
public static String getRandomCode(int length) {
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
stringBuilder.append(random.nextInt(10));
|
|
||||||
}
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前时间的时间戳
|
|
||||||
*
|
|
||||||
* @return long
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/5/27 22:02
|
|
||||||
*/
|
|
||||||
public static long getCurrentTimestamp() {
|
|
||||||
return System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UUID生成
|
|
||||||
*
|
|
||||||
* @return java.lang.String
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/5/30 21:16
|
|
||||||
*/
|
|
||||||
public static String generateUUID() {
|
|
||||||
return UUID.randomUUID().toString().replace("-", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 生成指定长度随机字母和数字
|
|
||||||
*
|
|
||||||
* @param length 需要生成的字符串长度
|
|
||||||
* @return java.lang.String
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/5/31 16:43
|
|
||||||
*/
|
|
||||||
public static String getStringNumRandom(int length) {
|
|
||||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
||||||
//生成随机数字和字母,
|
|
||||||
StringBuilder saltString = new StringBuilder(length);
|
|
||||||
for (int i = 1; i <= length; ++i) {
|
|
||||||
saltString.append(ALL_CHAR_NUM.charAt(random.nextInt(ALL_CHAR_NUM.length())));
|
|
||||||
}
|
|
||||||
return saltString.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param response 返回response
|
|
||||||
* @param obj 返回的数据
|
|
||||||
* @author wenshijia
|
|
||||||
* @date 2021/6/2 21:11
|
|
||||||
*/
|
|
||||||
public static void sendJsonMessage(HttpServletResponse response, Object obj) {
|
|
||||||
|
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
|
||||||
response.setContentType("application/json; charset=utf-8");
|
|
||||||
|
|
||||||
try (PrintWriter writer = response.getWriter()) {
|
|
||||||
writer.print(objectMapper.writeValueAsString(obj));
|
|
||||||
|
|
||||||
response.flushBuffer();
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.warn("响应json数据给前端异常 -> {}", e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,511 +0,0 @@
|
|||||||
|
|
||||||
package com.ycwl.basic.utils;
|
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.temporal.TemporalAdjusters;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期处理
|
|
||||||
*/
|
|
||||||
public class DateUtils {
|
|
||||||
/**
|
|
||||||
* 时间格式(yyyy-MM-dd)
|
|
||||||
*/
|
|
||||||
public final static String DATE_PATTERN = "yyyy-MM-dd";
|
|
||||||
public final static String DATE_PATTERN_NYR = "yyyy年MM月dd日";
|
|
||||||
public final static String DATE_NO_PATTERN = "yyyyMMdd";
|
|
||||||
public final static String DATE_NO_TIME = "HHmmss";
|
|
||||||
public final static String DATE_PATTERN_YYDD = "MM月dd日 HH:mm";
|
|
||||||
public final static String YYYY_MM = "yyyyMM";
|
|
||||||
public final static String YYYY_MM_DD_HH_MM_SS_SSS = "yyyyMMddHHmmssSSS";
|
|
||||||
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
|
||||||
public final static String CRON_DATE_TIME_PATTERN = "ss mm HH dd MM ? yyyy";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期格式化 日期格式为:yyyy-MM-dd
|
|
||||||
* @param date 日期
|
|
||||||
* @return 返回yyyy-MM-dd格式日期
|
|
||||||
*/
|
|
||||||
public static String format(Date date) {
|
|
||||||
return format(date, DATE_PATTERN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期格式化 自定义格式
|
|
||||||
* @param date 日期
|
|
||||||
* @param pattern 格式,如:DateUtils.DATE_TIME_PATTERN
|
|
||||||
* @return 返回yyyy-MM-dd格式日期
|
|
||||||
*/
|
|
||||||
public static String format(Date date, String pattern) {
|
|
||||||
if (date != null) {
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat(pattern);
|
|
||||||
return df.format(date);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期解析 日期格式为:yyyy-MM-dd HH:mm:ss
|
|
||||||
* @param dataStr 日期字符串
|
|
||||||
* @return 返回yyyy-MM-dd HH:mm:ss格式日期
|
|
||||||
*/
|
|
||||||
public static Date parse(String dataStr) throws ParseException {
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_PATTERN);
|
|
||||||
return sdf.parse(dataStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 日期解析 自定义格式
|
|
||||||
* @param date 日期字符串
|
|
||||||
* @param pattern 格式,如:DateUtils.DATE_TIME_PATTERN
|
|
||||||
* @return 返回Date
|
|
||||||
*/
|
|
||||||
public static Date parse(String date, String pattern) {
|
|
||||||
try {
|
|
||||||
return new SimpleDateFormat(pattern).parse(date);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 返回0时0分0秒的date
|
|
||||||
*
|
|
||||||
* @param date 日期
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@SneakyThrows
|
|
||||||
public static Date startOfDay(Date date) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
// 将时间部分设置为00:00:00.000
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
|
||||||
calendar.set(Calendar.SECOND, 0);
|
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 这个月的第一天
|
|
||||||
* @param date 日期
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date startOfMonth(Date date) {
|
|
||||||
Date date1 = startOfDay(date);
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date1);
|
|
||||||
cal.set(Calendar.DAY_OF_MONTH,1);
|
|
||||||
return cal.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取某个月有多少天
|
|
||||||
*
|
|
||||||
* @param yearMonth
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getLastDayOfMonth(String yearMonth) {
|
|
||||||
int year = Integer.parseInt(yearMonth.split("-")[0]); //年
|
|
||||||
int month = Integer.parseInt(yearMonth.split("-")[1]); //月
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
// 设置年份
|
|
||||||
cal.set(Calendar.YEAR, year);
|
|
||||||
// 设置月份
|
|
||||||
// cal.set(Calendar.MONTH, month - 1);
|
|
||||||
cal.set(Calendar.MONTH, month); //设置当前月的上一个月
|
|
||||||
// 获取某月最大天数
|
|
||||||
//int lastDay = cal.getActualMaximum(Calendar.DATE);
|
|
||||||
int lastDay = cal.getMinimum(Calendar.DATE); //获取月份中的最小值,即第一天
|
|
||||||
// 设置日历中月份的最大天数
|
|
||||||
//cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
|
||||||
cal.set(Calendar.DAY_OF_MONTH, lastDay - 1); //上月的第一天减去1就是当月的最后一天
|
|
||||||
// 格式化日期
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd");
|
|
||||||
return sdf.format(cal.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得某月最大时间
|
|
||||||
* @param date
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date getEndMonthOfDay(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
|
|
||||||
LocalDateTime endOfDay = localDateTime.with(TemporalAdjusters.lastDayOfMonth());
|
|
||||||
return getEndOfDay(localDateTimeToDate(endOfDay));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得某天最大时间
|
|
||||||
* @param date
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date getStartMonthOfDay(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
|
|
||||||
LocalDateTime endOfDay = localDateTime.with(TemporalAdjusters.firstDayOfMonth());
|
|
||||||
return getStartOfDay(localDateTimeToDate(endOfDay));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Date getMonthLastDay(Date date) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.set(Calendar.DAY_OF_MONTH, 0);
|
|
||||||
calendar.add(Calendar.MONTH, 1);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断当天和传入的时间是否是同一天
|
|
||||||
*
|
|
||||||
* @param thatDay 另一个日期
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isSameDay(Date thatDay) {
|
|
||||||
return isSameDay(thatDay, new Date());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断两个日期是否为同一天
|
|
||||||
*
|
|
||||||
* @param date1 一个日期
|
|
||||||
* @param date2 另一个日期
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static boolean isSameDay(Date date1, Date date2) {
|
|
||||||
if (date1 == null || date2 == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Calendar thisDat = Calendar.getInstance();
|
|
||||||
thisDat.setTime(date1);
|
|
||||||
Calendar thatDay = Calendar.getInstance();
|
|
||||||
thatDay.setTime(date2);
|
|
||||||
return (
|
|
||||||
thatDay.get(Calendar.YEAR) == thisDat.get(Calendar.YEAR) &&
|
|
||||||
thatDay.get(Calendar.MONTH) == thisDat.get(Calendar.MONTH) &&
|
|
||||||
thatDay.get(Calendar.DAY_OF_MONTH) == thisDat.get(Calendar.DAY_OF_MONTH)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断两个日期相差多少天
|
|
||||||
*
|
|
||||||
* @param endTime
|
|
||||||
* @param startTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int dateMinus(Date endTime, Date startTime) {
|
|
||||||
return (int) ((endTime.getTime() - startTime.getTime()) / (1000 * 60 * 60 * 24));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间戳转字符串
|
|
||||||
*
|
|
||||||
* @param timeStamp
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
//传入时间戳即可
|
|
||||||
public static String conversionTime(String timeStamp) {
|
|
||||||
//yyyy-MM-dd HH:mm:ss 转换的时间格式 可以自定义
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
//转换
|
|
||||||
String time = sdf.format(new Date(Long.parseLong(timeStamp)));
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断两个日期相差多少秒
|
|
||||||
*
|
|
||||||
* @param endTime
|
|
||||||
* @param startTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int dateSeconds(Date endTime, Date startTime) {
|
|
||||||
return (int) ((endTime.getTime() - startTime.getTime()) / (1000));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得某天最小时间
|
|
||||||
* @param date
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date getStartOfDay(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
|
|
||||||
LocalDateTime startOfDay = localDateTime.with(LocalTime.MIN);
|
|
||||||
return localDateTimeToDate(startOfDay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获得某天最大时间
|
|
||||||
* @param date
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date getEndOfDay(Date date) {
|
|
||||||
if (date == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(date.getTime()), ZoneId.systemDefault());
|
|
||||||
LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX);
|
|
||||||
return localDateTimeToDate(endOfDay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* localDateTime 转date
|
|
||||||
* @param localDateTime
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date localDateTimeToDate(LocalDateTime localDateTime) {
|
|
||||||
return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将秒转为时分秒格式【01:01:01】
|
|
||||||
* @param second 需要转化的秒数
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String secondConvertHourMinSecond(Long second) {
|
|
||||||
String str = "00:00:00";
|
|
||||||
if (second == null || second < 0) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 得到小时
|
|
||||||
long h = second / 3600;
|
|
||||||
str = h > 0 ? ((h < 10 ? ("0" + h) : h) + ":") : "00:";
|
|
||||||
|
|
||||||
// 得到分钟
|
|
||||||
long m = (second % 3600) / 60;
|
|
||||||
str += (m < 10 ? ("0" + m) : m) + ":";
|
|
||||||
|
|
||||||
//得到剩余秒
|
|
||||||
long s = second % 60;
|
|
||||||
str += (s < 10 ? ("0" + s) : s);
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param date
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static String getWeekOfDate(Date date) {
|
|
||||||
String[] weekDays = {"7", "1", "2", "3", "4", "5", "6"}; // "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"
|
|
||||||
Calendar cal = Calendar.getInstance();
|
|
||||||
cal.setTime(date);
|
|
||||||
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; // 将星期日转换为7
|
|
||||||
return weekDays[w]; // 直接返回对应的星期数
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取两个日期之间的所有年
|
|
||||||
* @param startDate
|
|
||||||
* @param endDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getAllYearsBetweenDates(Date startDate, Date endDate) {
|
|
||||||
List<String> years = new ArrayList<>();
|
|
||||||
Calendar startCal = Calendar.getInstance();
|
|
||||||
startCal.setTime(startDate);
|
|
||||||
int startYear = startCal.get(Calendar.YEAR);
|
|
||||||
|
|
||||||
Calendar endCal = Calendar.getInstance();
|
|
||||||
endCal.setTime(endDate);
|
|
||||||
int endYear = endCal.get(Calendar.YEAR);
|
|
||||||
|
|
||||||
for (int year = startYear; year <= endYear; year++) {
|
|
||||||
years.add(String.valueOf(year));
|
|
||||||
}
|
|
||||||
return years;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取两个日期之间的所有月份
|
|
||||||
* @param startDate
|
|
||||||
* @param endDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getAllMonthsBetweenDates(Date startDate, Date endDate) {
|
|
||||||
List<String> months = new ArrayList<>();
|
|
||||||
//具体逻辑
|
|
||||||
Calendar startCal = Calendar.getInstance();
|
|
||||||
startCal.setTime(startDate);
|
|
||||||
startCal.set(Calendar.DAY_OF_MONTH, 1); // 设置为每个月的第一天
|
|
||||||
|
|
||||||
Calendar endCal = Calendar.getInstance();
|
|
||||||
endCal.setTime(endDate);
|
|
||||||
endCal.set(Calendar.DAY_OF_MONTH, 1); // 设置为每个月的第一天
|
|
||||||
|
|
||||||
while (startCal.before(endCal) || startCal.equals(endCal)) {
|
|
||||||
int year = startCal.get(Calendar.YEAR);
|
|
||||||
int month = startCal.get(Calendar.MONTH) + 1; // Calendar中月份从0开始,所以要加1
|
|
||||||
months.add(String.format("%d-%02d", year, month)); // 格式化年份和月份为 yyyy-MM
|
|
||||||
|
|
||||||
startCal.add(Calendar.MONTH, 1); // 增加一个月
|
|
||||||
}
|
|
||||||
return months;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取两个日期间所有的日期
|
|
||||||
* @param startDate
|
|
||||||
* @param endDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getAllDaysBetweenDates(Date startDate, Date endDate){
|
|
||||||
List<String> days = new ArrayList<>();
|
|
||||||
//具体实现
|
|
||||||
Calendar startCal = Calendar.getInstance();
|
|
||||||
startCal.setTime(startDate);
|
|
||||||
|
|
||||||
Calendar endCal = Calendar.getInstance();
|
|
||||||
endCal.setTime(endDate);
|
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
||||||
|
|
||||||
while (startCal.before(endCal) || startCal.equals(endCal)) {
|
|
||||||
days.add(sdf.format(startCal.getTime()));
|
|
||||||
startCal.add(Calendar.DATE, 1);
|
|
||||||
}
|
|
||||||
return days;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取两个时间点之间的所有的整点时间
|
|
||||||
* @param startDate
|
|
||||||
* @param endDate
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getAllTimesBetweenDates(Date startDate, Date endDate,String format){
|
|
||||||
// 创建一个字符串列表用来存放整点时间
|
|
||||||
List<String> timesList = new ArrayList<>();
|
|
||||||
// 使用日历类来处理时间
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(startDate);
|
|
||||||
|
|
||||||
// 格式化时间为 "yyyy-MM-dd HH:mm"
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(format);
|
|
||||||
|
|
||||||
// 逐小时遍历
|
|
||||||
// while (calendar.getTime().before(endDate) || calendar.getTime().equals(endDate)) {
|
|
||||||
while (calendar.getTime().before(endDate)) {
|
|
||||||
// 将当前时间格式化为字符串并加入列表
|
|
||||||
timesList.add(sdf.format(calendar.getTime()));
|
|
||||||
// 增加一个小时
|
|
||||||
calendar.add(Calendar.HOUR_OF_DAY, 1);
|
|
||||||
}
|
|
||||||
return timesList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取24小时制的时间
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static List<String> getAllTimesBetweenDates(){
|
|
||||||
// 创建一个字符串数组,容量为24
|
|
||||||
String[] times24 = new String[24];
|
|
||||||
// 设置格式化器为24小时制
|
|
||||||
java.time.format.DateTimeFormatter formatter = java.time.format.DateTimeFormatter.ofPattern("HH");
|
|
||||||
// 获取0点到23点的每一个小时
|
|
||||||
for (int i = 0; i < 24; i++) {
|
|
||||||
LocalTime time = LocalTime.of(i, 0);
|
|
||||||
times24[i] = time.format(formatter);
|
|
||||||
}
|
|
||||||
return new ArrayList<>(Arrays.asList(times24));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在指定日期上增加i年,负数为减少i年
|
|
||||||
* @param date 指定的日期
|
|
||||||
* @param i 增加/减少的年数
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date addDateYears(Date date, int i) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.add(Calendar.YEAR, i);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在指定日期上增加i月,负数为减少i月
|
|
||||||
* @param date
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date addDateMonths(Date date, int i) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.add(Calendar.MONTH, i);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在指定日期上增加i周,负数为减少i周
|
|
||||||
* @param date
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date addDateWeeks(Date date, int i) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.add(Calendar.WEEK_OF_YEAR, i);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在指定日期上增加i天,负数为减少i天
|
|
||||||
* @param date
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date addDateDays(Date date, int i) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, i);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 在指定日期上增加i分钟,负数为减少i分钟
|
|
||||||
* @param date
|
|
||||||
* @param i
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Date addDateMinute(Date date, int i) {
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(date);
|
|
||||||
calendar.add(Calendar.MINUTE, i);
|
|
||||||
return calendar.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Date date = new Date();
|
|
||||||
Date yesterday = DateUtils.addDateMinute(date, 10);
|
|
||||||
System.out.println(format(yesterday, "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
// Date startDate = DateUtils.getStartOfDay(yesterday);
|
|
||||||
// Date endDate = DateUtils.getEndOfDay(yesterday);
|
|
||||||
// System.out.println(format(startDate, "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
// System.out.println(format(endDate, "yyyy-MM-dd HH:mm:ss"));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,8 +3,7 @@ package com.ycwl.basic.utils;
|
|||||||
|
|
||||||
import com.ycwl.basic.model.snowFlake.UniqueId;
|
import com.ycwl.basic.model.snowFlake.UniqueId;
|
||||||
import com.ycwl.basic.model.snowFlake.UniqueIdMetaData;
|
import com.ycwl.basic.model.snowFlake.UniqueIdMetaData;
|
||||||
import org.slf4j.Logger;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -13,10 +12,10 @@ import java.util.Date;
|
|||||||
* @author Created by liuhongguang
|
* @author Created by liuhongguang
|
||||||
* @Description
|
* @Description
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class SnowFlakeUtil {
|
public class SnowFlakeUtil {
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(com.ycwl.basic.utils.SnowFlakeUtil.class);
|
|
||||||
/**
|
/**
|
||||||
* 记录上一毫秒数
|
* 记录上一毫秒数
|
||||||
*/
|
*/
|
||||||
|
@ -10,7 +10,6 @@ import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
|||||||
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
|
||||||
import com.ycwl.basic.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
import com.ycwl.basic.repository.VideoRepository;
|
import com.ycwl.basic.repository.VideoRepository;
|
||||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
|
||||||
import com.ycwl.basic.service.pc.ScenicService;
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||||
import com.ycwl.basic.storage.enums.StorageAcl;
|
import com.ycwl.basic.storage.enums.StorageAcl;
|
||||||
@ -21,19 +20,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ArrayBlockingQueue;
|
import java.util.concurrent.ArrayBlockingQueue;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -41,7 +32,7 @@ public class VideoReUploader {
|
|||||||
private static final ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
private static final ThreadFactory threadFactory = new ThreadFactoryBuilder()
|
||||||
.setNamePrefix("Vid-ReUp-")
|
.setNamePrefix("Vid-ReUp-")
|
||||||
.build();
|
.build();
|
||||||
private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(8, 1024, 0L, TimeUnit.MILLISECONDS,
|
private static final ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1024, 0L, TimeUnit.MILLISECONDS,
|
||||||
new ArrayBlockingQueue<>(1024),
|
new ArrayBlockingQueue<>(1024),
|
||||||
threadFactory
|
threadFactory
|
||||||
);
|
);
|
||||||
@ -57,7 +48,7 @@ public class VideoReUploader {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
|
|
||||||
public void addTask(String url, Long sourceId) {
|
public void addTask(Long sourceId) {
|
||||||
SourceEntity entity = sourceMapper.getEntity(sourceId);
|
SourceEntity entity = sourceMapper.getEntity(sourceId);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
@ -74,16 +65,16 @@ public class VideoReUploader {
|
|||||||
}
|
}
|
||||||
final String dstFilePath = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, entity.getId().toString() + ".mp4");
|
final String dstFilePath = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, entity.getId().toString() + ".mp4");
|
||||||
final IStorageAdapter adapter = scenicService.getScenicStorageAdapter(entity.getScenicId());
|
final IStorageAdapter adapter = scenicService.getScenicStorageAdapter(entity.getScenicId());
|
||||||
if (StringUtils.equals(url, adapter.getUrl(dstFilePath))) {
|
if (StringUtils.equals(entity.getVideoUrl(), adapter.getUrl(dstFilePath))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String tmpFilePath = UUID.randomUUID().toString();
|
String tmpFilePath = UUID.randomUUID().toString();
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
// 先下载,后上传
|
// 先下载,后上传
|
||||||
File dstFile = new File(tmpFilePath);
|
File dstFile = new File(tmpFilePath);
|
||||||
log.info("下载视频:{};sourceId:{}", url, sourceId);
|
log.info("下载视频:{};sourceId:{}", entity.getVideoUrl(), sourceId);
|
||||||
long size = HttpUtil.downloadFile(url, dstFile);
|
long size = HttpUtil.downloadFile(entity.getVideoUrl(), dstFile);
|
||||||
log.info("下载视频完成:{};大小:{};sourceId:{}", url, size, sourceId);
|
log.info("下载视频完成:{};大小:{};sourceId:{}", entity.getVideoUrl(), size, sourceId);
|
||||||
try {
|
try {
|
||||||
log.info("开始上传:{};sourceId:{}", dstFilePath, sourceId);
|
log.info("开始上传:{};sourceId:{}", dstFilePath, sourceId);
|
||||||
String newUrl = adapter.uploadFile("video/mp4", dstFile, dstFilePath);
|
String newUrl = adapter.uploadFile("video/mp4", dstFile, dstFilePath);
|
||||||
@ -102,7 +93,7 @@ public class VideoReUploader {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void addVideoTask(String url, Long videoId) {
|
public void addVideoTask(Long videoId) {
|
||||||
VideoEntity entity = videoMapper.getEntity(videoId);
|
VideoEntity entity = videoMapper.getEntity(videoId);
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
@ -110,22 +101,18 @@ public class VideoReUploader {
|
|||||||
if (entity.getScenicId() == null) {
|
if (entity.getScenicId() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ScenicConfigEntity scenicConfig = scenicRepository.getScenicConfig(entity.getScenicId());
|
|
||||||
if (scenicConfig == null || scenicConfig.getTmpStoreType() == null || scenicConfig.getTmpStoreConfigJson() == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final String dstFilePath = StorageUtil.joinPath(StorageConstant.VLOG_PATH, entity.getTaskId() + "_" + entity.getScenicId() + ".mp4");
|
final String dstFilePath = StorageUtil.joinPath(StorageConstant.VLOG_PATH, entity.getTaskId() + "_" + entity.getScenicId() + ".mp4");
|
||||||
final IStorageAdapter adapter = scenicService.getScenicStorageAdapter(entity.getScenicId());
|
final IStorageAdapter adapter = scenicService.getScenicStorageAdapter(entity.getScenicId());
|
||||||
if (StringUtils.equals(url, adapter.getUrl(dstFilePath))) {
|
if (StringUtils.equals(entity.getVideoUrl(), adapter.getUrl(dstFilePath))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String tmpFilePath = UUID.randomUUID().toString();
|
String tmpFilePath = UUID.randomUUID().toString();
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
// 先下载,后上传
|
// 先下载,后上传
|
||||||
File dstFile = new File(tmpFilePath);
|
File dstFile = new File(tmpFilePath);
|
||||||
log.info("下载视频:{};videoId:{}", url, videoId);
|
log.info("下载视频:{};videoId:{}", entity.getVideoUrl(), videoId);
|
||||||
long size = HttpUtil.downloadFile(url, dstFile);
|
long size = HttpUtil.downloadFile(entity.getVideoUrl(), dstFile);
|
||||||
log.info("下载视频完成:{};大小:{};videoId:{}", url, size, videoId);
|
log.info("下载视频完成:{};大小:{};videoId:{}", entity.getVideoUrl(), size, videoId);
|
||||||
try {
|
try {
|
||||||
log.info("开始上传:{};videoId:{}", dstFilePath, videoId);
|
log.info("开始上传:{};videoId:{}", dstFilePath, videoId);
|
||||||
String newUrl = adapter.uploadFile("video/mp4", dstFile, dstFilePath);
|
String newUrl = adapter.uploadFile("video/mp4", dstFile, dstFilePath);
|
||||||
|
@ -76,6 +76,6 @@ public class WxMpUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3972138108618674176", "ljh_t.jpg");
|
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3978838215909052416", "dhg_t.jpg");
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,13 +32,14 @@ spring:
|
|||||||
password: ZhEnTuAi
|
password: ZhEnTuAi
|
||||||
timeout: 40000
|
timeout: 40000
|
||||||
# 配置用户头像存放静态资源文件夹
|
# 配置用户头像存放静态资源文件夹
|
||||||
resources:
|
|
||||||
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
|
||||||
# 配置请求文件大小
|
# 配置请求文件大小
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
max-file-size: 500MB
|
max-file-size: 500MB
|
||||||
max-request-size: 500MB
|
max-request-size: 500MB
|
||||||
|
web:
|
||||||
|
resources:
|
||||||
|
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
||||||
|
|
||||||
# MyBatis
|
# MyBatis
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
|
||||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDHwDoab8iRX4vn
|
|
||||||
Ta3a+gh5Z3wcyTM3VkWhkAPJGNJhaNgzOBI9b4v1x+uSZ4To2uXhQE5hvcxWSfNZ
|
|
||||||
F7H6yp+6estADeZLpdXLBDBvPDOjEGhG7YUHJjWnFh5eY2Rtnx4/7x+xCsRS+Mtq
|
|
||||||
Mx6KMrb4UZYNIq14peTQgfICkDBdqnUIkFjDmChUy0LlsSFW8AyJIqrBec5VZWf/
|
|
||||||
QqsIBf9vsTVxrqlX+5owYZuPYoFOIQJFUW8dfU20qk//BxiDjPFZBLNa02aIEbNF
|
|
||||||
SXZE2TlKD7zD0Qv/w95Hf1V+a/cxP2B6LNtqwioIdHbU6Axu7uHkr0RSPXPsvOWY
|
|
||||||
eUIpGP4bAgMBAAECggEBALm34w3TYtKu2D/tfDh9gkWGTuHgu6q2nrTxVmOxnWEN
|
|
||||||
/v3YIzVVsfaJs2ACuZNaeqNsi7PaqNKNnSD3o/X+UHYsVy8t/THWdSl1sqapfYUd
|
|
||||||
6yYPDkEwaG/6Y6/0j1pQt+pPpNKRpSlTwqTx9HIfZvkHuhBqbokfDNhECUQS1bUu
|
|
||||||
8pmyALIkuXu38B/xCs/EH+Lp1N69IA0mwalT/2zi9ZJhGNg5OWBzNbkMKf2Tck+9
|
|
||||||
SnS6s+pAT6YxB9qYhg645H3dRKXdeSYbjI+uiIe/7cJvTxfQDLD/oDap2TJQH3iM
|
|
||||||
SVbSfNFbR1tH6PiYx9eXeElEg2QXEPztbf8NcUlGOGkCgYEA8PewLVzUdHD20KkX
|
|
||||||
tZP+JCvSTy2f0kPHTc3+BU+MOlG8uZzsK06efo+X5BGkMRj8P+MPp9rJQr5IJqJl
|
|
||||||
GpeA1XpF54v2DIcNcjrQHIJ9XWoWirZjMWRVn4D5laQTI+FEV8pyFfJJOLIgBe9b
|
|
||||||
c6hBHNnAB4Y6JZ/s+US4ymK4wQ0CgYEA1DZMcuyiUgjnprUsOIokpg8RxGLIvB5+
|
|
||||||
2FyCffa/CikMRU8bRtHdpJLguArrR9rEILU6fICPARdlCg8r0XMrvniiAaS3YlDj
|
|
||||||
tSxbfrrS6xySvVFdNusv/j3i5/76IedsSArJLeQpIZMZ3n6q/dmq4kbWh+bT/5z+
|
|
||||||
MVpjWixpYccCgYBtaEh5kDh2VgP6YYv+SZ+OVMc8Y/64vUV0sh6v0ppcsFf7/p/M
|
|
||||||
WfnkhNX2G3xtPmbpqvKkx9WxlCu2Pu2g0UERrF6o7wdcUMVuI/3xs92v2Ec72+vV
|
|
||||||
tTSbIzgvFTwLgnBBXA3IoSVVtKqNh0wCi1Zk/wkNYYhtJNu3odg1K/Wu0QKBgBOv
|
|
||||||
IbI7TucrGkm1Xm+0KKgal7xOqW4BqiRpmFUU0S2hFxlKuC3+g3+jfCK2KJLWsQCT
|
|
||||||
ruQjjKA+Skn/lEHuW+1kBSr/217MQALrJWWA8NWMJfRXmrzgXehIV0bLuOnyLHIW
|
|
||||||
Rgjys/oAShMATt4TFa29gmLCv4FjT5TGXJbdrby7AoGBAOqER71Vi90UV84sYLWx
|
|
||||||
DSW/3q5/QrndmeeaQALslA6sidnTZWqlhMsNPl8dfBKl6xnrCdcaeY5xk/xmVOqP
|
|
||||||
0KedJgT+IjLwY1yJ9QOBd02ejAY3qNlKt2NiSWv2GBY1cZxqhkHNaI/UWI9CAyH5
|
|
||||||
YfkdFNxtYLdVAwuylMoV3fKI
|
|
||||||
-----END PRIVATE KEY-----
|
|
Binary file not shown.
@ -71,8 +71,7 @@
|
|||||||
</delete>
|
</delete>
|
||||||
<select id="list" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
<select id="list" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
||||||
select d.id, scenic_id, d.name, no, d.longitude, d.latitude, d.status, create_at, d.update_at, s.name scenic_name, d.keepalive_at, d.online, p.wvp_device_no as device_no, p.wvp_channel_no channel_no,
|
select d.id, scenic_id, d.name, no, d.longitude, d.latitude, d.status, create_at, d.update_at, s.name scenic_name, d.keepalive_at, d.online, p.wvp_device_no as device_no, p.wvp_channel_no channel_no,
|
||||||
(select s.url from source s where s.device_id=d.id order by id desc limit 1) coverUrl,
|
(select s.url from source s where s.device_id=d.id order by id desc limit 1) coverUrl
|
||||||
(select s.create_time from source s where s.device_id=d.id order by id desc limit 1) coverTime
|
|
||||||
from device d
|
from device d
|
||||||
left join scenic s on d.scenic_id = s.id
|
left join scenic s on d.scenic_id = s.id
|
||||||
left join device_preview_config p on d.id = p.device_id and p.status = 1
|
left join device_preview_config p on d.id = p.device_id and p.status = 1
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
<delete id="deleteById">
|
<delete id="deleteById">
|
||||||
update face set is_delete = 1 where id = #{id}
|
update face set is_delete = 1 where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="forceDeleteById">
|
||||||
|
DELETE FROM face where id = #{id}
|
||||||
|
</delete>
|
||||||
<delete id="deleteByIds">
|
<delete id="deleteByIds">
|
||||||
<if test="list!= null and list.size() > 0">
|
<if test="list!= null and list.size() > 0">
|
||||||
update face set is_delete = 1 where id in (
|
update face set is_delete = 1 where id in (
|
||||||
@ -121,6 +124,6 @@
|
|||||||
SELECT * FROM `zt`.`face_sample` WHERE `scenic_id` = '3930324797233434624' AND `create_at` < '2025-03-07 14:40:36' AND `device_id` = '3961959104355897344'
|
SELECT * FROM `zt`.`face_sample` WHERE `scenic_id` = '3930324797233434624' AND `create_at` < '2025-03-07 14:40:36' AND `device_id` = '3961959104355897344'
|
||||||
</select>
|
</select>
|
||||||
<select id="listEntityBeforeDate" resultType="com.ycwl.basic.model.pc.face.entity.FaceEntity">
|
<select id="listEntityBeforeDate" resultType="com.ycwl.basic.model.pc.face.entity.FaceEntity">
|
||||||
SELECT * FROM `zt`.`face` WHERE `scenic_id` = #{scenicId} AND `create_at` < #{date}
|
SELECT * FROM `zt`.`face` WHERE `scenic_id` = #{scenicId} AND `create_at` < #{endDate}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -122,7 +122,7 @@
|
|||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="findByAccessKey" resultType="com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity">
|
<select id="findByAccessKey" resultType="com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity">
|
||||||
select id, `name`, scenic_only, test_only, `online`, `status`, create_at, update_at
|
select id, `name`, scenic_only, test_only, `online`, `status`, create_at, update_at, store_type, store_config_json
|
||||||
from render_worker
|
from render_worker
|
||||||
where access_key = #{accessKey} and status = 1
|
where access_key = #{accessKey} and status = 1
|
||||||
</select>
|
</select>
|
||||||
|
@ -125,7 +125,8 @@
|
|||||||
pay_type=#{payType},
|
pay_type=#{payType},
|
||||||
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}
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
@ -139,7 +139,7 @@
|
|||||||
<if test="isBuy!=null">and ms.is_buy = #{isBuy} </if>
|
<if test="isBuy!=null">and ms.is_buy = #{isBuy} </if>
|
||||||
<if test="type!=null">and ms.type = #{type} </if>
|
<if test="type!=null">and ms.type = #{type} </if>
|
||||||
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
||||||
order by so.create_time asc
|
order by ms.is_free desc, so.create_time asc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listUserOne" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
<select id="listUserOne" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||||
@ -214,4 +214,14 @@
|
|||||||
</if>
|
</if>
|
||||||
and watermark_type = #{watermarkType}
|
and watermark_type = #{watermarkType}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="countUser" resultType="java.lang.Integer">
|
||||||
|
select count(1)
|
||||||
|
from member_source ms
|
||||||
|
where
|
||||||
|
ms.member_id = #{memberId}
|
||||||
|
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||||
|
<if test="isBuy!=null">and ms.is_buy = #{isBuy} </if>
|
||||||
|
<if test="type!=null">and ms.type = #{type} </if>
|
||||||
|
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -23,23 +23,19 @@
|
|||||||
IFNULL(count(1), 0) AS count
|
IFNULL(count(1), 0) AS count
|
||||||
FROM (
|
FROM (
|
||||||
select count(1) as count
|
select count(1) as count
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type=2 and scenic_id = #{scenicId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
|
||||||
|
and action = "LOAD"
|
||||||
|
and identifier = "pages/videoSynthesis/buy"
|
||||||
|
and JSON_EXTRACT(`params`, '$.share') is null
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and r.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and r.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
and morph_id is not null
|
group by s.member_id
|
||||||
and member_id in (select member_id from statistics where type = 10
|
|
||||||
<if test="startTime!= null">
|
|
||||||
and create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime!= null">
|
|
||||||
and create_time <= #{endTime}
|
|
||||||
</if>)
|
|
||||||
group by member_id
|
|
||||||
)a
|
)a
|
||||||
</select>
|
</select>
|
||||||
<select id="countScanCodeOfMember" resultType="java.lang.Integer">
|
<select id="countScanCodeOfMember" resultType="java.lang.Integer">
|
||||||
@ -47,15 +43,18 @@
|
|||||||
IFNULL(count(1), 0) AS count
|
IFNULL(count(1), 0) AS count
|
||||||
FROM (
|
FROM (
|
||||||
select 1
|
select 1
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type=10 and morph_id in (1047,1048,1049) and scenic_id = #{scenicId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
|
||||||
|
and action = "LAUNCH"
|
||||||
|
and JSON_EXTRACT(`params`, '$.scene') in (1047,1048,1049)
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and s.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and s.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
group by member_id
|
group by s.member_id
|
||||||
) AS subquery;
|
) AS subquery;
|
||||||
</select>
|
</select>
|
||||||
<select id="countClickPayOfMember" resultType="java.lang.Integer">
|
<select id="countClickPayOfMember" resultType="java.lang.Integer">
|
||||||
@ -127,22 +126,17 @@
|
|||||||
IFNULL(count(1), 0) AS count
|
IFNULL(count(1), 0) AS count
|
||||||
FROM (
|
FROM (
|
||||||
select count(1) as count
|
select count(1) as count
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type=6 and scenic_id = #{scenicId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
|
||||||
|
and action = "PERM_REQ" and identifier = "NOTIFY"
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and r.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and r.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
and member_id in (select member_id from statistics where type = 10
|
group by s.member_id
|
||||||
<if test="startTime!= null">
|
|
||||||
and create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime!= null">
|
|
||||||
and create_time <= #{endTime}
|
|
||||||
</if>)
|
|
||||||
group by member_id
|
|
||||||
)a
|
)a
|
||||||
</select>
|
</select>
|
||||||
<select id="countCameraShotOfMember" resultType="java.lang.Integer">
|
<select id="countCameraShotOfMember" resultType="java.lang.Integer">
|
||||||
@ -164,48 +158,43 @@
|
|||||||
where scenic_id = #{scenicId}
|
where scenic_id = #{scenicId}
|
||||||
<if test="startTime!= null">and create_at >= #{startTime}</if>
|
<if test="startTime!= null">and create_at >= #{startTime}</if>
|
||||||
<if test="endTime!= null">and create_at <= #{endTime}</if>
|
<if test="endTime!= null">and create_at <= #{endTime}</if>
|
||||||
and member_id in (select member_id from statistics where type = 10
|
|
||||||
<if test="startTime!= null">
|
|
||||||
and create_time >= #{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime!= null">
|
|
||||||
and create_time <= #{endTime}
|
|
||||||
</if>)
|
|
||||||
group by member_id
|
group by member_id
|
||||||
) a
|
) a
|
||||||
</select>
|
</select>
|
||||||
<select id="countCompleteVideoOfMember" resultType="java.lang.Integer">
|
<select id="countCompleteVideoOfMember" resultType="java.lang.Integer">
|
||||||
select ifnull(count(1),0) as count
|
select ifnull(count(1),0) as count
|
||||||
from(
|
from(
|
||||||
select mv.member_id
|
select 1
|
||||||
from member_video mv
|
from video v
|
||||||
left join face f on f.id = mv.face_id
|
left join task t on v.task_id = t.id
|
||||||
|
left join face f on f.id = t.face_id
|
||||||
where f.scenic_id = #{scenicId}
|
where f.scenic_id = #{scenicId}
|
||||||
and f.member_id in (select member_id from statistics where type = 10
|
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and v.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and v.create_time <= #{endTime}
|
||||||
</if>)
|
</if>
|
||||||
group by mv.member_id
|
group by f.member_id
|
||||||
)a
|
)a
|
||||||
</select>
|
</select>
|
||||||
<select id="countTotalVisitorOfMember" resultType="java.lang.Integer">
|
<select id="countTotalVisitorOfMember" resultType="java.lang.Integer">
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(count(1), 0) AS count
|
IFNULL(count(1), 0) AS count
|
||||||
FROM (
|
FROM (
|
||||||
select count(1) as count
|
select 1
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type in (10) and scenic_id = #{scenicId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
|
||||||
|
and action = "LAUNCH"
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and s.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and s.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
group by member_id
|
group by s.member_id
|
||||||
) AS a;
|
) AS subquery;
|
||||||
</select>
|
</select>
|
||||||
<select id="countCompleteOfVideo" resultType="java.lang.Integer">
|
<select id="countCompleteOfVideo" resultType="java.lang.Integer">
|
||||||
select count(1) as count
|
select count(1) as count
|
||||||
@ -223,15 +212,17 @@
|
|||||||
IFNULL(SUM(count), 0) AS count
|
IFNULL(SUM(count), 0) AS count
|
||||||
FROM (
|
FROM (
|
||||||
select count(1) as count
|
select count(1) as count
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type=0 and scenic_id = #{scenicId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
<if test="startTime!= null">
|
where r.trace_id in (select trace_id from `t_stats_record` where action = "ENTER_SCENIC" and `identifier`=#{scenicId})
|
||||||
and create_time >= #{startTime}
|
and action = "LOAD" and identifier = "pages/videoSynthesis/buy"
|
||||||
</if>
|
<if test="startTime!= null">
|
||||||
<if test="endTime!= null">
|
and s.create_time >= #{startTime}
|
||||||
and create_time <= #{endTime}
|
</if>
|
||||||
</if>
|
<if test="endTime!= null">
|
||||||
group by morph_id
|
and s.create_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
group by JSON_EXTRACT(`params`, "$.id")
|
||||||
)a
|
)a
|
||||||
</select>
|
</select>
|
||||||
<select id="countPayOfOrder" resultType="java.lang.Integer">
|
<select id="countPayOfOrder" resultType="java.lang.Integer">
|
||||||
@ -271,29 +262,32 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="getBrokerIdListForUser" resultType="java.lang.Long">
|
<select id="getBrokerIdListForUser" resultType="java.lang.Long">
|
||||||
select morph_id
|
select identifier
|
||||||
from (
|
from (
|
||||||
select morph_id, max(create_time) as createTime
|
select identifier, max(r.create_time) as createTime
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type = 20 and member_id = #{memberId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where action = "CODE_SCAN"
|
||||||
|
and s.member_id = #{memberId}
|
||||||
<if test="startTime!= null">
|
<if test="startTime!= null">
|
||||||
and create_time >= #{startTime}
|
and r.create_time >= #{startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and r.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
group by morph_id
|
group by identifier
|
||||||
) a
|
) a
|
||||||
order by createTime desc
|
order by createTime desc
|
||||||
</select>
|
</select>
|
||||||
<select id="getUserRecentEnterType" resultType="java.lang.Long">
|
<select id="getUserRecentEnterType" resultType="java.lang.Long">
|
||||||
select morph_id
|
select JSON_EXTRACT(`params`, '$.scene')
|
||||||
from statistics
|
FROM `t_stats_record` r
|
||||||
where type = 10 and member_id = #{memberId}
|
left join `t_stats` s on r.trace_id=s.trace_id
|
||||||
|
where action = "LAUNCH" and s.member_id = #{memberId}
|
||||||
<if test="endTime!= null">
|
<if test="endTime!= null">
|
||||||
and create_time <= #{endTime}
|
and r.create_time <= #{endTime}
|
||||||
</if>
|
</if>
|
||||||
order by create_time desc
|
order by r.create_time desc
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user