You've already forked FrameTour-BE
Compare commits
16 Commits
c2ce6f91ed
...
8a17392ae5
Author | SHA1 | Date | |
---|---|---|---|
8a17392ae5 | |||
529b52f19c | |||
7a21fb01d0 | |||
f40837cd05 | |||
66334b8963 | |||
206696deb8 | |||
e8488d081f | |||
245387f280 | |||
6d8261ff25 | |||
7d6c87cc74 | |||
5f8c4fd6e6 | |||
53a09c1cab | |||
b0c8643e92 | |||
fae62ab7c2 | |||
5895d9c56f | |||
207fcb6414 |
20
Jenkinsfile
vendored
Normal file
20
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
environment {
|
||||||
|
JAVA_HOME = "/opt/openjdk21.0.7"
|
||||||
|
MAVEN_HOME = "/opt/apache-maven-3.9.9"
|
||||||
|
PATH = "${env.JAVA_HOME}/bin:${env.MAVEN_HOME}/bin:${env.PATH}"
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
bat 'mvn clean package -DskipTests=true'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
archiveArtifacts artifacts: 'target/*.jar', allowEmptyArchive: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
22
pom.xml
22
pom.xml
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>3.1.4</version>
|
<version>3.3.5</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.ycwl</groupId>
|
<groupId>com.ycwl</groupId>
|
||||||
@@ -27,7 +27,18 @@
|
|||||||
<!--跳过单元测试-->
|
<!--跳过单元测试-->
|
||||||
<skipTests>true</skipTests>
|
<skipTests>true</skipTests>
|
||||||
</properties>
|
</properties>
|
||||||
|
<!-- OpenTelemetry -->
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry.instrumentation</groupId>
|
||||||
|
<artifactId>opentelemetry-instrumentation-bom</artifactId>
|
||||||
|
<version>2.16.0</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 添加 jakarta.servlet-api 依赖 -->
|
<!-- 添加 jakarta.servlet-api 依赖 -->
|
||||||
@@ -89,7 +100,7 @@
|
|||||||
<!--mybatis plus和springboot整合-->
|
<!--mybatis plus和springboot整合-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||||
<version>3.5.5</version>
|
<version>3.5.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -198,6 +209,11 @@
|
|||||||
<artifactId>java-sdk</artifactId>
|
<artifactId>java-sdk</artifactId>
|
||||||
<version>4.16.19</version>
|
<version>4.16.19</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.opentelemetry.instrumentation</groupId>
|
||||||
|
<artifactId>opentelemetry-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@@ -53,6 +53,10 @@ public class BrokerBiz {
|
|||||||
expireDay = scenicConfig.getSampleStoreDay();
|
expireDay = scenicConfig.getSampleStoreDay();
|
||||||
}
|
}
|
||||||
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
||||||
|
if (brokerIdList == null || brokerIdList.isEmpty()) {
|
||||||
|
log.info("用户与推客无关,订单ID:{}", orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Long directBrokerId = brokerIdList.getFirst();
|
Long directBrokerId = brokerIdList.getFirst();
|
||||||
List<BrokerRespVO> brokerInfoList = brokerIdList.stream().map(brokerId -> {
|
List<BrokerRespVO> brokerInfoList = brokerIdList.stream().map(brokerId -> {
|
||||||
BrokerRespVO broker = brokerMapper.getById(brokerId);
|
BrokerRespVO broker = brokerMapper.getById(brokerId);
|
||||||
|
13
src/main/java/com/ycwl/basic/constant/JwtRoleConstant.java
Normal file
13
src/main/java/com/ycwl/basic/constant/JwtRoleConstant.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ycwl.basic.constant;
|
||||||
|
|
||||||
|
public enum JwtRoleConstant {
|
||||||
|
MERCHANT("merchant"),
|
||||||
|
ADMIN("admin"),
|
||||||
|
APP_USER("app_user");
|
||||||
|
|
||||||
|
public final String type;
|
||||||
|
|
||||||
|
JwtRoleConstant(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,25 +1,36 @@
|
|||||||
package com.ycwl.basic.controller.mobile.manage;
|
package com.ycwl.basic.controller.mobile.manage;
|
||||||
|
|
||||||
import com.ycwl.basic.annotation.IgnoreToken;
|
import com.ycwl.basic.annotation.IgnoreToken;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginReq;
|
||||||
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
import com.ycwl.basic.model.mobile.scenic.account.ScenicLoginRespVO;
|
||||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||||
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
|
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.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.GetMapping;
|
||||||
|
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;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/12 18:28
|
* @Date:2024/12/12 18:28
|
||||||
@@ -28,9 +39,12 @@ import java.util.List;
|
|||||||
@RequestMapping("/api/mobile/scenicAccount/v1")
|
@RequestMapping("/api/mobile/scenicAccount/v1")
|
||||||
@Api(tags = "景区账号相关接口")
|
@Api(tags = "景区账号相关接口")
|
||||||
public class AppScenicAccountController {
|
public class AppScenicAccountController {
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountService accountService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppScenicService scenicService;
|
private AppScenicService scenicService;
|
||||||
|
@Autowired
|
||||||
|
private ScenicService adminScenicService;
|
||||||
|
|
||||||
@ApiOperation("登录")
|
@ApiOperation("登录")
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@@ -39,13 +53,68 @@ public class AppScenicAccountController {
|
|||||||
return scenicService.login(scenicLoginReq);
|
return scenicService.login(scenicLoginReq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/myScenicList")
|
||||||
|
public ApiResponse<List<ScenicRespVO>> myScenicList() {
|
||||||
|
List<ScenicRespVO> list = Collections.emptyList();
|
||||||
|
if (StringUtils.equals(BaseContextHandler.getRoleId(), MERCHANT.type)) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
list = account.getScenicId().stream().map(id -> {
|
||||||
|
return scenicService.getDetails(id).getData();
|
||||||
|
}).toList();
|
||||||
|
} else {
|
||||||
|
list = adminScenicService.list(new ScenicReqQuery()).getData();
|
||||||
|
}
|
||||||
|
return ApiResponse.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getScenic")
|
@GetMapping("/getScenic")
|
||||||
public ApiResponse<ScenicRespVO> getMyScenic() {
|
public ApiResponse<ScenicRespVO> getMyScenic() {
|
||||||
return scenicService.getMyScenic();
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
return scenicService.getDetails(account.getScenicId().getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{scenicId}")
|
||||||
|
public ApiResponse<ScenicRespVO> getScenic(@PathVariable Long scenicId) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限");
|
||||||
|
}
|
||||||
|
return scenicService.getDetails(scenicId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/devices")
|
@GetMapping("/devices")
|
||||||
public ApiResponse<List<DeviceRespVO>> getDeviceList() {
|
public ApiResponse<List<DeviceRespVO>> getDeviceList() {
|
||||||
return scenicService.getMyDevices();
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
|
return scenicService.getDevices(account.getScenicId().getFirst());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{scenicId}/devices")
|
||||||
|
public ApiResponse<List<DeviceRespVO>> getDeviceList(@PathVariable Long scenicId) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限");
|
||||||
|
}
|
||||||
|
return scenicService.getDevices(scenicId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,11 @@ import com.ycwl.basic.model.pc.order.req.OrderReqQuery;
|
|||||||
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
import com.ycwl.basic.model.pc.order.resp.OrderRespVO;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.service.pc.OrderService;
|
import com.ycwl.basic.service.pc.OrderService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
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.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;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@@ -24,27 +26,57 @@ public class AppScenicOrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicAccountMapper scenicAccountMapper;
|
private ScenicAccountService service;
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
|
@Deprecated
|
||||||
public ApiResponse<List<OrderRespVO>> list(@RequestBody OrderReqQuery query) {
|
public ApiResponse<List<OrderRespVO>> list(@RequestBody OrderReqQuery query) {
|
||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
if (account == null) {
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
query.setScenicId(account.getScenicId());
|
query.setScenicId(account.getScenicId().getFirst());
|
||||||
|
return orderService.list(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{scenicId}/list")
|
||||||
|
public ApiResponse<List<OrderRespVO>> list(@PathVariable Long scenicId, @RequestBody OrderReqQuery query) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限查看该景区订单");
|
||||||
|
}
|
||||||
|
query.setScenicId(scenicId);
|
||||||
return orderService.list(query);
|
return orderService.list(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
|
@Deprecated
|
||||||
public ApiResponse<PageInfo<OrderRespVO>> page(@RequestBody OrderReqQuery query) {
|
public ApiResponse<PageInfo<OrderRespVO>> page(@RequestBody OrderReqQuery query) {
|
||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
if (account == null) {
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
}
|
}
|
||||||
query.setScenicId(account.getScenicId());
|
query.setScenicId(account.getScenicId().getFirst());
|
||||||
|
return orderService.pageQueryDetail(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/{scenicId}/page")
|
||||||
|
public ApiResponse<PageInfo<OrderRespVO>> page(@PathVariable Long scenicId, @RequestBody OrderReqQuery query) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = service.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
if (!account.getScenicId().contains(scenicId)) {
|
||||||
|
return ApiResponse.fail("无权限查看该景区订单");
|
||||||
|
}
|
||||||
|
query.setScenicId(scenicId);
|
||||||
return orderService.pageQueryDetail(query);
|
return orderService.pageQueryDetail(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -40,28 +40,5 @@ public class FaceSampleController {
|
|||||||
public ApiResponse<FaceSampleRespVO> getDetail(@PathVariable("id") Long id) {
|
public ApiResponse<FaceSampleRespVO> getDetail(@PathVariable("id") Long id) {
|
||||||
return FaceSampleService.getById(id);
|
return FaceSampleService.getById(id);
|
||||||
}
|
}
|
||||||
@ApiOperation("添加人脸样本")
|
|
||||||
@PostMapping("/add")
|
|
||||||
public ApiResponse<Integer> add(@RequestBody FaceSampleEntity FaceSample) {
|
|
||||||
return FaceSampleService.add(FaceSample);
|
|
||||||
}
|
|
||||||
@ApiOperation("删除人脸样本")
|
|
||||||
@PostMapping("/deleteById/{id}")
|
|
||||||
public ApiResponse<Integer> deleteById(@PathVariable Long id) {
|
|
||||||
return FaceSampleService.deleteById(id);
|
|
||||||
}
|
|
||||||
@ApiOperation("批量删除人脸样本")
|
|
||||||
@PostMapping("/deleteByIds")
|
|
||||||
public ApiResponse<Integer> deleteByIds(@RequestBody List<Long> ids) {
|
|
||||||
return FaceSampleService.deleteByIds(ids);
|
|
||||||
}
|
|
||||||
@ApiOperation("修改人脸样本信息")
|
|
||||||
@PostMapping("/update")
|
|
||||||
public ApiResponse<Integer> update(@RequestBody FaceSampleEntity FaceSample) {
|
|
||||||
return FaceSampleService.update(FaceSample);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/permission/v1")
|
@RequestMapping("/api/permission/v1")
|
||||||
@Api(tags = "权限管理接口")
|
@Api(tags = "权限管理接口")
|
||||||
@@ -32,9 +34,9 @@ public class PermissionController {
|
|||||||
String userId = BaseContextHandler.getUserId();
|
String userId = BaseContextHandler.getUserId();
|
||||||
PermissionEntity permission = permissionService.getPermissionByUserId(Long.parseLong(userId));
|
PermissionEntity permission = permissionService.getPermissionByUserId(Long.parseLong(userId));
|
||||||
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
||||||
return ApiResponse.success(new PermissionResp(new ArrayList<>()));
|
return ApiResponse.success(new PermissionResp(new ArrayList<>(), new ArrayList<>()));
|
||||||
}
|
}
|
||||||
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ","))));
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ",")), Arrays.asList(StringUtils.split(permission.getMenuString(), ","))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据用户ID查询权限信息")
|
@ApiOperation("根据用户ID查询权限信息")
|
||||||
@@ -42,15 +44,15 @@ public class PermissionController {
|
|||||||
public ApiResponse<PermissionResp> getPermissionByUser(@PathVariable Long userId) {
|
public ApiResponse<PermissionResp> getPermissionByUser(@PathVariable Long userId) {
|
||||||
PermissionEntity permission = permissionService.getPermissionByUserId(userId);
|
PermissionEntity permission = permissionService.getPermissionByUserId(userId);
|
||||||
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
if (permission == null || StringUtils.isEmpty(permission.getPermString())) {
|
||||||
return ApiResponse.success(new PermissionResp(new ArrayList<>()));
|
return ApiResponse.success(new PermissionResp(new ArrayList<>(), new ArrayList<>()));
|
||||||
}
|
}
|
||||||
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ","))));
|
return ApiResponse.success(new PermissionResp(Arrays.asList(StringUtils.split(permission.getPermString(), ",")), Arrays.asList(StringUtils.split(permission.getMenuString(), ","))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("保存或更新权限信息")
|
@ApiOperation("保存或更新权限信息")
|
||||||
@PostMapping("/save/{userId}")
|
@PostMapping("/save/{userId}")
|
||||||
public ApiResponse saveOrUpdate(@PathVariable Long userId, @RequestBody PermissionSaveReq req) {
|
public ApiResponse saveOrUpdate(@PathVariable Long userId, @RequestBody PermissionSaveReq req) {
|
||||||
permissionService.saveOrUpdate(userId, StringUtils.join(req.getPermissions(), ","));
|
permissionService.saveOrUpdate(userId, StringUtils.join(req.getPermissions(), ","), StringUtils.join(req.getMenus(), ","));
|
||||||
return ApiResponse.success(true);
|
return ApiResponse.success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,6 +2,7 @@ package com.ycwl.basic.controller.pc;
|
|||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.mapper.ScenicAccountMapper;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
||||||
import com.ycwl.basic.service.pc.ScenicAccountService;
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
@@ -16,6 +17,8 @@ import java.util.List;
|
|||||||
public class ScenicAccountController {
|
public class ScenicAccountController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicAccountService service;
|
private ScenicAccountService service;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountMapper scenicAccountMapper;
|
||||||
|
|
||||||
// 添加景区账号
|
// 添加景区账号
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@@ -62,6 +65,10 @@ public class ScenicAccountController {
|
|||||||
public ApiResponse<PageInfo<ScenicAccountEntity>> pageQuery(@RequestBody ScenicAccountReqQuery req) {
|
public ApiResponse<PageInfo<ScenicAccountEntity>> pageQuery(@RequestBody ScenicAccountReqQuery req) {
|
||||||
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
PageHelper.startPage(req.getPageNum(), req.getPageSize());
|
||||||
List<ScenicAccountEntity> list = service.pageQuery(req);
|
List<ScenicAccountEntity> list = service.pageQuery(req);
|
||||||
|
list.forEach(entity -> {
|
||||||
|
entity.setPassword("");
|
||||||
|
entity.setScenicId(scenicAccountMapper.getAccountRelations(entity.getId()));
|
||||||
|
});
|
||||||
PageInfo<ScenicAccountEntity> pageInfo = new PageInfo<>(list);
|
PageInfo<ScenicAccountEntity> pageInfo = new PageInfo<>(list);
|
||||||
return ApiResponse.success(pageInfo);
|
return ApiResponse.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
@@ -1,12 +1,16 @@
|
|||||||
package com.ycwl.basic.controller.pc;
|
package com.ycwl.basic.controller.pc;
|
||||||
|
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
import com.ycwl.basic.model.mobile.statistic.req.CommonQueryReq;
|
||||||
|
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.ScenicAddOrUpdateReq;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
||||||
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.service.mobile.AppScenicService;
|
||||||
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
import com.ycwl.basic.service.mobile.AppStatisticsService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
import com.ycwl.basic.service.pc.ScenicService;
|
import com.ycwl.basic.service.pc.ScenicService;
|
||||||
import com.ycwl.basic.storage.StorageFactory;
|
import com.ycwl.basic.storage.StorageFactory;
|
||||||
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
import com.ycwl.basic.storage.adapters.IStorageAdapter;
|
||||||
@@ -17,12 +21,16 @@ import com.ycwl.basic.repository.ScenicRepository;
|
|||||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/3 15:20
|
* @Date:2024/12/3 15:20
|
||||||
@@ -34,11 +42,15 @@ public class ScenicController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicService scenicService;
|
private ScenicService scenicService;
|
||||||
|
@Autowired
|
||||||
|
private AppScenicService appScenicService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicRepository scenicRepository;
|
private ScenicRepository scenicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AppStatisticsService appStatisticsService;
|
private AppStatisticsService appStatisticsService;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountService accountService;
|
||||||
|
|
||||||
@ApiOperation("分页查询景区")
|
@ApiOperation("分页查询景区")
|
||||||
@PostMapping("/page")
|
@PostMapping("/page")
|
||||||
@@ -150,4 +162,27 @@ public class ScenicController {
|
|||||||
query.setScenicId(scenicId);
|
query.setScenicId(scenicId);
|
||||||
return appStatisticsService.userConversionFunnel(query);
|
return appStatisticsService.userConversionFunnel(query);
|
||||||
}
|
}
|
||||||
|
@PostMapping("/{scenicId}/orderChart")
|
||||||
|
public ApiResponse getOrderChart(@PathVariable("scenicId") Long scenicId, @RequestBody CommonQueryReq query) {
|
||||||
|
query.setScenicId(scenicId);
|
||||||
|
return appStatisticsService.orderChart(query);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/myScenicList")
|
||||||
|
public ApiResponse<List<ScenicRespVO>> myScenicList() {
|
||||||
|
List<ScenicRespVO> list = Collections.emptyList();
|
||||||
|
if (StringUtils.equals(BaseContextHandler.getRoleId(), MERCHANT.type)) {
|
||||||
|
String userId = BaseContextHandler.getUserId();
|
||||||
|
ScenicAccountEntity account = accountService.getScenicAccountById(Long.valueOf(userId));
|
||||||
|
if (account == null || account.getScenicId().isEmpty()) {
|
||||||
|
return ApiResponse.fail("景区账号未绑定景区");
|
||||||
|
}
|
||||||
|
list = account.getScenicId().stream().map(id -> {
|
||||||
|
return appScenicService.getDetails(id).getData();
|
||||||
|
}).toList();
|
||||||
|
} else {
|
||||||
|
list = scenicService.list(new ScenicReqQuery()).getData();
|
||||||
|
}
|
||||||
|
return ApiResponse.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -315,7 +315,7 @@ public class ViidController {
|
|||||||
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
||||||
if (addFaceResp != null) {
|
if (addFaceResp != null) {
|
||||||
faceSample.setScore(addFaceResp.getScore());
|
faceSample.setScore(addFaceResp.getScore());
|
||||||
faceSampleMapper.update(faceSample);
|
faceSampleMapper.updateScore(faceSample.getId(), addFaceResp.getScore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (deviceConfig != null && Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
if (deviceConfig != null && Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||||
@@ -377,7 +377,7 @@ public class ViidController {
|
|||||||
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
AddFaceResp addFaceResp = faceBodyAdapter.addFace(scenicId.toString(), faceSample.getId().toString(), url, newFaceSampleId.toString());
|
||||||
if (addFaceResp != null) {
|
if (addFaceResp != null) {
|
||||||
faceSample.setScore(addFaceResp.getScore());
|
faceSample.setScore(addFaceResp.getScore());
|
||||||
faceSampleMapper.update(faceSample);
|
faceSampleMapper.updateScore(faceSample.getId(), addFaceResp.getScore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
if (Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||||
|
@@ -27,4 +27,6 @@ public interface FaceSampleMapper {
|
|||||||
|
|
||||||
FaceSampleEntity getEntity(Long faceSampleId);
|
FaceSampleEntity getEntity(Long faceSampleId);
|
||||||
List<FaceSampleEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
List<FaceSampleEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
||||||
|
|
||||||
|
void updateScore(Long id, Float score);
|
||||||
}
|
}
|
||||||
|
@@ -19,4 +19,11 @@ public interface ScenicAccountMapper {
|
|||||||
ScenicAccountEntity findAccountById(String id);
|
ScenicAccountEntity findAccountById(String id);
|
||||||
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
||||||
|
|
||||||
|
int addAccountScenicRelation(Long accountId, Long scenicId, int isAdmin);
|
||||||
|
|
||||||
|
int deleteRelationByScenicId(Long scenicId);
|
||||||
|
|
||||||
|
List<Long> getAccountRelations(Long accountId);
|
||||||
|
|
||||||
|
int deleteRelationById(Long accountId);
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -97,4 +98,8 @@ public interface StatisticsMapper {
|
|||||||
|
|
||||||
List<AppStatisticsFunnelVO> listStatByScenic(Long scenicId, Date startTime, Date endTime);
|
List<AppStatisticsFunnelVO> listStatByScenic(Long scenicId, Date startTime, Date endTime);
|
||||||
int insertStat(Long scenicId, Date date, AppStatisticsFunnelVO data);
|
int insertStat(Long scenicId, Date date, AppStatisticsFunnelVO data);
|
||||||
|
|
||||||
|
List<HashMap<String, String>> orderChartByDate(CommonQueryReq query);
|
||||||
|
|
||||||
|
List<HashMap<String, String>> orderChartByHour(CommonQueryReq query);
|
||||||
}
|
}
|
||||||
|
@@ -44,11 +44,6 @@ public class JwtInfo implements Serializable {
|
|||||||
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
|
||||||
* 景区id
|
|
||||||
*/
|
|
||||||
private Long scenicId;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成 token 的时间
|
* 生成 token 的时间
|
||||||
|
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/13 9:44
|
* @Date:2024/12/13 9:44
|
||||||
@@ -13,7 +15,7 @@ import lombok.Data;
|
|||||||
public class ScenicLoginRespVO {
|
public class ScenicLoginRespVO {
|
||||||
private Long id;
|
private Long id;
|
||||||
@ApiModelProperty("景区id")
|
@ApiModelProperty("景区id")
|
||||||
private Long scenicId;
|
private List<Long> scenicId;
|
||||||
@ApiModelProperty("是否是超级管理员")
|
@ApiModelProperty("是否是超级管理员")
|
||||||
private Integer isSuper;
|
private Integer isSuper;
|
||||||
@ApiModelProperty("账号名称")
|
@ApiModelProperty("账号名称")
|
||||||
|
@@ -33,16 +33,6 @@ public class OrderReqQuery extends BaseQueryParameterReq {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("微信openId")
|
@ApiModelProperty("微信openId")
|
||||||
private Long openId;
|
private Long openId;
|
||||||
/**
|
|
||||||
* 价格
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("价格")
|
|
||||||
private BigDecimal price;
|
|
||||||
/**
|
|
||||||
* 实际支付价格
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("实际支付价格")
|
|
||||||
private BigDecimal payPrice;
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@@ -20,10 +20,12 @@ public class PermissionEntity implements Serializable {
|
|||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@TableField("user_id")
|
@TableField("user_id")
|
||||||
private Long userId; // 确保字段映射
|
private Long userId;
|
||||||
|
|
||||||
@TableField("perm_str")
|
@TableField("perm_str")
|
||||||
private String permString;
|
private String permString;
|
||||||
|
@TableField("menu_str")
|
||||||
|
private String menuString;
|
||||||
|
|
||||||
@TableField("create_time")
|
@TableField("create_time")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
@@ -7,4 +7,5 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class PermissionSaveReq {
|
public class PermissionSaveReq {
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
private List<String> menus;
|
||||||
}
|
}
|
@@ -9,4 +9,5 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PermissionResp {
|
public class PermissionResp {
|
||||||
private List<String> permissions;
|
private List<String> permissions;
|
||||||
|
private List<String> menus;
|
||||||
}
|
}
|
||||||
|
@@ -7,4 +7,5 @@ public class PriceConfigListReq {
|
|||||||
private Long scenicId;
|
private Long scenicId;
|
||||||
private Integer type;
|
private Integer type;
|
||||||
private Long goodsId;
|
private Long goodsId;
|
||||||
|
private Integer status;
|
||||||
}
|
}
|
@@ -4,12 +4,13 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName("scenic_account")
|
@TableName("scenic_account")
|
||||||
public class ScenicAccountEntity {
|
public class ScenicAccountEntity {
|
||||||
private Long id;
|
private Long id;
|
||||||
private Long scenicId;
|
private List<Long> scenicId;
|
||||||
private Integer isSuper;
|
private Integer isSuper;
|
||||||
private String name;
|
private String name;
|
||||||
private String phone;
|
private String phone;
|
||||||
|
@@ -3,6 +3,7 @@ package com.ycwl.basic.model.task.req;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -15,4 +16,5 @@ public class ClientStatusReqVo {
|
|||||||
private BigDecimal memory_total;
|
private BigDecimal memory_total;
|
||||||
private BigDecimal memory_available;
|
private BigDecimal memory_available;
|
||||||
private List<String> support_feature;
|
private List<String> support_feature;
|
||||||
|
private Date updateAt;
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,75 @@
|
|||||||
|
package com.ycwl.basic.repository;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ycwl.basic.mapper.RenderWorkerMapper;
|
||||||
|
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
||||||
|
import com.ycwl.basic.model.task.req.ClientStatusReqVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class RenderWorkerRepository {
|
||||||
|
@Autowired
|
||||||
|
private RedisTemplate<String, String> redisTemplate;
|
||||||
|
public static final String RENDER_WORKER_CACHE_KEY = "render_worker:%s";
|
||||||
|
public static final String RENDER_WORKER_STATUS_CACHE_KEY = "render_worker:host_status:%s";
|
||||||
|
@Autowired
|
||||||
|
private RenderWorkerMapper mapper;
|
||||||
|
|
||||||
|
public RenderWorkerEntity getWorkerByAccessKey(String accessKey) {
|
||||||
|
String key = String.format(RENDER_WORKER_CACHE_KEY, accessKey);
|
||||||
|
if (redisTemplate.hasKey(key)) {
|
||||||
|
return JSONObject.parseObject(redisTemplate.opsForValue().get(key), RenderWorkerEntity.class);
|
||||||
|
}
|
||||||
|
RenderWorkerEntity renderWorker = mapper.findByAccessKey(accessKey);
|
||||||
|
if (renderWorker != null) {
|
||||||
|
redisTemplate.opsForValue().set(key, JSONObject.toJSONString(renderWorker), 1, TimeUnit.HOURS);
|
||||||
|
redisTemplate.opsForValue().set(String.format(RENDER_WORKER_CACHE_KEY, renderWorker.getId()), JSONObject.toJSONString(renderWorker), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
return renderWorker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RenderWorkerEntity getWorker(Long id) {
|
||||||
|
String key = String.format(RENDER_WORKER_CACHE_KEY, id);
|
||||||
|
if (redisTemplate.hasKey(key)) {
|
||||||
|
return JSONObject.parseObject(redisTemplate.opsForValue().get(key), RenderWorkerEntity.class);
|
||||||
|
}
|
||||||
|
RenderWorkerEntity renderWorker = mapper.getById(id);
|
||||||
|
if (renderWorker != null) {
|
||||||
|
redisTemplate.opsForValue().set(key, JSONObject.toJSONString(renderWorker), 1, TimeUnit.HOURS);
|
||||||
|
redisTemplate.opsForValue().set(String.format(RENDER_WORKER_CACHE_KEY, renderWorker.getAccessKey()), JSONObject.toJSONString(renderWorker), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
return renderWorker;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkerHostStatus(Long id, ClientStatusReqVo status) {
|
||||||
|
String key = String.format(RENDER_WORKER_STATUS_CACHE_KEY, id);
|
||||||
|
if (status == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
status.setUpdateAt(new Date());
|
||||||
|
redisTemplate.opsForValue().set(key, JSONObject.toJSONString(status), 1, TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientStatusReqVo getWorkerHostStatus(Long id) {
|
||||||
|
String key = String.format(RENDER_WORKER_STATUS_CACHE_KEY, id);
|
||||||
|
if (redisTemplate.hasKey(key)) {
|
||||||
|
String status = redisTemplate.opsForValue().get(key);
|
||||||
|
return JSONObject.parseObject(status, ClientStatusReqVo.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearCache(Long id) {
|
||||||
|
RenderWorkerEntity worker = getWorker(id);
|
||||||
|
redisTemplate.delete(String.format(RENDER_WORKER_CACHE_KEY, id));
|
||||||
|
if (worker != null) {
|
||||||
|
redisTemplate.delete(String.format(RENDER_WORKER_CACHE_KEY, worker.getAccessKey()));
|
||||||
|
}
|
||||||
|
redisTemplate.delete(String.format(RENDER_WORKER_STATUS_CACHE_KEY, id));
|
||||||
|
}
|
||||||
|
}
|
@@ -26,9 +26,7 @@ public interface AppScenicService {
|
|||||||
|
|
||||||
ApiResponse<ScenicLoginRespVO> login(ScenicLoginReq scenicLoginReq) throws Exception;
|
ApiResponse<ScenicLoginRespVO> login(ScenicLoginReq scenicLoginReq) throws Exception;
|
||||||
|
|
||||||
ApiResponse<ScenicRespVO> getMyScenic();
|
|
||||||
|
|
||||||
ApiResponse<List<DeviceRespVO>> getMyDevices();
|
|
||||||
|
|
||||||
List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO);
|
List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO);
|
||||||
|
|
||||||
|
ApiResponse<List<DeviceRespVO>> getDevices(Long scenicId);
|
||||||
}
|
}
|
||||||
|
@@ -23,4 +23,6 @@ public interface AppStatisticsService {
|
|||||||
ApiResponse<AppStatisticsFunnelVO> userConversionFunnel(CommonQueryReq query);
|
ApiResponse<AppStatisticsFunnelVO> userConversionFunnel(CommonQueryReq query);
|
||||||
|
|
||||||
ApiResponse<String> addStatistics(StatisticsRecordAddReq req);
|
ApiResponse<String> addStatistics(StatisticsRecordAddReq req);
|
||||||
|
|
||||||
|
ApiResponse orderChart(CommonQueryReq query);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@ package com.ycwl.basic.service.mobile.impl;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.ycwl.basic.constant.BaseContextHandler;
|
import com.ycwl.basic.constant.BaseContextHandler;
|
||||||
import com.ycwl.basic.constant.NumberConstant;
|
import com.ycwl.basic.constant.NumberConstant;
|
||||||
import com.ycwl.basic.enums.BizCodeEnum;
|
import com.ycwl.basic.enums.BizCodeEnum;
|
||||||
@@ -13,7 +12,6 @@ import com.ycwl.basic.model.jwt.JwtInfo;
|
|||||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoUpdateDTO;
|
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoUpdateDTO;
|
||||||
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
||||||
import com.ycwl.basic.model.pc.member.req.MemberReqQuery;
|
|
||||||
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.repository.ScenicRepository;
|
import com.ycwl.basic.repository.ScenicRepository;
|
||||||
@@ -88,13 +86,9 @@ public class AppMemberServiceImpl implements AppMemberService {
|
|||||||
throw new AppException(BizCodeEnum.SERVER_UNKONWN_ERROR, "未获取到当前用户openId");
|
throw new AppException(BizCodeEnum.SERVER_UNKONWN_ERROR, "未获取到当前用户openId");
|
||||||
}
|
}
|
||||||
|
|
||||||
MemberRespVO memberRespVO = new MemberRespVO();
|
|
||||||
JwtInfo jwtInfo = new JwtInfo();
|
JwtInfo jwtInfo = new JwtInfo();
|
||||||
// 根据返回的openId,判断用户是否是新用户,是的话,将用户信息存到数据库;
|
MemberRespVO memberRespVO = memberMapper.getByOpenId(openId.toString());
|
||||||
MemberReqQuery memberReqQuery = new MemberReqQuery();
|
if (memberRespVO == null) {
|
||||||
memberReqQuery.setOpenId(openId.toString());
|
|
||||||
List<MemberRespVO> list = memberMapper.list(memberReqQuery);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
MemberEntity memberEntity = new MemberEntity();
|
MemberEntity memberEntity = new MemberEntity();
|
||||||
memberEntity.setId(SnowFlakeUtil.getLongId());
|
memberEntity.setId(SnowFlakeUtil.getLongId());
|
||||||
memberEntity.setScenicId(scenicId);
|
memberEntity.setScenicId(scenicId);
|
||||||
@@ -107,6 +101,7 @@ public class AppMemberServiceImpl implements AppMemberService {
|
|||||||
memberEntity.setProvince(userInfoDTO.getProvince());
|
memberEntity.setProvince(userInfoDTO.getProvince());
|
||||||
memberEntity.setCity(userInfoDTO.getCity());
|
memberEntity.setCity(userInfoDTO.getCity());
|
||||||
memberMapper.add(memberEntity);
|
memberMapper.add(memberEntity);
|
||||||
|
memberRespVO = new MemberRespVO();
|
||||||
memberRespVO.setId(memberEntity.getId());
|
memberRespVO.setId(memberEntity.getId());
|
||||||
memberRespVO.setOpenId(memberEntity.getOpenId());
|
memberRespVO.setOpenId(memberEntity.getOpenId());
|
||||||
memberRespVO.setNickname(memberEntity.getNickname());
|
memberRespVO.setNickname(memberEntity.getNickname());
|
||||||
@@ -117,18 +112,6 @@ public class AppMemberServiceImpl implements AppMemberService {
|
|||||||
memberRespVO.setProvince(memberEntity.getProvince());
|
memberRespVO.setProvince(memberEntity.getProvince());
|
||||||
memberRespVO.setCity(memberEntity.getCity());
|
memberRespVO.setCity(memberEntity.getCity());
|
||||||
memberRespVO.setScenicId(memberEntity.getScenicId());
|
memberRespVO.setScenicId(memberEntity.getScenicId());
|
||||||
} else {
|
|
||||||
MemberRespVO temp = list.getFirst();
|
|
||||||
memberRespVO.setId(temp.getId());
|
|
||||||
memberRespVO.setOpenId(temp.getOpenId());
|
|
||||||
memberRespVO.setNickname(temp.getNickname());
|
|
||||||
memberRespVO.setAvatarUrl(temp.getAvatarUrl());
|
|
||||||
memberRespVO.setAgreement(1);
|
|
||||||
memberRespVO.setPhone(temp.getPhone());
|
|
||||||
memberRespVO.setCountry(temp.getCountry());
|
|
||||||
memberRespVO.setProvince(temp.getProvince());
|
|
||||||
memberRespVO.setCity(temp.getCity());
|
|
||||||
memberRespVO.setScenicId(temp.getScenicId());
|
|
||||||
}
|
}
|
||||||
jwtInfo.setUserId(memberRespVO.getId());
|
jwtInfo.setUserId(memberRespVO.getId());
|
||||||
jwtInfo.setName(memberRespVO.getNickname());
|
jwtInfo.setName(memberRespVO.getNickname());
|
||||||
|
@@ -16,6 +16,7 @@ import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
|||||||
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.service.mobile.AppScenicService;
|
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||||
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
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;
|
||||||
@@ -25,6 +26,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.ycwl.basic.constant.JwtRoleConstant.MERCHANT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:longbinbin
|
* @Author:longbinbin
|
||||||
* @Date:2024/12/6 10:23
|
* @Date:2024/12/6 10:23
|
||||||
@@ -41,6 +44,8 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
private ScenicAccountMapper scenicAccountMapper;
|
private ScenicAccountMapper scenicAccountMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JwtTokenUtil jwtTokenUtil;
|
private JwtTokenUtil jwtTokenUtil;
|
||||||
|
@Autowired
|
||||||
|
private ScenicAccountService scenicAccountService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
||||||
@@ -67,8 +72,7 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<ScenicLoginRespVO> login(ScenicLoginReq scenicLoginReq) throws Exception {
|
public ApiResponse<ScenicLoginRespVO> login(ScenicLoginReq scenicLoginReq) throws Exception {
|
||||||
|
ScenicAccountEntity scenicAccount = scenicAccountService.getScenicAccountByAccount(scenicLoginReq.getAccount());
|
||||||
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicLoginReq.getAccount());
|
|
||||||
if (scenicAccount == null) {
|
if (scenicAccount == null) {
|
||||||
return ApiResponse.fail("账号不存在");
|
return ApiResponse.fail("账号不存在");
|
||||||
}
|
}
|
||||||
@@ -83,7 +87,7 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
jwtInfo.setName(scenicAccount.getName());
|
jwtInfo.setName(scenicAccount.getName());
|
||||||
jwtInfo.setAccount(scenicAccount.getAccount());
|
jwtInfo.setAccount(scenicAccount.getAccount());
|
||||||
jwtInfo.setUserId(scenicAccount.getId());
|
jwtInfo.setUserId(scenicAccount.getId());
|
||||||
jwtInfo.setScenicId(scenicAccount.getScenicId());
|
jwtInfo.setRoleId(MERCHANT.type);
|
||||||
String token = jwtTokenUtil.generateToken(jwtInfo);
|
String token = jwtTokenUtil.generateToken(jwtInfo);
|
||||||
|
|
||||||
ScenicLoginRespVO scenicLoginRespVO = new ScenicLoginRespVO();
|
ScenicLoginRespVO scenicLoginRespVO = new ScenicLoginRespVO();
|
||||||
@@ -92,30 +96,15 @@ public class AppScenicServiceImpl implements AppScenicService {
|
|||||||
return ApiResponse.success(scenicLoginRespVO);
|
return ApiResponse.success(scenicLoginRespVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResponse<ScenicRespVO> getMyScenic() {
|
|
||||||
String userId = BaseContextHandler.getUserId();
|
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
|
||||||
if (account == null) {
|
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
|
||||||
}
|
|
||||||
return getDetails(account.getScenicId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResponse<List<DeviceRespVO>> getMyDevices() {
|
|
||||||
String userId = BaseContextHandler.getUserId();
|
|
||||||
ScenicAccountEntity account = scenicAccountMapper.findAccountById(userId);
|
|
||||||
if (account == null) {
|
|
||||||
return ApiResponse.fail("用户未绑定景区");
|
|
||||||
}
|
|
||||||
List<DeviceRespVO> deviceRespVOList = deviceMapper.listByScenicIdWithWVP(account.getScenicId());
|
|
||||||
return ApiResponse.success(deviceRespVOList);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO) {
|
public List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO) {
|
||||||
List<ScenicAppVO> scenicAppVOS = scenicMapper.scenicListByLnLa(scenicIndexVO);
|
List<ScenicAppVO> scenicAppVOS = scenicMapper.scenicListByLnLa(scenicIndexVO);
|
||||||
return scenicAppVOS.stream().filter(scenic -> scenic.getDistance().compareTo(scenic.getRadius().multiply(BigDecimal.valueOf(1_000L))) < 0).toList();
|
return scenicAppVOS.stream().filter(scenic -> scenic.getDistance().compareTo(scenic.getRadius().multiply(BigDecimal.valueOf(1_000L))) < 0).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse<List<DeviceRespVO>> getDevices(Long scenicId) {
|
||||||
|
List<DeviceRespVO> deviceRespVOList = deviceMapper.listByScenicIdWithWVP(scenicId);
|
||||||
|
return ApiResponse.success(deviceRespVOList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +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.DateField;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -25,6 +26,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -313,6 +315,27 @@ public class AppStatisticsServiceImpl implements AppStatisticsService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResponse orderChart(CommonQueryReq query) {
|
||||||
|
if(query.getEndTime()==null && query.getStartTime()==null){
|
||||||
|
// 没有传时间,则代表用户没有自定义查询时间,使用standard来判断查询时间范围
|
||||||
|
Integer standard = query.getStandard();
|
||||||
|
if(standard==null){
|
||||||
|
query.setStandard(0);
|
||||||
|
}
|
||||||
|
//获取当前周期的具体时间范围
|
||||||
|
standardToNewSpecificTime(query);
|
||||||
|
}
|
||||||
|
if (DateUtil.between(query.getStartTime(), query.getEndTime(), DateUnit.DAY) <= 2) {
|
||||||
|
// 如果是同一天
|
||||||
|
List<HashMap<String, String>> hashMaps = statisticsMapper.orderChartByHour(query);
|
||||||
|
return ApiResponse.success(hashMaps);
|
||||||
|
} else {
|
||||||
|
List<HashMap<String, String>> hashMaps = statisticsMapper.orderChartByDate(query);
|
||||||
|
return ApiResponse.success(hashMaps);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param num1
|
* @param num1
|
||||||
|
@@ -444,6 +444,7 @@ public class GoodsServiceImpl implements GoodsService {
|
|||||||
if (taskById == null) {
|
if (taskById == null) {
|
||||||
response.setStatus(1);
|
response.setStatus(1);
|
||||||
} else {
|
} else {
|
||||||
|
videoTaskRepository.clearTaskCache(lastVideo.getTaskId());
|
||||||
if (taskById.getStatus() == 1) {
|
if (taskById.getStatus() == 1) {
|
||||||
response.setStatus(1);
|
response.setStatus(1);
|
||||||
response.setVideoId(lastVideo.getVideoId());
|
response.setVideoId(lastVideo.getVideoId());
|
||||||
|
@@ -96,7 +96,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|||||||
log.info("[微信支付]parse = {}", callbackResponse);
|
log.info("[微信支付]parse = {}", callbackResponse);
|
||||||
|
|
||||||
// 更新订单信息
|
// 更新订单信息
|
||||||
new Thread(() -> {
|
Thread.ofVirtual().start(() -> {
|
||||||
long orderId = Long.parseLong(callbackResponse.getOrderNo());
|
long orderId = Long.parseLong(callbackResponse.getOrderNo());
|
||||||
if (callbackResponse.isPay()) {
|
if (callbackResponse.isPay()) {
|
||||||
orderBiz.paidOrder(orderId);
|
orderBiz.paidOrder(orderId);
|
||||||
@@ -105,7 +105,7 @@ public class WxPayServiceImpl implements WxPayService {
|
|||||||
} else if (callbackResponse.isRefund()) {
|
} else if (callbackResponse.isRefund()) {
|
||||||
orderBiz.refundOrder(orderId);
|
orderBiz.refundOrder(orderId);
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new AppException(BizCodeEnum.ADVANCE_PAYMENT_CALLBACK_FAILED, e.toString());
|
throw new AppException(BizCodeEnum.ADVANCE_PAYMENT_CALLBACK_FAILED, e.toString());
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,5 @@ public interface FaceSampleService {
|
|||||||
ApiResponse<List<FaceSampleRespVO>> list(FaceSampleReqQuery faceSampleReqQuery);
|
ApiResponse<List<FaceSampleRespVO>> list(FaceSampleReqQuery faceSampleReqQuery);
|
||||||
ApiResponse<FaceSampleRespVO> getById(Long id);
|
ApiResponse<FaceSampleRespVO> getById(Long id);
|
||||||
ApiResponse<Integer> add(FaceSampleEntity face);
|
ApiResponse<Integer> add(FaceSampleEntity face);
|
||||||
ApiResponse<Integer> deleteById(Long id);
|
|
||||||
ApiResponse<Integer> deleteByIds(List<Long> ids);
|
|
||||||
ApiResponse<Integer> update(FaceSampleEntity face);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -6,5 +6,5 @@ public interface PermissionService {
|
|||||||
// 新增权限查询接口
|
// 新增权限查询接口
|
||||||
PermissionEntity getPermissionByUserId(Long userId);
|
PermissionEntity getPermissionByUserId(Long userId);
|
||||||
|
|
||||||
boolean saveOrUpdate(Long userId, String permStr);
|
boolean saveOrUpdate(Long userId, String permStr, String menuStr);
|
||||||
}
|
}
|
@@ -16,4 +16,6 @@ public interface ScenicAccountService {
|
|||||||
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
List<ScenicAccountEntity> pageQuery(ScenicAccountReqQuery req);
|
||||||
|
|
||||||
int updateStatus(Long id);
|
int updateStatus(Long id);
|
||||||
|
|
||||||
|
ScenicAccountEntity getScenicAccountByAccount(String account);
|
||||||
}
|
}
|
@@ -130,7 +130,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LoginRespVO loginRespVO = new LoginRespVO();
|
LoginRespVO loginRespVO = new LoginRespVO();
|
||||||
String token = jwtTokenUtil.generateToken(new JwtInfo(login.getStaffName(), login.getStaffId(), roleId, login.getAccount(), login.getAccount(), null,null));
|
String token = jwtTokenUtil.generateToken(new JwtInfo(login.getStaffName(), login.getStaffId(), roleId, login.getAccount(), login.getAccount(), null));
|
||||||
loginRespVO.setToken(token);
|
loginRespVO.setToken(token);
|
||||||
loginRespVO.setName(login.getStaffName());
|
loginRespVO.setName(login.getStaffName());
|
||||||
loginRespVO.setTypeName(login.getTypeName());
|
loginRespVO.setTypeName(login.getTypeName());
|
||||||
|
@@ -50,31 +50,4 @@ public class FaceSampleServiceImpl implements FaceSampleService {
|
|||||||
}
|
}
|
||||||
return ApiResponse.success(i);
|
return ApiResponse.success(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResponse<Integer> deleteById(Long id) {
|
|
||||||
int i = faceSampleMapper.deleteById(id);
|
|
||||||
if (i == 0) {
|
|
||||||
return ApiResponse.fail("删除失败");
|
|
||||||
}
|
|
||||||
return ApiResponse.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResponse<Integer> deleteByIds(List<Long> ids) {
|
|
||||||
int i = faceSampleMapper.deleteByIds(ids);
|
|
||||||
if (i == 0) {
|
|
||||||
return ApiResponse.fail("删除失败");
|
|
||||||
}
|
|
||||||
return ApiResponse.success(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ApiResponse<Integer> update(FaceSampleEntity faceSample) {
|
|
||||||
int i = faceSampleMapper.update(faceSample);
|
|
||||||
if (i == 0) {
|
|
||||||
return ApiResponse.fail("修改失败");
|
|
||||||
}
|
|
||||||
return ApiResponse.success(i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -314,12 +314,12 @@ public class FaceServiceImpl implements FaceService {
|
|||||||
FaceEntity face = faceRepository.getFace(faceId);
|
FaceEntity face = faceRepository.getFace(faceId);
|
||||||
faceMapper.deleteById(faceId);
|
faceMapper.deleteById(faceId);
|
||||||
faceRepository.clearFaceCache(faceId);
|
faceRepository.clearFaceCache(faceId);
|
||||||
new Thread(() -> {
|
Thread.ofVirtual().start(() -> {
|
||||||
sourceMapper.deleteNotBuyFaceRelation(face.getMemberId(), faceId);
|
sourceMapper.deleteNotBuyFaceRelation(face.getMemberId(), faceId);
|
||||||
videoMapper.deleteNotBuyFaceRelations(face.getMemberId(), faceId);
|
videoMapper.deleteNotBuyFaceRelations(face.getMemberId(), faceId);
|
||||||
IFaceBodyAdapter adapter = scenicService.getScenicFaceBodyAdapter(face.getScenicId());
|
IFaceBodyAdapter adapter = scenicService.getScenicFaceBodyAdapter(face.getScenicId());
|
||||||
adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId().toString(), faceId.toString());
|
adapter.deleteFace(USER_FACE_DB_NAME+face.getScenicId().toString(), faceId.toString());
|
||||||
}).start();
|
});
|
||||||
return ApiResponse.success("删除成功");
|
return ApiResponse.success("删除成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,10 +17,11 @@ public class PermissionServiceImpl implements PermissionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean saveOrUpdate(Long userId, String permStr) {
|
public boolean saveOrUpdate(Long userId, String permStr, String menuStr) {
|
||||||
PermissionEntity entity = new PermissionEntity();
|
PermissionEntity entity = new PermissionEntity();
|
||||||
entity.setUserId(userId);
|
entity.setUserId(userId);
|
||||||
entity.setPermString(permStr);
|
entity.setPermString(permStr);
|
||||||
|
entity.setMenuString(menuStr);
|
||||||
if (permissionMapper.selectByUserId(userId) == null) {
|
if (permissionMapper.selectByUserId(userId) == null) {
|
||||||
permissionMapper.insertPermission(entity);
|
permissionMapper.insertPermission(entity);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -5,6 +5,8 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import com.ycwl.basic.mapper.RenderWorkerMapper;
|
import com.ycwl.basic.mapper.RenderWorkerMapper;
|
||||||
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
import com.ycwl.basic.model.pc.renderWorker.entity.RenderWorkerEntity;
|
||||||
import com.ycwl.basic.model.pc.renderWorker.req.RenderWorkerReqQuery;
|
import com.ycwl.basic.model.pc.renderWorker.req.RenderWorkerReqQuery;
|
||||||
|
import com.ycwl.basic.model.task.req.ClientStatusReqVo;
|
||||||
|
import com.ycwl.basic.repository.RenderWorkerRepository;
|
||||||
import com.ycwl.basic.service.pc.RenderWorkerService;
|
import com.ycwl.basic.service.pc.RenderWorkerService;
|
||||||
import com.ycwl.basic.utils.ApiResponse;
|
import com.ycwl.basic.utils.ApiResponse;
|
||||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||||
@@ -12,6 +14,8 @@ 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 java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,23 +27,76 @@ public class RenderWorkerServiceImpl implements RenderWorkerService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RenderWorkerMapper renderWorkerMapper;
|
private RenderWorkerMapper renderWorkerMapper;
|
||||||
|
@Autowired
|
||||||
|
private RenderWorkerRepository renderWorkerRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<PageInfo<RenderWorkerEntity>> pageQuery(RenderWorkerReqQuery renderWorkerReqQuery) {
|
public ApiResponse<PageInfo<RenderWorkerEntity>> pageQuery(RenderWorkerReqQuery renderWorkerReqQuery) {
|
||||||
PageHelper.startPage(renderWorkerReqQuery.getPageNum(), renderWorkerReqQuery.getPageSize());
|
PageHelper.startPage(renderWorkerReqQuery.getPageNum(), renderWorkerReqQuery.getPageSize());
|
||||||
List<RenderWorkerEntity> list = renderWorkerMapper.list(renderWorkerReqQuery);
|
List<RenderWorkerEntity> list = renderWorkerMapper.list(renderWorkerReqQuery);
|
||||||
|
list.forEach(worker -> {
|
||||||
|
ClientStatusReqVo clientStatus = renderWorkerRepository.getWorkerHostStatus(worker.getId());
|
||||||
|
if (clientStatus == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
worker.setCpuCount(clientStatus.getCpu_count());
|
||||||
|
worker.setCpuUsage(clientStatus.getCpu_usage());
|
||||||
|
// 上报的是字节,存储的是兆
|
||||||
|
worker.setMemoryAvailable(clientStatus.getMemory_available().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
worker.setMemoryTotal(clientStatus.getMemory_total().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
|
||||||
|
worker.setPlatform(clientStatus.getPlatform());
|
||||||
|
worker.setRuntimeVersion(clientStatus.getRuntime_version());
|
||||||
|
worker.setSupportFeature(String.join(",", clientStatus.getSupport_feature()));
|
||||||
|
worker.setVersion(clientStatus.getVersion());
|
||||||
|
worker.setUpdateAt(clientStatus.getUpdateAt());
|
||||||
|
});
|
||||||
PageInfo<RenderWorkerEntity> pageInfo = new PageInfo<>(list);
|
PageInfo<RenderWorkerEntity> pageInfo = new PageInfo<>(list);
|
||||||
return ApiResponse.success(pageInfo);
|
return ApiResponse.success(pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<List<RenderWorkerEntity>> list(RenderWorkerReqQuery renderWorkerReqQuery) {
|
public ApiResponse<List<RenderWorkerEntity>> list(RenderWorkerReqQuery renderWorkerReqQuery) {
|
||||||
return ApiResponse.success(renderWorkerMapper.list(renderWorkerReqQuery));
|
List<RenderWorkerEntity> list = renderWorkerMapper.list(renderWorkerReqQuery);
|
||||||
|
list.forEach(worker -> {
|
||||||
|
ClientStatusReqVo clientStatus = renderWorkerRepository.getWorkerHostStatus(worker.getId());
|
||||||
|
if (clientStatus == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
worker.setCpuCount(clientStatus.getCpu_count());
|
||||||
|
worker.setCpuUsage(clientStatus.getCpu_usage());
|
||||||
|
// 上报的是字节,存储的是兆
|
||||||
|
worker.setMemoryAvailable(clientStatus.getMemory_available().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
worker.setMemoryTotal(clientStatus.getMemory_total().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
|
||||||
|
worker.setPlatform(clientStatus.getPlatform());
|
||||||
|
worker.setRuntimeVersion(clientStatus.getRuntime_version());
|
||||||
|
worker.setSupportFeature(String.join(",", clientStatus.getSupport_feature()));
|
||||||
|
worker.setVersion(clientStatus.getVersion());
|
||||||
|
worker.setUpdateAt(clientStatus.getUpdateAt());
|
||||||
|
});
|
||||||
|
return ApiResponse.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<RenderWorkerEntity> detail(Long id) {
|
public ApiResponse<RenderWorkerEntity> detail(Long id) {
|
||||||
return ApiResponse.success(renderWorkerMapper.getById(id));
|
RenderWorkerEntity worker = renderWorkerMapper.getById(id);
|
||||||
|
|
||||||
|
ClientStatusReqVo clientStatus = renderWorkerRepository.getWorkerHostStatus(worker.getId());
|
||||||
|
if (clientStatus != null) {
|
||||||
|
worker.setCpuCount(clientStatus.getCpu_count());
|
||||||
|
worker.setCpuUsage(clientStatus.getCpu_usage());
|
||||||
|
// 上报的是字节,存储的是兆
|
||||||
|
worker.setMemoryAvailable(clientStatus.getMemory_available().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
worker.setMemoryTotal(clientStatus.getMemory_total().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
||||||
|
|
||||||
|
worker.setPlatform(clientStatus.getPlatform());
|
||||||
|
worker.setRuntimeVersion(clientStatus.getRuntime_version());
|
||||||
|
worker.setSupportFeature(String.join(",", clientStatus.getSupport_feature()));
|
||||||
|
worker.setVersion(clientStatus.getVersion());
|
||||||
|
worker.setUpdateAt(clientStatus.getUpdateAt());
|
||||||
|
}
|
||||||
|
return ApiResponse.success(worker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -59,11 +116,13 @@ public class RenderWorkerServiceImpl implements RenderWorkerService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<Integer> deleteById(Long id) {
|
public ApiResponse<Integer> deleteById(Long id) {
|
||||||
|
renderWorkerRepository.clearCache(id);
|
||||||
return ApiResponse.success(renderWorkerMapper.deleteById(id));
|
return ApiResponse.success(renderWorkerMapper.deleteById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<Integer> update(RenderWorkerEntity renderWorker) {
|
public ApiResponse<Integer> update(RenderWorkerEntity renderWorker) {
|
||||||
|
renderWorkerRepository.clearCache(renderWorker.getId());
|
||||||
int update = renderWorkerMapper.update(renderWorker);
|
int update = renderWorkerMapper.update(renderWorker);
|
||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
return ApiResponse.fail("渲染机修改失败");
|
return ApiResponse.fail("渲染机修改失败");
|
||||||
@@ -74,6 +133,7 @@ public class RenderWorkerServiceImpl implements RenderWorkerService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<Integer> updateStatus(Long id) {
|
public ApiResponse<Integer> updateStatus(Long id) {
|
||||||
|
renderWorkerRepository.clearCache(id);
|
||||||
return ApiResponse.success(renderWorkerMapper.updateStatus(id));
|
return ApiResponse.success(renderWorkerMapper.updateStatus(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.ycwl.basic.service.pc.impl;
|
package com.ycwl.basic.service.pc.impl;
|
||||||
|
|
||||||
|
import com.ycwl.basic.exception.BaseException;
|
||||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
import com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity;
|
||||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
import com.ycwl.basic.model.pc.scenic.req.ScenicAccountReqQuery;
|
||||||
import com.ycwl.basic.service.pc.ScenicAccountService;
|
import com.ycwl.basic.service.pc.ScenicAccountService;
|
||||||
@@ -30,12 +31,23 @@ public class ScenicAccountServiceImpl implements ScenicAccountService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateScenicAccount(ScenicAccountEntity entity) {
|
public int updateScenicAccount(ScenicAccountEntity entity) {
|
||||||
return mapper.update(entity);
|
if (entity.getId() == null) {
|
||||||
|
throw new BaseException("参数错误");
|
||||||
|
}
|
||||||
|
int update = mapper.update(entity);
|
||||||
|
mapper.deleteRelationById(entity.getId());
|
||||||
|
entity.getScenicId().forEach(scenicId -> {
|
||||||
|
mapper.addAccountScenicRelation(entity.getId(), scenicId, entity.getIsSuper());
|
||||||
|
});
|
||||||
|
return update;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ScenicAccountEntity getScenicAccountById(Long id) {
|
public ScenicAccountEntity getScenicAccountById(Long id) {
|
||||||
return mapper.findAccountById(String.valueOf(id));
|
ScenicAccountEntity account = mapper.findAccountById(String.valueOf(id));
|
||||||
|
List<Long> scenicList = mapper.getAccountRelations(id);
|
||||||
|
account.setScenicId(scenicList);
|
||||||
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,4 +65,12 @@ public class ScenicAccountServiceImpl implements ScenicAccountService {
|
|||||||
public int updateStatus(Long id) {
|
public int updateStatus(Long id) {
|
||||||
return mapper.updateStatus(id);
|
return mapper.updateStatus(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScenicAccountEntity getScenicAccountByAccount(String account) {
|
||||||
|
ScenicAccountEntity accountEntity = mapper.getByAccount(account);
|
||||||
|
List<Long> scenicList = mapper.getAccountRelations(accountEntity.getId());
|
||||||
|
accountEntity.setScenicId(scenicList);
|
||||||
|
return accountEntity;
|
||||||
|
}
|
||||||
}
|
}
|
@@ -71,21 +71,20 @@ public class ScenicServiceImpl implements ScenicService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApiResponse<Boolean> add(ScenicAddOrUpdateReq scenicAddReq) {
|
public ApiResponse<Boolean> add(ScenicAddOrUpdateReq scenicAddReq) {
|
||||||
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicAddReq.getAccount());
|
|
||||||
if (scenicAccount != null) {
|
|
||||||
return ApiResponse.fail("账号已存在");
|
|
||||||
}
|
|
||||||
Long scenicId = SnowFlakeUtil.getLongId();
|
Long scenicId = SnowFlakeUtil.getLongId();
|
||||||
scenicAddReq.setId(scenicId);
|
scenicAddReq.setId(scenicId);
|
||||||
int add = scenicMapper.add(scenicAddReq);
|
int add = scenicMapper.add(scenicAddReq);
|
||||||
ScenicAccountEntity account = new ScenicAccountEntity();
|
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicAddReq.getAccount());
|
||||||
account.setId(SnowFlakeUtil.getLongId());
|
if (scenicAccount == null) {
|
||||||
account.setScenicId(scenicId);
|
scenicAccount = new ScenicAccountEntity();
|
||||||
account.setName(scenicAddReq.getName() + "管理员");
|
scenicAccount.setId(SnowFlakeUtil.getLongId());
|
||||||
account.setAccount(scenicAddReq.getAccount());
|
scenicAccount.setName(scenicAddReq.getName() + "管理员");
|
||||||
account.setPassword(scenicAddReq.getPassword());
|
scenicAccount.setAccount(scenicAddReq.getAccount());
|
||||||
account.setIsSuper(1);
|
scenicAccount.setPassword(scenicAddReq.getPassword());
|
||||||
scenicAccountMapper.add(account);
|
scenicAccount.setIsSuper(1);
|
||||||
|
scenicAccountMapper.add(scenicAccount);
|
||||||
|
}
|
||||||
|
scenicAccountMapper.addAccountScenicRelation(scenicAccount.getId(), scenicId, 1);
|
||||||
if (add > 0) {
|
if (add > 0) {
|
||||||
return ApiResponse.success(true);
|
return ApiResponse.success(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -98,12 +97,12 @@ public class ScenicServiceImpl implements ScenicService {
|
|||||||
public ApiResponse<Boolean> deleteById(Long id) {
|
public ApiResponse<Boolean> deleteById(Long id) {
|
||||||
int i = scenicMapper.deleteById(id);
|
int i = scenicMapper.deleteById(id);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
scenicAccountMapper.deleteByScenicId(id);
|
scenicAccountMapper.deleteRelationByScenicId(id);
|
||||||
IFaceBodyAdapter adapter = getScenicFaceBodyAdapter(id);
|
IFaceBodyAdapter adapter = getScenicFaceBodyAdapter(id);
|
||||||
(new Thread(() -> {
|
Thread.ofVirtual().start(() -> {
|
||||||
adapter.deleteFaceDb(id.toString());
|
adapter.deleteFaceDb(id.toString());
|
||||||
adapter.deleteFaceDb(USER_FACE_DB_NAME + id);
|
adapter.deleteFaceDb(USER_FACE_DB_NAME + id);
|
||||||
})).start();
|
});
|
||||||
scenicMapper.deleteConfigByScenicId(id);
|
scenicMapper.deleteConfigByScenicId(id);
|
||||||
scenicRepository.clearCache(id);
|
scenicRepository.clearCache(id);
|
||||||
scenicFaceBodyAdapterMap.remove(id);
|
scenicFaceBodyAdapterMap.remove(id);
|
||||||
@@ -117,6 +116,9 @@ public class ScenicServiceImpl implements ScenicService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiResponse<Boolean> update(ScenicAddOrUpdateReq scenicUpdateReq) {
|
public ApiResponse<Boolean> update(ScenicAddOrUpdateReq scenicUpdateReq) {
|
||||||
|
if (scenicUpdateReq.getId() == null) {
|
||||||
|
return ApiResponse.fail("参数错误");
|
||||||
|
}
|
||||||
if (StringUtils.isNotBlank(scenicUpdateReq.getAccount()) && StringUtils.isNotBlank(scenicUpdateReq.getPassword())) {
|
if (StringUtils.isNotBlank(scenicUpdateReq.getAccount()) && StringUtils.isNotBlank(scenicUpdateReq.getPassword())) {
|
||||||
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicUpdateReq.getAccount());
|
ScenicAccountEntity scenicAccount = scenicAccountMapper.getByAccount(scenicUpdateReq.getAccount());
|
||||||
if (scenicAccount != null) {
|
if (scenicAccount != null) {
|
||||||
@@ -132,13 +134,13 @@ public class ScenicServiceImpl implements ScenicService {
|
|||||||
} else {
|
} else {
|
||||||
account = new ScenicAccountEntity();
|
account = new ScenicAccountEntity();
|
||||||
account.setId(SnowFlakeUtil.getLongId());
|
account.setId(SnowFlakeUtil.getLongId());
|
||||||
account.setScenicId(scenicUpdateReq.getId());
|
|
||||||
account.setName(scenicUpdateReq.getName() + "管理员");
|
account.setName(scenicUpdateReq.getName() + "管理员");
|
||||||
account.setAccount(scenicUpdateReq.getAccount());
|
account.setAccount(scenicUpdateReq.getAccount());
|
||||||
account.setPassword(scenicUpdateReq.getPassword());
|
account.setPassword(scenicUpdateReq.getPassword());
|
||||||
account.setIsSuper(1);
|
account.setIsSuper(1);
|
||||||
scenicAccountMapper.add(account);
|
scenicAccountMapper.add(account);
|
||||||
}
|
}
|
||||||
|
scenicAccountMapper.addAccountScenicRelation(account.getId(), scenicUpdateReq.getId(), 1);
|
||||||
}
|
}
|
||||||
int i = scenicMapper.update(scenicUpdateReq);
|
int i = scenicMapper.update(scenicUpdateReq);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
|
@@ -45,6 +45,7 @@ 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.RenderWorkerRepository;
|
||||||
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;
|
||||||
@@ -81,14 +82,10 @@ import java.util.stream.Collectors;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
public class TaskTaskServiceImpl implements TaskService {
|
public class TaskTaskServiceImpl implements TaskService {
|
||||||
@Autowired
|
|
||||||
private TemplateMapper templateMapper;
|
|
||||||
@Autowired
|
|
||||||
private RenderWorkerMapper renderWorkerMapper;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TaskMapper taskMapper;
|
private TaskMapper taskMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisTemplate<String, String> redisTemplate;
|
private RenderWorkerRepository repository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaceMapper faceMapper;
|
private FaceMapper faceMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -124,13 +121,12 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VideoReUploader videoReUploader;
|
private VideoReUploader videoReUploader;
|
||||||
|
|
||||||
|
|
||||||
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
private RenderWorkerEntity getWorker(@NonNull WorkerAuthReqVo req) {
|
||||||
String accessKey = req.getAccessKey();
|
String accessKey = req.getAccessKey();
|
||||||
if (accessKey == null) {
|
if (accessKey == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return renderWorkerMapper.findByAccessKey(accessKey);
|
return repository.getWorkerByAccessKey(accessKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -144,23 +140,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
worker.setStatus(null);
|
worker.setStatus(null);
|
||||||
// get status
|
// get status
|
||||||
ClientStatusReqVo clientStatus = req.getClientStatus();
|
ClientStatusReqVo clientStatus = req.getClientStatus();
|
||||||
if (clientStatus != null) {
|
repository.setWorkerHostStatus(worker.getId(), clientStatus);
|
||||||
// 临时这么用下
|
|
||||||
worker.setCpuCount(clientStatus.getCpu_count());
|
|
||||||
worker.setCpuUsage(clientStatus.getCpu_usage());
|
|
||||||
// 上报的是字节,存储的是兆
|
|
||||||
worker.setMemoryAvailable(clientStatus.getMemory_available().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
|
||||||
worker.setMemoryTotal(clientStatus.getMemory_total().divide(BigDecimal.valueOf(1024 * 1024), RoundingMode.CEILING));
|
|
||||||
|
|
||||||
worker.setPlatform(clientStatus.getPlatform());
|
|
||||||
worker.setRuntimeVersion(clientStatus.getRuntime_version());
|
|
||||||
worker.setSupportFeature(String.join(",", clientStatus.getSupport_feature()));
|
|
||||||
worker.setVersion(clientStatus.getVersion());
|
|
||||||
|
|
||||||
worker.setUpdateAt(new Date());
|
|
||||||
redisTemplate.opsForValue().set(TaskConstant.TASK_ONLINE_WORKER_KEY_PFX + worker.getId(), JSON.toJSONString(clientStatus), 60, TimeUnit.SECONDS);
|
|
||||||
}
|
|
||||||
renderWorkerMapper.update(worker);
|
|
||||||
TaskSyncRespVo resp = new TaskSyncRespVo();
|
TaskSyncRespVo resp = new TaskSyncRespVo();
|
||||||
// Template
|
// Template
|
||||||
List<TemplateRespVO> updTemplateList;
|
List<TemplateRespVO> updTemplateList;
|
||||||
@@ -630,7 +610,7 @@ public class TaskTaskServiceImpl implements TaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
videoMapper.updateRelationWhenTaskSuccess(taskId, video.getId(), isBuy);
|
||||||
new Thread(() -> sendVideoGeneratedServiceNotification(taskId)).start();
|
Thread.ofVirtual().start(() -> sendVideoGeneratedServiceNotification(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -12,6 +12,7 @@ import com.ycwl.basic.model.pc.scenicDeviceStats.entity.ScenicDeviceStatsEntity;
|
|||||||
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 org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
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;
|
||||||
@@ -21,6 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
|
@Profile("prod")
|
||||||
public class ScenicStatsTask {
|
public class ScenicStatsTask {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ScenicDeviceStatsMapper mapper;
|
private ScenicDeviceStatsMapper mapper;
|
||||||
|
@@ -103,13 +103,13 @@ public class VideoPieceGetter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
log.info("poll task: {}/{}", task, queue.size());
|
log.info("poll task: {}/{}", task, queue.size());
|
||||||
new Thread(() -> {
|
Thread.ofVirtual().start(() -> {
|
||||||
try {
|
try {
|
||||||
runTask(task);
|
runTask(task);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("run task error", e);
|
log.error("run task error", e);
|
||||||
}
|
}
|
||||||
}).start();
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runTask(Task task) {
|
private void runTask(Task task) {
|
||||||
@@ -181,14 +181,11 @@ public class VideoPieceGetter {
|
|||||||
.map(Map.Entry::getKey).forEach(pairDeviceId -> {
|
.map(Map.Entry::getKey).forEach(pairDeviceId -> {
|
||||||
log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId());
|
log.info("找到同景区关联设备:{} -> {}", pairDeviceId, faceSample.getDeviceId());
|
||||||
if (pairDeviceId != null) {
|
if (pairDeviceId != null) {
|
||||||
executor.execute(() -> {
|
|
||||||
doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
doCut(pairDeviceId, faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
executor.execute(() -> {
|
|
||||||
doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
doCut(faceSample.getDeviceId(), faceSample.getId(), faceSample.getCreateAt(), task);
|
||||||
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
currentUnFinPlaceholder.remove(faceSample.getDeviceId().toString());
|
||||||
if (templatePlaceholder != null) {
|
if (templatePlaceholder != null) {
|
||||||
@@ -203,13 +200,13 @@ public class VideoPieceGetter {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
log.info("executor等待被结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
log.info("executor等待被结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
||||||
executor.shutdown();
|
executor.shutdown();
|
||||||
executor.awaitTermination(5, TimeUnit.MINUTES);
|
executor.awaitTermination(5, TimeUnit.MINUTES);
|
||||||
log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
||||||
|
executor.close();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
return;
|
return;
|
||||||
} finally {
|
} finally {
|
||||||
|
@@ -108,6 +108,11 @@ public class VideoTaskGenerator {
|
|||||||
log.info("task callback: 不自动生成");
|
log.info("task callback: 不自动生成");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Thread.sleep(5000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -6,11 +6,13 @@ import io.jsonwebtoken.Claims;
|
|||||||
import io.jsonwebtoken.JwtBuilder;
|
import io.jsonwebtoken.JwtBuilder;
|
||||||
import io.jsonwebtoken.Jwts;
|
import io.jsonwebtoken.Jwts;
|
||||||
import io.jsonwebtoken.SignatureAlgorithm;
|
import io.jsonwebtoken.SignatureAlgorithm;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author yangchen
|
* @author yangchen
|
||||||
@@ -46,19 +48,7 @@ public class JwtAnalysisUtil {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static JwtInfo getInfoFromToken(String token, byte[] pubKey) throws Exception {
|
public static JwtInfo getInfoFromToken(String token, byte[] pubKey) throws Exception {
|
||||||
Claims body = (Claims) RsaKeyUtil.parserToken(token, pubKey).getBody();
|
Claims body = RsaKeyUtil.parserToken(token, pubKey).getBody();
|
||||||
for (Map.Entry<String, Object> stringObjectEntry : body.entrySet()) {
|
|
||||||
Map.Entry<String, Object> entry = stringObjectEntry;
|
|
||||||
if (!"sub".equals(entry.getKey())
|
|
||||||
&& !"userId".equals(entry.getKey())
|
|
||||||
&& !"phone".equals(entry.getKey())
|
|
||||||
&& !"roleId".equals(entry.getKey())
|
|
||||||
&& !"account".equals(entry.getKey())
|
|
||||||
&& !"name".equals(entry.getKey())
|
|
||||||
&& !"roleName".equals(entry.getKey())
|
|
||||||
&& !"scenicId".equals(entry.getKey())
|
|
||||||
&& !"expire".equals(entry.getKey())) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// convert
|
// convert
|
||||||
LocalDateTime expireTime = null;
|
LocalDateTime expireTime = null;
|
||||||
@@ -73,15 +63,13 @@ public class JwtAnalysisUtil {
|
|||||||
}
|
}
|
||||||
Long userId = null;
|
Long userId = null;
|
||||||
if (body.get("userId")!=null) {
|
if (body.get("userId")!=null) {
|
||||||
String strUserId = StringUtil.a(body.get("userId"));
|
userId= Long.parseLong(Objects.requireNonNullElse(body.get("userId"), "").toString());
|
||||||
userId= Long.parseLong(strUserId);
|
|
||||||
}
|
}
|
||||||
return new JwtInfo(StringUtil.a(body.get("name")),
|
return new JwtInfo(Objects.requireNonNullElse(body.get("name"), "").toString(),
|
||||||
userId,
|
userId,
|
||||||
StringUtil.a(body.get("roleId")),
|
Objects.requireNonNullElse(body.get("roleId"), "").toString(),
|
||||||
body.getSubject(),
|
body.getSubject(),
|
||||||
StringUtil.a(body.get("phone")),
|
Objects.requireNonNullElse(body.get("phone"), "").toString(),
|
||||||
body.get("scenicId") == null ? null : Long.valueOf(body.get("scenicId").toString()),
|
|
||||||
expireTime);
|
expireTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +0,0 @@
|
|||||||
package com.ycwl.basic.utils;
|
|
||||||
|
|
||||||
public final class StringUtil {
|
|
||||||
|
|
||||||
public StringUtil() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String a(Object obj) {
|
|
||||||
return obj == null ? "" : obj.toString();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -31,6 +31,9 @@ spring:
|
|||||||
multipart:
|
multipart:
|
||||||
max-file-size: 500MB
|
max-file-size: 500MB
|
||||||
max-request-size: 500MB
|
max-request-size: 500MB
|
||||||
|
threads:
|
||||||
|
virtual:
|
||||||
|
enabled: true
|
||||||
web:
|
web:
|
||||||
resources:
|
resources:
|
||||||
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
||||||
@@ -161,3 +164,10 @@ notify:
|
|||||||
type: "SERVER_CHAN"
|
type: "SERVER_CHAN"
|
||||||
config:
|
config:
|
||||||
key: "sctp747ta-wkq4hlzb6e42t8d1sm8wbc9g"
|
key: "sctp747ta-wkq4hlzb6e42t8d1sm8wbc9g"
|
||||||
|
otel:
|
||||||
|
traces:
|
||||||
|
exporter: none
|
||||||
|
metrics:
|
||||||
|
exporter: none
|
||||||
|
logs:
|
||||||
|
exporter: none
|
||||||
|
@@ -35,6 +35,9 @@ spring:
|
|||||||
multipart:
|
multipart:
|
||||||
max-file-size: 500MB
|
max-file-size: 500MB
|
||||||
max-request-size: 500MB
|
max-request-size: 500MB
|
||||||
|
threads:
|
||||||
|
virtual:
|
||||||
|
enabled: true
|
||||||
web:
|
web:
|
||||||
resources:
|
resources:
|
||||||
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
|
||||||
@@ -167,3 +170,31 @@ notify:
|
|||||||
type: "SERVER_CHAN"
|
type: "SERVER_CHAN"
|
||||||
config:
|
config:
|
||||||
key: "sctp747ta-wkq4hlzb6e42t8d1sm8wbc9g"
|
key: "sctp747ta-wkq4hlzb6e42t8d1sm8wbc9g"
|
||||||
|
|
||||||
|
otel:
|
||||||
|
service:
|
||||||
|
name: ZT-BE
|
||||||
|
instrumentation:
|
||||||
|
annotations:
|
||||||
|
enabled: true
|
||||||
|
jdbc:
|
||||||
|
enabled: true
|
||||||
|
logback-mdc:
|
||||||
|
enabled: true
|
||||||
|
spring-web:
|
||||||
|
enabled: true
|
||||||
|
spring-webmvc:
|
||||||
|
enabled: true
|
||||||
|
spring-scheduling:
|
||||||
|
enabled: false
|
||||||
|
resource:
|
||||||
|
attributes:
|
||||||
|
environment: "production"
|
||||||
|
service: "ZT-BE"
|
||||||
|
exporter:
|
||||||
|
otlp:
|
||||||
|
endpoint: "https://oltp.jerryyan.top"
|
||||||
|
metrics:
|
||||||
|
exporter: none
|
||||||
|
logs:
|
||||||
|
exporter: none
|
||||||
|
@@ -36,6 +36,11 @@
|
|||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="updateScore">
|
||||||
|
update face_sample
|
||||||
|
set score = #{score}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
<delete id="deleteById">
|
<delete id="deleteById">
|
||||||
delete from face_sample where id = #{id}
|
delete from face_sample where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
@@ -244,7 +244,7 @@
|
|||||||
left join scenic s on o.scenic_id = s.id
|
left join scenic s on o.scenic_id = s.id
|
||||||
<where>
|
<where>
|
||||||
<if test="id!= null ">
|
<if test="id!= null ">
|
||||||
and o.id = #{id}
|
and o.id LIKE CONCAT('%',#{id},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="scenicId != null">
|
<if test="scenicId != null">
|
||||||
and o.scenic_id = #{scenicId}
|
and o.scenic_id = #{scenicId}
|
||||||
@@ -253,26 +253,17 @@
|
|||||||
and m.nickname like concat('%',#{memberNickname},'%')
|
and m.nickname like concat('%',#{memberNickname},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="memberId != null">
|
<if test="memberId != null">
|
||||||
and o.member_id like concat('%',#{memberId},'%')
|
and (o.member_id like concat('%',#{memberId},'%') or m.uid like concat('%',#{memberId},'%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="memberUid!= null">
|
<if test="memberUid!= null">
|
||||||
and m.uid = #{memberUid}
|
and m.uid = #{memberUid}
|
||||||
</if>
|
</if>
|
||||||
<if test="price!= null ">
|
|
||||||
and o.price = #{price}
|
|
||||||
</if>
|
|
||||||
<if test="payPrice!= null ">
|
|
||||||
and pay_price = #{payPrice}
|
|
||||||
</if>
|
|
||||||
<if test="remark!= null and remark!= ''">
|
<if test="remark!= null and remark!= ''">
|
||||||
and remark like concat('%',#{remark},'%')
|
and remark like concat('%',#{remark},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="brokerId!= null ">
|
<if test="brokerId!= null ">
|
||||||
and o.broker_id = #{brokerId}
|
and o.broker_id = #{brokerId}
|
||||||
</if>
|
</if>
|
||||||
<if test="promoCode!= null and promoCode!= ''">
|
|
||||||
and o.promo_code like concat('%',#{promoCode},'%')
|
|
||||||
</if>
|
|
||||||
<if test="refundReason!= null and refundReason!= ''">
|
<if test="refundReason!= null and refundReason!= ''">
|
||||||
and refund_reason like concat('%',#{refundReason},'%')
|
and refund_reason like concat('%',#{refundReason},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -338,12 +329,6 @@
|
|||||||
<if test="memberUid!= null">
|
<if test="memberUid!= null">
|
||||||
and m.uid = #{memberUid}
|
and m.uid = #{memberUid}
|
||||||
</if>
|
</if>
|
||||||
<if test="price!= null ">
|
|
||||||
and o.price = #{price}
|
|
||||||
</if>
|
|
||||||
<if test="payPrice!= null ">
|
|
||||||
and pay_price = #{payPrice}
|
|
||||||
</if>
|
|
||||||
<if test="remark!= null and remark!= ''">
|
<if test="remark!= null and remark!= ''">
|
||||||
and remark like concat('%',#{remark},'%')
|
and remark like concat('%',#{remark},'%')
|
||||||
</if>
|
</if>
|
||||||
@@ -450,12 +435,6 @@
|
|||||||
<if test="memberUid!= null">
|
<if test="memberUid!= null">
|
||||||
and m.uid = #{memberUid}
|
and m.uid = #{memberUid}
|
||||||
</if>
|
</if>
|
||||||
<if test="price!= null ">
|
|
||||||
and o.price = #{price}
|
|
||||||
</if>
|
|
||||||
<if test="payPrice!= null ">
|
|
||||||
and pay_price = #{payPrice}
|
|
||||||
</if>
|
|
||||||
<if test="remark!= null and remark!= ''">
|
<if test="remark!= null and remark!= ''">
|
||||||
and remark like concat('%',#{remark},'%')
|
and remark like concat('%',#{remark},'%')
|
||||||
</if>
|
</if>
|
||||||
|
@@ -3,19 +3,19 @@
|
|||||||
<mapper namespace="com.ycwl.basic.mapper.PermissionMapper">
|
<mapper namespace="com.ycwl.basic.mapper.PermissionMapper">
|
||||||
<!-- 新增插入语句 -->
|
<!-- 新增插入语句 -->
|
||||||
<insert id="insertPermission">
|
<insert id="insertPermission">
|
||||||
INSERT INTO permission (user_id, perm_str, create_time, update_time)
|
INSERT INTO account_permission (user_id, perm_str, menu_str, create_time, update_time)
|
||||||
VALUES (#{userId}, #{permString}, NOW(), NOW())
|
VALUES (#{userId}, #{permString}, #{menuString}, NOW(), NOW())
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 新增更新语句 -->
|
<!-- 新增更新语句 -->
|
||||||
<update id="updatePermission">
|
<update id="updatePermission">
|
||||||
UPDATE permission
|
UPDATE account_permission
|
||||||
SET perm_str = #{permString}, update_time = NOW()
|
SET perm_str = #{permString}, menu_str = #{menuString}, update_time = NOW()
|
||||||
WHERE user_id = #{userId}
|
WHERE user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
<select id="selectByUserId" resultType="com.ycwl.basic.model.pc.permission.entity.PermissionEntity">
|
<select id="selectByUserId" resultType="com.ycwl.basic.model.pc.permission.entity.PermissionEntity">
|
||||||
SELECT id, user_id, perm_str as permString, create_time, update_time
|
SELECT id, user_id, perm_str as permString, menu_str as menuString, create_time, update_time
|
||||||
FROM permission
|
FROM account_permission
|
||||||
WHERE user_id = #{userId}
|
WHERE user_id = #{userId}
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
@@ -52,6 +52,9 @@
|
|||||||
<if test="req.goodsId != null">
|
<if test="req.goodsId != null">
|
||||||
and p.goods_ids like concat('%', #{req.goodsId}, '%')
|
and p.goods_ids like concat('%', #{req.goodsId}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="req.status != null">
|
||||||
|
and p.status = #{req.status}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
<select id="getPriceByScenicTypeGoods" resultType="com.ycwl.basic.model.pc.price.entity.PriceConfigEntity">
|
<select id="getPriceByScenicTypeGoods" resultType="com.ycwl.basic.model.pc.price.entity.PriceConfigEntity">
|
||||||
|
@@ -5,6 +5,10 @@
|
|||||||
insert into scenic_account(id, scenic_id, is_super, name, phone, account, password, create_time, update_time)
|
insert into scenic_account(id, scenic_id, is_super, name, phone, account, password, create_time, update_time)
|
||||||
values (#{id}, #{scenicId}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now())
|
values (#{id}, #{scenicId}, #{isSuper}, #{name}, #{phone}, #{account}, #{password}, now(), now())
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="addAccountScenicRelation">
|
||||||
|
insert into account_scenic(account_id, scenic_id, is_admin)
|
||||||
|
values (#{accountId}, #{scenicId}, #{isAdmin})
|
||||||
|
</insert>
|
||||||
<update id="update">
|
<update id="update">
|
||||||
update scenic_account
|
update scenic_account
|
||||||
<set>
|
<set>
|
||||||
@@ -41,11 +45,17 @@
|
|||||||
<delete id="deleteByScenicId">
|
<delete id="deleteByScenicId">
|
||||||
delete from scenic_account where scenic_id = #{scenicId}
|
delete from scenic_account where scenic_id = #{scenicId}
|
||||||
</delete>
|
</delete>
|
||||||
|
<delete id="deleteRelationByScenicId">
|
||||||
|
delete from account_scenic where scenic_id = #{scenicId}
|
||||||
|
</delete>
|
||||||
|
<delete id="deleteRelationById">
|
||||||
|
delete from account_scenic where account_id = #{accountId}
|
||||||
|
</delete>
|
||||||
<select id="getSuperAccountOfScenic"
|
<select id="getSuperAccountOfScenic"
|
||||||
resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
||||||
select id, scenic_id, is_super, name, phone, account, password, create_time, update_time
|
select a.id, b.scenic_id, b.is_admin as isSuper, a.name, a.phone, a.account, a.password, a.create_time, a.update_time
|
||||||
from scenic_account
|
from scenic_account a left join account_scenic b on a.id = b.account_id
|
||||||
where scenic_id = #{scenicId} and is_super = 1
|
where b.scenic_id = #{scenicId} and b.is_admin = 1
|
||||||
</select>
|
</select>
|
||||||
<select id="getByAccount" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
<select id="getByAccount" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity">
|
||||||
select id, scenic_id, is_super, name, phone, account, password, status,create_time, update_time
|
select id, scenic_id, is_super, name, phone, account, password, status,create_time, update_time
|
||||||
@@ -61,7 +71,7 @@
|
|||||||
SELECT * FROM scenic_account
|
SELECT * FROM scenic_account
|
||||||
<where>
|
<where>
|
||||||
<if test="scenicId != null">
|
<if test="scenicId != null">
|
||||||
AND scenic_id = #{scenicId}
|
AND id in (select account_id from account_scenic where scenic_id = #{scenicId})
|
||||||
</if>
|
</if>
|
||||||
<if test="account != null and account != ''">
|
<if test="account != null and account != ''">
|
||||||
AND account LIKE CONCAT('%', #{account}, '%')
|
AND account LIKE CONCAT('%', #{account}, '%')
|
||||||
@@ -84,4 +94,9 @@
|
|||||||
</where>
|
</where>
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getAccountRelations" resultType="java.lang.Long">
|
||||||
|
SELECT scenic_id
|
||||||
|
FROM account_scenic
|
||||||
|
WHERE account_id = #{scenicId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@@ -318,6 +318,174 @@
|
|||||||
WHERE scenic_id = #{scenicId}
|
WHERE scenic_id = #{scenicId}
|
||||||
AND date BETWEEN #{startTime} AND #{endTime}
|
AND date BETWEEN #{startTime} AND #{endTime}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="orderChartByDate" resultType="java.util.HashMap">
|
||||||
|
SELECT
|
||||||
|
DATE(date_series.DATE) as t,
|
||||||
|
COALESCE ( count( `order`.id ), 0 ) AS count,
|
||||||
|
COALESCE ( sum( `order`.pay_price ), 0 ) AS price
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DATE_ADD( #{startTime}, INTERVAL ( units.i + tens.i * 10 + hundreds.i * 100 ) DAY ) AS DATE
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) units
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) tens
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) hundreds
|
||||||
|
WHERE
|
||||||
|
DATE_ADD( #{startTime}, INTERVAL ( units.i + tens.i * 10 + hundreds.i * 100 ) DAY ) <= #{endTime}
|
||||||
|
) date_series
|
||||||
|
LEFT JOIN `order` ON DATE ( `order`.create_at ) = date_series.DATE AND `order`.scenic_id = #{scenicId} AND ( `order`.STATUS = 1 OR `order`.STATUS = 2 )
|
||||||
|
GROUP BY
|
||||||
|
date_series.DATE
|
||||||
|
ORDER BY date_series.DATE
|
||||||
|
</select>
|
||||||
|
<select id="orderChartByHour" resultType="java.util.HashMap">
|
||||||
|
SELECT
|
||||||
|
date_series.HOUR as t,
|
||||||
|
COALESCE ( count( `order`.id ), 0 ) AS count,
|
||||||
|
COALESCE ( sum( `order`.pay_price ), 0 ) AS price
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
DATE_FORMAT( DATE_ADD( #{startTime}, INTERVAL ( units.i + tens.i * 10 + hundreds.i * 100 ) HOUR ), '%m-%d %H') AS HOUR
|
||||||
|
FROM
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) units
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) tens
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT
|
||||||
|
0 AS i UNION ALL
|
||||||
|
SELECT
|
||||||
|
1 UNION ALL
|
||||||
|
SELECT
|
||||||
|
2 UNION ALL
|
||||||
|
SELECT
|
||||||
|
3 UNION ALL
|
||||||
|
SELECT
|
||||||
|
4 UNION ALL
|
||||||
|
SELECT
|
||||||
|
5 UNION ALL
|
||||||
|
SELECT
|
||||||
|
6 UNION ALL
|
||||||
|
SELECT
|
||||||
|
7 UNION ALL
|
||||||
|
SELECT
|
||||||
|
8 UNION ALL
|
||||||
|
SELECT
|
||||||
|
9
|
||||||
|
) hundreds
|
||||||
|
WHERE
|
||||||
|
DATE_ADD( #{startTime}, INTERVAL ( units.i + tens.i * 10 + hundreds.i * 100 ) HOUR ) <= #{endTime}
|
||||||
|
) date_series
|
||||||
|
LEFT JOIN `order` ON DATE_FORMAT( `order`.create_at, '%m-%d %H' ) = date_series.HOUR AND `order`.scenic_id = #{scenicId} AND ( `order`.STATUS = 1 OR `order`.STATUS = 2 )
|
||||||
|
GROUP BY
|
||||||
|
date_series.HOUR
|
||||||
|
ORDER BY date_series.HOUR
|
||||||
|
</select>
|
||||||
<insert id="insertStat">
|
<insert id="insertStat">
|
||||||
REPLACE INTO scenic_stats (scenic_id, date, cs1, v1, sv1, u1, m1, gv1, gv2, pv1, pv2, cp1, o1, o2, o3, ro2, ro3)
|
REPLACE INTO scenic_stats (scenic_id, date, cs1, v1, sv1, u1, m1, gv1, gv2, pv1, pv2, cp1, o1, o2, o3, ro2, ro3)
|
||||||
VALUES (#{scenicId}, #{date}, #{data.cameraShotOfMemberNum}, #{data.totalVisitorOfMemberNum}, #{data.scanCodeVisitorOfMemberNum}, #{data.uploadFaceOfMemberNum}, #{data.pushOfMemberNum}, #{data.completeVideoOfMemberNum}, #{data.completeOfVideoNum}, #{data.previewVideoOfMemberNum}, #{data.previewOfVideoNum}, #{data.clickOnPayOfMemberNum}, #{data.payOfMemberNum}, #{data.payOfOrderNum}, #{data.payOfOrderAmount}, #{data.refundOfOrderNum}, #{data.refundOfOrderAmount})
|
VALUES (#{scenicId}, #{date}, #{data.cameraShotOfMemberNum}, #{data.totalVisitorOfMemberNum}, #{data.scanCodeVisitorOfMemberNum}, #{data.uploadFaceOfMemberNum}, #{data.pushOfMemberNum}, #{data.completeVideoOfMemberNum}, #{data.completeOfVideoNum}, #{data.previewVideoOfMemberNum}, #{data.previewOfVideoNum}, #{data.clickOnPayOfMemberNum}, #{data.payOfMemberNum}, #{data.payOfOrderNum}, #{data.payOfOrderAmount}, #{data.refundOfOrderNum}, #{data.refundOfOrderAmount})
|
||||||
|
@@ -87,4 +87,14 @@ public class BceFaceBodyAdapterTest {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDeleteFace() {
|
||||||
|
BceFaceBodyAdapter adapter = getAdapter();
|
||||||
|
String db = "3972138108618674176";
|
||||||
|
List<String> entityIds = adapter.listFace(db, "", null, null);
|
||||||
|
entityIds.forEach(entityId -> {
|
||||||
|
adapter.deleteFace(db, entityId);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user