You've already forked FrameTour-BE
Compare commits
28 Commits
aaddbab2ab
...
a9655814ae
Author | SHA1 | Date | |
---|---|---|---|
a9655814ae | |||
c1b4bc8952 | |||
4bacdbe39a | |||
4273cda7cd | |||
ceba1e1b01 | |||
34dbc7d036 | |||
89e112e13a | |||
26a9be80f6 | |||
a4a6e9b5af | |||
0d5aabe317 | |||
5d2cf4fd31 | |||
80f4491836 | |||
115edc19fa | |||
bfd37fc764 | |||
ef0ba3ddb4 | |||
88cce9357d | |||
c50cd84af0 | |||
0c40cdad4e | |||
a41b87713f | |||
06a07514cc | |||
0292b754fe | |||
460b4ea42a | |||
7fd62e9aba | |||
3b3c768bbe | |||
1e993c6fd4 | |||
937c2b33d3 | |||
9b00b34a68 | |||
c01ff160c3 |
pom.xml
src
main
java
com
ycwl
basic
aspectj
biz
constant
controller
extern
mobile
AppFaceController.javaAppMemberController.javaAppOrderController.javaAppPrinterController.javaAppScenicController.javaAppVideoController.javaAppWxNotifyController.javaAppWxPayController.java
manage
pc
DeviceStatsController.javaFaceDetectLogController.javaFaceSampleController.javaSourceController.javaTaskController.javaVideoController.java
proxy
viid
device
exception
facebody
image
watermark
interceptor
mapper
DeviceMapper.javaFaceMapper.javaPrintTaskMapper.javaPrinterMapper.javaScenicDeviceStatsMapper.javaSourceMapper.javaVideoMapper.java
model
jwt
mobile
order
pc
adminUser
broker
device
face
faceSample
member
order
permission
entity
printer
renderWorker
role
scenic
scenicDeviceStats
entity
req
resp
source
task
template
video
printer
snowFlake
wx
notify
pay
PayFactory.java
adapter
entity
CancelOrderRequest.javaCongMingPayConfig.javaCreateOrderResponse.javaPayResponse.javaRefundOrderRequest.javaRefundResponse.java
enums
printer
ticket
profitsharing
service
mobile
pc
printer
task
stats
storage
task
DynamicTaskGenerator.javaFaceCleaner.javaScenicDeviceStatsTask.javaVideoPieceGetter.javaVideoTaskGenerator.java
utils
resources
test
java
com
ycwl
basic
23
pom.xml
23
pom.xml
@@ -5,33 +5,38 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.18</version>
|
||||
<version>3.1.4</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.ycwl</groupId>
|
||||
<artifactId>basic</artifactId>
|
||||
<artifactId>basic21</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>liuying</name>
|
||||
<description>流影</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<java.version>8</java.version>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<mybatisplus.boot.starter.version>3.4.0</mybatisplus.boot.starter.version>
|
||||
<java.version>21</java.version>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<hutool-all.version>5.8.24</hutool-all.version>
|
||||
<mysql-connector.version>8.0.33</mysql-connector.version>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<knife4j-spring-boot-starter.version>2.0.7</knife4j-spring-boot-starter.version>
|
||||
<pagehelper.version>5.3.1</pagehelper.version>
|
||||
<tomcat.version>9.0.102</tomcat.version>
|
||||
<!--跳过单元测试-->
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- 添加 jakarta.servlet-api 依赖 -->
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- 微信支付 -->
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
@@ -85,7 +90,7 @@
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatisplus.boot.starter.version}</version>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 引入lombok工具 -->
|
||||
@@ -179,7 +184,7 @@
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.6.1</version>
|
||||
<version>4.6.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
|
@@ -13,8 +13,8 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
|
@@ -53,7 +53,7 @@ public class BrokerBiz {
|
||||
expireDay = scenicConfig.getSampleStoreDay();
|
||||
}
|
||||
List<Long> brokerIdList = statisticsMapper.getBrokerIdListForUser(order.getMemberId(), DateUtil.offsetDay(DateUtil.beginOfDay(order.getCreateAt()), -expireDay), order.getCreateAt());
|
||||
Long directBrokerId = brokerIdList.get(0);
|
||||
Long directBrokerId = brokerIdList.getFirst();
|
||||
List<BrokerRespVO> brokerInfoList = brokerIdList.stream().map(brokerId -> {
|
||||
BrokerRespVO broker = brokerMapper.getById(brokerId);
|
||||
if (broker == null) {
|
||||
@@ -77,7 +77,7 @@ public class BrokerBiz {
|
||||
if (brokerInfoList.size() == 1) {
|
||||
// 直接算佣金
|
||||
String reason = "单人提成:";
|
||||
BrokerRespVO broker = brokerInfoList.get(0);
|
||||
BrokerRespVO broker = brokerInfoList.getFirst();
|
||||
BrokerRecord brokerRecord = new BrokerRecord();
|
||||
brokerRecord.setBrokerId(broker.getId());
|
||||
brokerRecord.setOrderId(orderId);
|
||||
@@ -95,7 +95,7 @@ public class BrokerBiz {
|
||||
brokerRecord.setReason(reason);
|
||||
brokerRecordList.add(brokerRecord);
|
||||
} else {
|
||||
BrokerRespVO broker = brokerInfoList.get(0);
|
||||
BrokerRespVO broker = brokerInfoList.getFirst();
|
||||
BigDecimal realRate = broker.getBrokerRate();
|
||||
BigDecimal brokerPrice = order.getPayPrice().multiply(realRate).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN);
|
||||
// todo 需要计算实际提成比例
|
||||
@@ -141,9 +141,7 @@ public class BrokerBiz {
|
||||
brokerRecordList.add(brokerRecord);
|
||||
}
|
||||
revokeOrder(orderId);
|
||||
brokerRecordList.forEach(brokerRecord -> {
|
||||
brokerRecordMapper.add(brokerRecord);
|
||||
});
|
||||
brokerRecordList.forEach(brokerRecordMapper::add);
|
||||
}
|
||||
|
||||
public void revokeOrder(Long orderId) {
|
||||
|
@@ -32,8 +32,10 @@ import com.ycwl.basic.repository.SourceRepository;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.repository.VideoRepository;
|
||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
import com.ycwl.basic.service.printer.PrinterService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -74,6 +76,9 @@ public class OrderBiz {
|
||||
private BrokerBiz brokerBiz;
|
||||
@Autowired
|
||||
private CouponBiz couponBiz;
|
||||
@Autowired
|
||||
@Lazy
|
||||
private PrinterService printerService;
|
||||
|
||||
public PriceObj queryPrice(Long scenicId, int goodsType, Long goodsId) {
|
||||
PriceObj priceObj = new PriceObj();
|
||||
@@ -161,15 +166,11 @@ public class OrderBiz {
|
||||
}
|
||||
// 免费送逻辑,之前已经赠送了的
|
||||
if (!isBuy) {
|
||||
switch (goodsType) {
|
||||
case 0:
|
||||
isBuy = videoRepository.getUserIsBuy(userId, goodsId);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
isBuy = sourceRepository.getUserIsBuy(userId, goodsType, goodsId);
|
||||
break;
|
||||
}
|
||||
isBuy = switch (goodsType) {
|
||||
case 0 -> videoRepository.getUserIsBuy(userId, goodsId);
|
||||
case 1, 2 -> sourceRepository.getUserIsBuy(userId, goodsType, goodsId);
|
||||
default -> false;
|
||||
};
|
||||
} else {
|
||||
OrderEntity orderEntity = orderRepository.getUserBuyItem(userId, goodsType, goodsId);
|
||||
if (orderEntity != null) {
|
||||
@@ -237,6 +238,8 @@ public class OrderBiz {
|
||||
case 1: // 视频原素材
|
||||
case 2: // 照片原素材
|
||||
sourceRepository.setUserIsBuyItem(order.getMemberId(), item.getGoodsType(), item.getGoodsId(), order.getId());
|
||||
case 3:
|
||||
printerService.setUserIsBuyItem(order.getMemberId(), item.getGoodsId(), order.getId());
|
||||
}
|
||||
});
|
||||
orderRepository.clearOrderCache(orderId); // 更新完了,清理下
|
||||
@@ -250,7 +253,7 @@ public class OrderBiz {
|
||||
//商品创建时间
|
||||
Date goodsCreateTime = new Date();
|
||||
if (!orderDetail.getOrderItemList().isEmpty()) {
|
||||
OrderItemVO orderItemVO = orderDetail.getOrderItemList().get(0);
|
||||
OrderItemVO orderItemVO = orderDetail.getOrderItemList().getFirst();
|
||||
switch (orderItemVO.getGoodsType()) {
|
||||
case 0:
|
||||
VideoEntity video = videoRepository.getVideo(orderItemVO.getGoodsId());
|
||||
|
@@ -112,7 +112,7 @@ public class TaskStatusBiz {
|
||||
int faceCutStatus = getFaceCutStatus(faceId);
|
||||
if (faceCutStatus != 1) {
|
||||
// 正在切片
|
||||
if (templateBiz.determineTemplateCanGenerate(templateList.get(0).getId(), faceId, false)) {
|
||||
if (templateBiz.determineTemplateCanGenerate(templateList.getFirst().getId(), faceId, false)) {
|
||||
response.setStatus(2);
|
||||
} else {
|
||||
response.setStatus(0);
|
||||
|
@@ -107,7 +107,7 @@ public class TemplateBiz {
|
||||
List<SourceEntity> sourceEntities = sourceMapper.listVideoByScenicFaceRelation(face.getScenicId(), faceId);
|
||||
count = sourceEntities.stream()
|
||||
.map(SourceEntity::getDeviceId)
|
||||
.filter(deviceId -> deviceId != null) // 添加对 null 的检查
|
||||
.filter(Objects::nonNull) // 添加对 null 的检查
|
||||
.distinct()
|
||||
.filter(deviceId -> placeholderList.contains(deviceId.toString()))
|
||||
.count();
|
||||
|
@@ -10,29 +10,29 @@ import java.util.Map;
|
||||
@Data
|
||||
public class BaseContextHandler {
|
||||
|
||||
public static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal();
|
||||
public static ThreadLocal<Map<String, Object>> threadLocal = new ThreadLocal<>();
|
||||
|
||||
public BaseContextHandler() {
|
||||
}
|
||||
|
||||
public static void set(String key, Object value) {
|
||||
Object map;
|
||||
if ((map = (Map) threadLocal.get()) == null) {
|
||||
map = new HashMap();
|
||||
threadLocal.set((Map<String, Object>) map);
|
||||
Map<String, Object> map;
|
||||
if ((map = threadLocal.get()) == null) {
|
||||
map = new HashMap<>();
|
||||
threadLocal.set(map);
|
||||
}
|
||||
|
||||
((Map) map).put(key, value);
|
||||
map.put(key, value);
|
||||
}
|
||||
|
||||
public static Object get(String key) {
|
||||
Object map;
|
||||
if ((map = (Map) threadLocal.get()) == null) {
|
||||
map = new HashMap();
|
||||
threadLocal.set((Map<String, Object>) map);
|
||||
Map<String, Object> map;
|
||||
if ((map = threadLocal.get()) == null) {
|
||||
map = new HashMap<>();
|
||||
threadLocal.set(map);
|
||||
}
|
||||
|
||||
return ((Map) map).get(key);
|
||||
return (map).get(key);
|
||||
}
|
||||
|
||||
public static void setToken(String token) {
|
||||
|
@@ -1,126 +0,0 @@
|
||||
package com.ycwl.basic.constant;
|
||||
|
||||
import com.wechat.pay.java.service.payments.model.Transaction;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>@description: 微信常量 </p>
|
||||
* <p>@author: songmingsong </p>
|
||||
**/
|
||||
public class WeiXinConstant {
|
||||
|
||||
private static final Map<Transaction.TradeStateEnum, String> STATE_DESCRIPTION_MAP = new HashMap<>();
|
||||
|
||||
static {
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.SUCCESS, "SUCCESS");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.REFUND, "REFUND");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.NOTPAY, "NOTPAY");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.CLOSED, "CLOSED");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.REVOKED, "REVOKED");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.USERPAYING, "USERPAYING");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.PAYERROR, "PAYERROR");
|
||||
STATE_DESCRIPTION_MAP.put(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum.ACCEPT, "ACCEPT");
|
||||
}
|
||||
|
||||
public static String getDescriptionState(com.wechat.pay.java.service.payments.model.Transaction.TradeStateEnum state) {
|
||||
return STATE_DESCRIPTION_MAP.getOrDefault(state, "未知状态");
|
||||
}
|
||||
|
||||
private static final Map<com.wechat.pay.java.service.payments.model.Transaction.TradeTypeEnum, String> STATE_DESCRIPTION_MAP_TYPE = new HashMap<>();
|
||||
|
||||
static {
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.JSAPI, "JSAPI");
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.NATIVE, "NATIVE");
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.APP, "APP");
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.MICROPAY, "MICROPAY");
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.MWEB, "MWEB");
|
||||
STATE_DESCRIPTION_MAP_TYPE.put(Transaction.TradeTypeEnum.FACEPAY, "FACEPAY");
|
||||
}
|
||||
|
||||
public static String getDescriptionType(Transaction.TradeTypeEnum type) {
|
||||
return STATE_DESCRIPTION_MAP_TYPE.getOrDefault(type, "未知类型");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 公众号模板地址
|
||||
*/
|
||||
public static final String PUBLIC_ACCOUNT_TEMPLATE =
|
||||
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=";
|
||||
/**
|
||||
* 获取微信用户基本信息地址
|
||||
*/
|
||||
public static final String WECHAT_OAUTH_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
||||
/**
|
||||
* 获取ACCESS_TOKEN
|
||||
*/
|
||||
public static final String ACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
||||
/**
|
||||
* 登录凭证校验
|
||||
*/
|
||||
public static final String GET_OPEN_ID = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
/**
|
||||
* 获取小程序地址
|
||||
*/
|
||||
public static final String GET_MINI_QRCODE = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=%s";
|
||||
/**
|
||||
* 获取用户基本信息
|
||||
*/
|
||||
public static final String GET_USER_BASIC_INFO = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN";
|
||||
/**
|
||||
* 获取包含请求参数ACCESS_TOKEN
|
||||
*/
|
||||
public static final String ACCESS_TOKEN_WITH_PARAM = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s";
|
||||
/**
|
||||
* 获取小程序 URL Link
|
||||
*/
|
||||
public static final String GENERATE_URL_LINK = "https://api.weixin.qq.com/wxa/generate_urllink?access_token=%s";
|
||||
|
||||
/**
|
||||
* 发送模板消息
|
||||
*/
|
||||
public static final String MESSAGE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=";
|
||||
|
||||
/*-----------------------------*/
|
||||
/* */
|
||||
/* 支付相关 */
|
||||
/* */
|
||||
/*-----------------------------*/
|
||||
/**
|
||||
* 退款链接
|
||||
*/
|
||||
public static final String REFUNDS_URL = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds";
|
||||
public static final String REFUNDS_URi = "/v3/refund/domestic/refunds/";
|
||||
/**
|
||||
* 其他
|
||||
*/
|
||||
public static final String WECHATPAY_STATUS = "status";
|
||||
public static final String WECHATPAY_SUCCESS = "SUCCESS";
|
||||
public static final String WECHATPAY_PROCESSING = "PROCESSING";
|
||||
public static final String WECHATPAY_OUT_TRADE_NO = "out_trade_no";
|
||||
public static final String WECHATPAY_OUT_REFUND_NO = "out_refund_no";
|
||||
public static final String WECHATPAY_REFUND = "refund";
|
||||
public static final String WECHATPAY_TOTAL = "total";
|
||||
public static final String WECHATPAY_CURRENCY = "currency";
|
||||
public static final String WECHATPAY_CURRENCY_CNY = "CNY";
|
||||
public static final String WECHATPAY_AMOUNT = "amount";
|
||||
public static final String WECHATPAY_NOTIFY_URL = "notify_url";
|
||||
|
||||
public static final String REFUNDS_RESOURCE = "resource";
|
||||
public static final String REFUNDS_CIPHERTEXT = "ciphertext";
|
||||
public static final String REFUNDS_NONCE = "nonce";
|
||||
public static final String REFUNDS_REFUND_STATUS = "refund_status";
|
||||
public static final String REFUNDS_ASSOCIATED_DATA = "associated_data";
|
||||
public static final String WECHAT_ERRCODE = "errcode";
|
||||
public static final String WECHAT_ERRMSG = "errmsg";
|
||||
/**
|
||||
* 退款的token的SCHEMA
|
||||
*/
|
||||
public static final String REFUNDS_SCHEMA = "Wechatpay-Signature-Type "; // 注意有一个空格
|
||||
/**
|
||||
* 支付请求头
|
||||
*/
|
||||
public static final String WECHATPAY_SIGNATURE_TYPE = "Wechatpay-Signature-Type";
|
||||
}
|
@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
@@ -66,7 +66,7 @@ public class LyCompatibleController {
|
||||
@PostMapping("sendPhoto")
|
||||
@IgnoreToken
|
||||
public R sendPhoto(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request) {
|
||||
Map<String, String> headersMap = new HashMap<String, String>();
|
||||
Map<String, String> headersMap = new HashMap<>();
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = (String) headerNames.nextElement();
|
||||
@@ -123,7 +123,7 @@ public class LyCompatibleController {
|
||||
@RequestMapping("getIsVideo")
|
||||
@IgnoreToken
|
||||
public R getIsVideo(HttpServletRequest request) {
|
||||
Map<String, String> headersMap = new HashMap<String, String>();
|
||||
Map<String, String> headersMap = new HashMap<>();
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = (String) headerNames.nextElement();
|
||||
@@ -165,7 +165,7 @@ public class LyCompatibleController {
|
||||
@RequestMapping("getNewVideo")
|
||||
@IgnoreToken
|
||||
public R getNewVideo(HttpServletRequest request) {
|
||||
Map<String, String> headersMap = new HashMap<String, String>();
|
||||
Map<String, String> headersMap = new HashMap<>();
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String key = (String) headerNames.nextElement();
|
||||
@@ -204,7 +204,7 @@ public class LyCompatibleController {
|
||||
}
|
||||
List<Map<String, Object>> videoList = collect.get(0).stream().collect(Collectors.groupingBy(ContentPageVO::getTemplateId))
|
||||
.values().stream().map(contentPageVOs -> {
|
||||
ContentPageVO contentPageVO = contentPageVOs.get(0);
|
||||
ContentPageVO contentPageVO = contentPageVOs.getFirst();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
VideoEntity videoRespVO = videoRepository.getVideo(contentPageVO.getContentId());
|
||||
map.put("id", videoRespVO.getId().toString());
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.controller.extern;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -11,6 +12,7 @@ import java.util.Map;
|
||||
* @date 2016年10月27日 下午9:59:27
|
||||
*/
|
||||
public class R extends HashMap<String, Object> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public R() {
|
||||
|
@@ -39,7 +39,7 @@ AppFaceController {
|
||||
*/
|
||||
@ApiOperation("人脸照片上传")
|
||||
@PostMapping("/faceUPload")
|
||||
public ApiResponse faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
||||
public ApiResponse<FaceRecognizeResp> faceUpload(@RequestParam("file")MultipartFile file, @RequestParam("scenicId") Long scenicId) {
|
||||
//获取用户id
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
Long userId = worker.getUserId();
|
||||
@@ -61,12 +61,12 @@ AppFaceController {
|
||||
}
|
||||
|
||||
@DeleteMapping("/{faceId}")
|
||||
public ApiResponse deleteFace(@PathVariable("faceId") Long faceId) {
|
||||
public ApiResponse<String> deleteFace(@PathVariable("faceId") Long faceId) {
|
||||
return faceService.deleteFace(faceId);
|
||||
}
|
||||
|
||||
@PostMapping("/{faceId}/match")
|
||||
public ApiResponse match(@PathVariable("faceId") Long faceId) {
|
||||
public ApiResponse<String> match(@PathVariable("faceId") Long faceId) {
|
||||
faceService.matchFaceId(faceId);
|
||||
return ApiResponse.success("");
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ public class AppMemberController {
|
||||
|
||||
@ApiOperation("新增或修改景区服务通知状态")
|
||||
@GetMapping("/updateScenicServiceNoticeStatus")
|
||||
public ApiResponse updateScenicServiceNoticeStatus(Long scenicId) {
|
||||
public ApiResponse<String> updateScenicServiceNoticeStatus(Long scenicId) {
|
||||
return memberService.updateScenicServiceNoticeStatus(scenicId);
|
||||
}
|
||||
|
||||
|
@@ -14,6 +14,7 @@ import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.order.req.CreateBatchOrderReqVO;
|
||||
import com.ycwl.basic.model.pc.order.req.CreateOrderReqVO;
|
||||
import com.ycwl.basic.model.pc.order.resp.OrderAppRespVO;
|
||||
import com.ycwl.basic.pay.entity.PayResponse;
|
||||
import com.ycwl.basic.service.pc.OrderService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||
@@ -63,6 +64,11 @@ public class AppOrderController {
|
||||
return orderService.createOrder(worker.getUserId(), orderAddReq);
|
||||
}
|
||||
|
||||
@ApiOperation("查询订单")
|
||||
@GetMapping("/queryOrder")
|
||||
public ApiResponse<PayResponse> queryOrder(@RequestParam("orderId") Long orderId) {
|
||||
return ApiResponse.success(orderService.queryOrder(orderId));
|
||||
}
|
||||
|
||||
@ApiOperation("用户端打包订单新增")
|
||||
@PostMapping("/addBatchOrder")
|
||||
@@ -97,6 +103,9 @@ public class AppOrderController {
|
||||
Long userId = Long.parseLong(BaseContextHandler.getUserId());
|
||||
if (faceId == null) {
|
||||
FaceRespVO lastFaceByUserId = faceMapper.findLastFaceByUserId(BaseContextHandler.getUserId());
|
||||
if (lastFaceByUserId == null) {
|
||||
return ApiResponse.fail("您还未上传人脸");
|
||||
}
|
||||
faceId = lastFaceByUserId.getId();
|
||||
}
|
||||
IsBuyBatchRespVO buy = priceBiz.isBuy(userId, faceId, scenicId, type, goodsIds);
|
||||
|
@@ -3,6 +3,8 @@ package com.ycwl.basic.controller.mobile;
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.pc.printer.resp.MemberPrintResp;
|
||||
import com.ycwl.basic.model.pc.printer.resp.PrinterResp;
|
||||
import com.ycwl.basic.model.printer.req.FromSourceReq;
|
||||
import com.ycwl.basic.service.printer.PrinterService;
|
||||
import com.ycwl.basic.storage.StorageFactory;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -18,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
@@ -27,7 +31,7 @@ public class AppPrinterController {
|
||||
private PrinterService printerService;
|
||||
@GetMapping("/listFor/{scenicId}")
|
||||
@IgnoreToken
|
||||
public ApiResponse<List> listFor(@PathVariable("scenicId") Long scenicId) {
|
||||
public ApiResponse<List<PrinterResp>> listFor(@PathVariable("scenicId") Long scenicId) {
|
||||
return ApiResponse.success(printerService.listByScenicId(scenicId));
|
||||
}
|
||||
|
||||
@@ -69,6 +73,12 @@ public class AppPrinterController {
|
||||
printerService.setPhotoCropped(JwtTokenUtil.getWorker().getUserId(), scenicId, id, url);
|
||||
return ApiResponse.success(url);
|
||||
}
|
||||
@PostMapping("/uploadTo/{scenicId}/formSource")
|
||||
public ApiResponse<?> uploadFromSource(@PathVariable("scenicId") Long scenicId, @RequestBody FromSourceReq req) throws IOException {
|
||||
printerService.addUserPhotoFromSource(JwtTokenUtil.getWorker().getUserId(), scenicId, req);
|
||||
return ApiResponse.success(null);
|
||||
}
|
||||
|
||||
@PostMapping("/setQuantity/{scenicId}/{id}")
|
||||
public ApiResponse<?> setQuantity(@PathVariable("scenicId") Long scenicId, @PathVariable("id") Long id, @RequestParam("quantity") Integer quantity) {
|
||||
if (quantity == null) {
|
||||
@@ -84,4 +94,13 @@ public class AppPrinterController {
|
||||
public ApiResponse<?> queryPrice(@PathVariable("scenicId") Long scenicId) {
|
||||
return ApiResponse.success(printerService.queryPrice(JwtTokenUtil.getWorker().getUserId(), scenicId));
|
||||
}
|
||||
|
||||
@PostMapping("/order/{scenicId}")
|
||||
public ApiResponse<Map<String, Object>> createOrder(@PathVariable("scenicId") Long scenicId) {
|
||||
return ApiResponse.success(printerService.createOrder(JwtTokenUtil.getWorker().getUserId(), scenicId, null));
|
||||
}
|
||||
@PostMapping("/order/{scenicId}/toPrinter/{printerId}")
|
||||
public ApiResponse<Map<String, Object>> createOrderToPrinter(@PathVariable("scenicId") Long scenicId, @PathVariable("printerId") Integer printerId) {
|
||||
return ApiResponse.success(printerService.createOrder(JwtTokenUtil.getWorker().getUserId(), scenicId, printerId));
|
||||
}
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
* @Date:2024/12/5 10:22
|
||||
*/
|
||||
@Slf4j
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/mobile/scenic/v1")
|
||||
@Api(tags = "景区相关接口")
|
||||
|
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/mobile/video/v1")
|
||||
public class AppVideoController {
|
||||
|
@@ -39,7 +39,7 @@ public class AppWxNotifyController {
|
||||
@GetMapping({"/getIds", "/"})
|
||||
@IgnoreToken
|
||||
public ApiResponse<List<String>> getIds() {
|
||||
return ApiResponse.success(new ArrayList<String>() {{
|
||||
return ApiResponse.success(new ArrayList<>() {{
|
||||
add("5b8vTm7kvwYubqDxb3dxBs0BqxMsgVgGw573aahTEd8");
|
||||
add("vPIzbkA0x4mMj-vdbWx6_45e8juWXzs3FGYnDsIPv3A");
|
||||
add("HB1vp-0BXc2WyYeoYN3a3GuZV9HtPLXUTT7blCBq9eY");
|
||||
@@ -49,7 +49,7 @@ public class AppWxNotifyController {
|
||||
@GetMapping("/{scenicId}")
|
||||
@IgnoreToken
|
||||
public ApiResponse<List<String>> getIds(@PathVariable("scenicId") Long scenicId) {
|
||||
return ApiResponse.success(new ArrayList<String>() {{
|
||||
return ApiResponse.success(new ArrayList<>() {{
|
||||
String videoGeneratedTemplateId = scenicRepository.getVideoGeneratedTemplateId(scenicId);
|
||||
if (StringUtils.isNotBlank(videoGeneratedTemplateId)) {
|
||||
add(videoGeneratedTemplateId);
|
||||
|
@@ -5,10 +5,12 @@ import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.enums.BizCodeEnum;
|
||||
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
||||
import com.ycwl.basic.model.wx.WxPayRespVO;
|
||||
import com.ycwl.basic.pay.entity.PayResponse;
|
||||
import com.ycwl.basic.service.mobile.WxPayService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -16,7 +18,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
|
||||
@@ -41,10 +44,17 @@ public class AppWxPayController {
|
||||
wxPayService.payNotify(request);
|
||||
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
||||
}
|
||||
@PostMapping("/{scenicId}/payNotify")
|
||||
|
||||
@RequestMapping("/{scenicId}/payNotify")
|
||||
@IgnoreToken
|
||||
public ApiResponse<?> payNotifyByScenicId(@PathVariable Long scenicId, HttpServletRequest request) {
|
||||
wxPayService.payNotify(scenicId, request);
|
||||
public Object payNotifyByScenicId(@PathVariable Long scenicId, HttpServletRequest request) {
|
||||
PayResponse payResponse = wxPayService.payNotify(scenicId, request);
|
||||
if (payResponse == null) {
|
||||
return ApiResponse.buildResult(BizCodeEnum.ADVANCE_PAYMENT_CALLBACK_FAILED);
|
||||
}
|
||||
if (StringUtils.isNotBlank(payResponse.getCustomResponse())) {
|
||||
return payResponse.getCustomResponse();
|
||||
}
|
||||
return ApiResponse.success(BizCodeEnum.REQUEST_OK);
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ public class AppStatisticsController {
|
||||
@ApiOperation("统计数据记录")
|
||||
@PostMapping("/addStatistics")
|
||||
@IgnoreToken
|
||||
public ApiResponse addStatistics(@RequestBody StatisticsRecordAddReq req) {
|
||||
public ApiResponse<String> addStatistics(@RequestBody StatisticsRecordAddReq req) {
|
||||
|
||||
return statisticsService.addStatistics(req);
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.scenicDeviceStats.req.DeviceStatsReq;
|
||||
import com.ycwl.basic.model.pc.scenicDeviceStats.resp.ScenicDeviceStatsListResp;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
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.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/deviceStats/v1")
|
||||
public class DeviceStatsController {
|
||||
@Autowired
|
||||
private com.ycwl.basic.service.pc.DeviceStatsService service;
|
||||
|
||||
@PostMapping("/{scenicId}")
|
||||
public ApiResponse<ScenicDeviceStatsListResp> queryByScenic(@PathVariable("scenicId") Long scenicId, @RequestBody DeviceStatsReq req) {
|
||||
return ApiResponse.success(service.queryByScenicId(scenicId, req.getStartTime(), req.getEndTime()));
|
||||
}
|
||||
}
|
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/face/detect_log/v1")
|
||||
public class FaceDetectLogController {
|
||||
|
@@ -17,6 +17,7 @@ import java.util.List;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/2 16:33
|
||||
*/
|
||||
@Deprecated
|
||||
@RestController
|
||||
@RequestMapping("/api/faceSample/v1")
|
||||
@Api(tags = "人脸样本管理")
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.controller.pc;
|
||||
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
||||
@@ -23,41 +24,29 @@ public class SourceController {
|
||||
@Autowired
|
||||
private SourceService sourceService;
|
||||
|
||||
@Deprecated
|
||||
@ApiOperation("分页查询视频源")
|
||||
@PostMapping("/page")
|
||||
public ApiResponse pageQuery(@RequestBody SourceReqQuery sourceReqQuery) {
|
||||
return sourceService.pageQuery(sourceReqQuery);
|
||||
}
|
||||
@Deprecated
|
||||
@ApiOperation("查询视频源列表")
|
||||
@PostMapping("/list")
|
||||
public ApiResponse list(@RequestBody SourceReqQuery sourceReqQuery) {
|
||||
return sourceService.list(sourceReqQuery);
|
||||
}
|
||||
@ApiOperation("查询视频源详情")
|
||||
@GetMapping("getDetail/{id}")
|
||||
public ApiResponse getById(@PathVariable Long id) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
return sourceService.getById(id, worker.getUserId());
|
||||
}
|
||||
@PostMapping("/{id}/cutVideo")
|
||||
@IgnoreToken
|
||||
public ApiResponse cutVideo(@PathVariable("id") Long id) {
|
||||
return sourceService.cutVideo(id);
|
||||
}
|
||||
@ApiOperation("添加视频源")
|
||||
@PostMapping("/add")
|
||||
public ApiResponse add(@RequestBody SourceEntity source) {
|
||||
return sourceService.add(source);
|
||||
}
|
||||
@Deprecated
|
||||
@ApiOperation("删除视频源")
|
||||
@DeleteMapping("/delete/{id}")
|
||||
public ApiResponse deleteById(@PathVariable Long id) {
|
||||
return sourceService.deleteById(id);
|
||||
}
|
||||
@ApiOperation("修改视频源")
|
||||
@PostMapping("/update")
|
||||
public ApiResponse update(@RequestBody SourceEntity source) {
|
||||
return sourceService.update(source);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/task/v1")
|
||||
@Deprecated
|
||||
@Api(tags = "任务列表管理")
|
||||
public class TaskController {
|
||||
|
||||
|
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/video/v1")
|
||||
@Deprecated
|
||||
@Api(tags = "视频成片管理")
|
||||
public class VideoController {
|
||||
|
||||
|
@@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@@ -18,6 +18,7 @@ import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Deprecated
|
||||
@RestController
|
||||
public class ProxyController {
|
||||
@IgnoreToken
|
||||
|
@@ -52,7 +52,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@@ -267,7 +267,7 @@ public class ViidController {
|
||||
}
|
||||
if (shotTime == null) {
|
||||
shotTime = new Date();
|
||||
} else if (Math.abs(shotTime.getTime() - System.currentTimeMillis()) > + 24 * 60 * 60 * 1000) {
|
||||
} else if (Math.abs(shotTime.getTime() - System.currentTimeMillis()) > 24 * 60 * 60 * 1000) {
|
||||
shotTime = new Date();
|
||||
}
|
||||
Long scenicId = device.getScenicId();
|
||||
@@ -380,7 +380,7 @@ public class ViidController {
|
||||
faceSampleMapper.update(faceSample);
|
||||
}
|
||||
}
|
||||
if (deviceConfig != null && Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||
if (Integer.valueOf(1).equals(deviceConfig.getEnablePreBook())) {
|
||||
DynamicTaskGenerator.addTask(faceSample.getId());
|
||||
}
|
||||
});
|
||||
|
@@ -117,6 +117,7 @@ public class VptPassiveStorageOperator extends ADeviceStorageOperator {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
//noinspection BusyWait 得等待
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
return Collections.emptyList();
|
||||
|
@@ -113,6 +113,7 @@ public class WvpPassiveStorageOperator extends ADeviceStorageOperator {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
//noinspection BusyWait 得等待
|
||||
Thread.sleep(1000L);
|
||||
} catch (InterruptedException e) {
|
||||
return Collections.emptyList();
|
||||
|
@@ -2,11 +2,13 @@ package com.ycwl.basic.exception;
|
||||
|
||||
import com.ycwl.basic.enums.BizCodeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author songminsgong
|
||||
* @since 2022-11-23
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class AppException extends RuntimeException {
|
||||
|
||||
|
@@ -2,11 +2,13 @@ package com.ycwl.basic.exception;
|
||||
|
||||
import com.ycwl.basic.enums.BizCodeEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author wenshijia
|
||||
* @date 2021年05月25日 22:41
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class BizException extends RuntimeException {
|
||||
|
||||
|
@@ -10,7 +10,7 @@ import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
@@ -50,13 +50,15 @@ public class CustomExceptionHandle {
|
||||
* 自定义异常统一处理类
|
||||
*/
|
||||
@ExceptionHandler(value = BizException.class)
|
||||
public ApiResponse<String> handle(BizException bizException) {
|
||||
public ApiResponse<String> handle(HttpServletResponse response, BizException bizException) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ApiResponse.buildResponse(bizException.getCode(), bizException.getMsg());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value =IOException.class)
|
||||
public ApiResponse<String> handle(IOException e) {
|
||||
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
|
||||
public ApiResponse<String> handle(HttpServletResponse response, IOException e) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
LOGGER.error("IO异常 -> {}", e.getMessage(), e);
|
||||
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
||||
}
|
||||
|
||||
@@ -64,7 +66,8 @@ public class CustomExceptionHandle {
|
||||
* 异常统一返回处理
|
||||
*/
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public ApiResponse<String> handle(Exception e) {
|
||||
public ApiResponse<String> handle(HttpServletResponse response, Exception e) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
LOGGER.error("系统异常 -> {}", e.getMessage(), e);
|
||||
return ApiResponse.buildResult(BizCodeEnum.SERVER_UNKONWN_ERROR);
|
||||
}
|
||||
@@ -73,7 +76,8 @@ public class CustomExceptionHandle {
|
||||
* 移动端自定义异常统一处理类
|
||||
*/
|
||||
@ExceptionHandler(value = AppException.class)
|
||||
public ApiResponse<String> handle(AppException appException) {
|
||||
public ApiResponse<String> handle(HttpServletResponse response, AppException appException) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ApiResponse.buildResponse(appException.getCode(), appException.getMsg());
|
||||
}
|
||||
|
||||
@@ -81,7 +85,8 @@ public class CustomExceptionHandle {
|
||||
* 移动端自定义异常统一处理类
|
||||
*/
|
||||
@ExceptionHandler(value = HttpMessageNotReadableException.class)
|
||||
public ApiResponse<String> handle(HttpMessageNotReadableException httpMessageNotReadableException) {
|
||||
public ApiResponse<String> handle(HttpServletResponse response, HttpMessageNotReadableException httpMessageNotReadableException) {
|
||||
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
|
||||
return ApiResponse.buildResponse(500, "请求参数格式错误");
|
||||
}
|
||||
|
||||
|
@@ -23,14 +23,11 @@ public class FaceBodyFactory {
|
||||
}
|
||||
|
||||
public static IFaceBodyAdapter getAdapter(FaceBodyAdapterType type) {
|
||||
switch (type) {
|
||||
case ALI:
|
||||
return new AliFaceBodyAdapter();
|
||||
case BCE:
|
||||
return new BceFaceBodyAdapter();
|
||||
default:
|
||||
throw new FaceBodyUnsupportedException("不支持的Adapter类型");
|
||||
}
|
||||
return switch (type) {
|
||||
case ALI -> new AliFaceBodyAdapter();
|
||||
case BCE -> new BceFaceBodyAdapter();
|
||||
default -> throw new FaceBodyUnsupportedException("不支持的Adapter类型");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -62,33 +63,31 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
}
|
||||
|
||||
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
||||
switch (type) {
|
||||
case ADD_DB:
|
||||
return addDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case ADD_ENTITY:
|
||||
return addEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case ADD_FACE:
|
||||
return addFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case LIST_DB:
|
||||
return listDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS));
|
||||
case LIST_FACE:
|
||||
return listFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(2));
|
||||
case SEARCH_FACE:
|
||||
return searchFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(200, TimeUnit.MILLISECONDS));
|
||||
case DELETE_DB:
|
||||
return deleteDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case DELETE_ENTITY:
|
||||
return deleteEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
default:
|
||||
return new FixedRateLimiter(600, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
return switch (type) {
|
||||
case ADD_DB ->
|
||||
addDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case ADD_ENTITY ->
|
||||
addEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case ADD_FACE ->
|
||||
addFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case LIST_DB ->
|
||||
listDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS));
|
||||
case LIST_FACE -> listFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(2));
|
||||
case SEARCH_FACE ->
|
||||
searchFaceLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(200, TimeUnit.MILLISECONDS));
|
||||
case DELETE_DB ->
|
||||
deleteDbLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
case DELETE_ENTITY ->
|
||||
deleteEntityLimiters.computeIfAbsent(config.getAccessKeyId(), k -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS));
|
||||
default -> new FixedRateLimiter(600, TimeUnit.MILLISECONDS);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addFaceDb(String dbName) {
|
||||
IRateLimiter addDbLimiter = getLimiter(LOCK_TYPE.ADD_DB);
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
CreateFaceDbRequest request = new CreateFaceDbRequest();
|
||||
request.setName(dbName);
|
||||
try {
|
||||
@@ -112,7 +111,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
request.setOrder("asc");
|
||||
request.setLimit(200);
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
while (true) {
|
||||
ListFaceEntitiesResponse response = client.getAcsResponse(request);
|
||||
if (response.getData().getTotalCount() == 0) {
|
||||
@@ -151,7 +150,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
public List<String> listFaceDb() {
|
||||
ListFaceDbsRequest request = new ListFaceDbsRequest();
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
ListFaceDbsResponse response = client.getAcsResponse(request);
|
||||
return response.getData().getDbList().stream().map(ListFaceDbsResponse.Data.DbListItem::getName).collect(Collectors.toList());
|
||||
} catch (ClientException e) {
|
||||
@@ -168,7 +167,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
request.setDbName(dbName);
|
||||
request.setEntityId(entityId);
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
try {
|
||||
addEntityLimiter.acquire();
|
||||
} catch (InterruptedException ignored) {
|
||||
@@ -207,7 +206,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
request.setDbName(dbName);
|
||||
request.setEntityId(entityId);
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
try {
|
||||
deleteEntityLimiter.acquire();
|
||||
} catch (InterruptedException ignored) {
|
||||
@@ -231,16 +230,12 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
if (offset != null) {
|
||||
listFaceEntitiesRequest.setOffset(offset);
|
||||
}
|
||||
if (size != null) {
|
||||
listFaceEntitiesRequest.setLimit(size);
|
||||
} else {
|
||||
listFaceEntitiesRequest.setLimit(200);
|
||||
}
|
||||
listFaceEntitiesRequest.setLimit(Objects.requireNonNullElse(size, 200));
|
||||
if (StringUtils.isNotEmpty(prefix)) {
|
||||
listFaceEntitiesRequest.setEntityIdPrefix(prefix);
|
||||
}
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
try {
|
||||
listFaceLimiter.acquire();
|
||||
} catch (InterruptedException ignored) {
|
||||
@@ -260,7 +255,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
SearchFaceResp resp = new SearchFaceResp();
|
||||
IRateLimiter searchFaceLimiter = getLimiter(LOCK_TYPE.SEARCH_FACE);
|
||||
try (ClientWrapper clientWrapper = getClient()) {
|
||||
IAcsClient client = clientWrapper.getClient();
|
||||
IAcsClient client = clientWrapper.client();
|
||||
SearchFaceRequest request = new SearchFaceRequest();
|
||||
request.setDbName(dbName);
|
||||
request.setImageUrl(faceUrl);
|
||||
@@ -276,7 +271,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
resp.setOriginalFaceScore(0f);
|
||||
return resp;
|
||||
}
|
||||
SearchFaceResponse.Data.MatchListItem matchItem = matchList.get(0);
|
||||
SearchFaceResponse.Data.MatchListItem matchItem = matchList.getFirst();
|
||||
resp.setOriginalFaceScore(matchItem.getQualitieScore());
|
||||
resp.setResult(matchItem.getFaceItems().stream().map(item -> {
|
||||
SearchFaceResultItem resultItem = new SearchFaceResultItem();
|
||||
@@ -287,7 +282,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
return resultItem;
|
||||
}).collect(Collectors.toList()));
|
||||
if (!resp.getResult().isEmpty()) {
|
||||
resp.setFirstMatchRate(resp.getResult().get(0).getScore());
|
||||
resp.setFirstMatchRate(resp.getResult().getFirst().getScore());
|
||||
}
|
||||
return resp;
|
||||
} catch (ClientException e) {
|
||||
@@ -304,13 +299,7 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
return new ClientWrapper(client);
|
||||
}
|
||||
|
||||
@Getter
|
||||
public static class ClientWrapper implements AutoCloseable {
|
||||
private final IAcsClient client;
|
||||
|
||||
public ClientWrapper(IAcsClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
public record ClientWrapper(IAcsClient client) implements AutoCloseable {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
@@ -319,7 +308,6 @@ public class AliFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
}
|
||||
client.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
protected enum LOCK_TYPE {
|
||||
ADD_DB,
|
||||
|
@@ -2,13 +2,11 @@ package com.ycwl.basic.facebody.adapter;
|
||||
|
||||
import com.baidu.aip.face.AipFace;
|
||||
import com.ycwl.basic.facebody.entity.AddFaceResp;
|
||||
import com.ycwl.basic.facebody.entity.AliFaceBodyConfig;
|
||||
import com.ycwl.basic.facebody.entity.BceFaceBodyConfig;
|
||||
import com.ycwl.basic.facebody.entity.SearchFaceResp;
|
||||
import com.ycwl.basic.facebody.entity.SearchFaceResultItem;
|
||||
import com.ycwl.basic.utils.ratelimiter.FixedRateLimiter;
|
||||
import com.ycwl.basic.utils.ratelimiter.IRateLimiter;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
@@ -23,7 +21,6 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
@@ -247,13 +244,17 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
if (response.getInt("error_code") == 0) {
|
||||
JSONObject resultObj = response.getJSONObject("result");
|
||||
if (resultObj != null) {
|
||||
JSONArray faceList = resultObj.getJSONArray("face_list");
|
||||
List<String> result = new ArrayList<>();
|
||||
for (int i = 0; i < faceList.length(); i++) {
|
||||
JSONObject jsonObject = faceList.getJSONObject(i);
|
||||
result.add(jsonObject.getString("face_token"));
|
||||
try {
|
||||
JSONArray faceList = resultObj.getJSONArray("face_list");
|
||||
List<String> result = new ArrayList<>();
|
||||
for (int i = 0; i < faceList.length(); i++) {
|
||||
JSONObject jsonObject = faceList.getJSONObject(i);
|
||||
result.add(jsonObject.getString("face_token"));
|
||||
}
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -304,7 +305,7 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
}
|
||||
resp.setResult(result);
|
||||
if (!result.isEmpty()) {
|
||||
resp.setFirstMatchRate(result.get(0).getScore());
|
||||
resp.setFirstMatchRate(result.getFirst().getScore());
|
||||
}
|
||||
return resp;
|
||||
} else {
|
||||
@@ -334,26 +335,25 @@ public class BceFaceBodyAdapter implements IFaceBodyAdapter {
|
||||
}
|
||||
|
||||
private IRateLimiter getLimiter(LOCK_TYPE type) {
|
||||
switch (type) {
|
||||
case ADD_DB:
|
||||
return addDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case ADD_FACE:
|
||||
return addFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getAddQps()));
|
||||
case LIST_DB:
|
||||
return listDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case LIST_FACE:
|
||||
return listFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case SEARCH_FACE:
|
||||
return searchFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getSearchQps()));
|
||||
case DELETE_DB:
|
||||
return deleteDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case DELETE_ENTITY:
|
||||
return deleteEntityLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case DELETE_FACE:
|
||||
return deleteFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
default:
|
||||
return new FixedRateLimiter(500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
return switch (type) {
|
||||
case ADD_DB ->
|
||||
addDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case ADD_FACE ->
|
||||
addFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getAddQps()));
|
||||
case LIST_DB ->
|
||||
listDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case LIST_FACE ->
|
||||
listFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case SEARCH_FACE ->
|
||||
searchFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(config.getSearchQps()));
|
||||
case DELETE_DB ->
|
||||
deleteDbLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case DELETE_ENTITY ->
|
||||
deleteEntityLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
case DELETE_FACE ->
|
||||
deleteFaceLimiters.computeIfAbsent(config.getAppId(), k -> new FixedRateLimiter(105, TimeUnit.MILLISECONDS));
|
||||
default -> new FixedRateLimiter(500, TimeUnit.MILLISECONDS);
|
||||
};
|
||||
}
|
||||
|
||||
protected enum LOCK_TYPE {
|
||||
|
@@ -16,15 +16,11 @@ public class ImageWatermarkFactory {
|
||||
return get(type);
|
||||
}
|
||||
public static IOperator get(ImageWatermarkOperatorEnum type) {
|
||||
switch (type) {
|
||||
case WATERMARK:
|
||||
return new DefaultImageWatermarkOperator();
|
||||
case NORMAL:
|
||||
return new NormalWatermarkOperator();
|
||||
case LEICA:
|
||||
return new LeicaWatermarkOperator();
|
||||
default:
|
||||
throw new ImageWatermarkUnsupportedException("不支持的类型"+type.name());
|
||||
}
|
||||
return switch (type) {
|
||||
case WATERMARK -> new DefaultImageWatermarkOperator();
|
||||
case NORMAL -> new NormalWatermarkOperator();
|
||||
case LEICA -> new LeicaWatermarkOperator();
|
||||
default -> throw new ImageWatermarkUnsupportedException("不支持的类型" + type.name());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -106,13 +106,13 @@ public class LeicaWatermarkOperator implements IOperator {
|
||||
int dtLineHeight = datetimeFontMetrics.getHeight();
|
||||
int scenicLineWidth = scenicFontMetrics.stringWidth(info.getScenicLine());
|
||||
int datetimeLineWidth = scenicFontMetrics.stringWidth(info.getDatetimeLine());
|
||||
g2d.drawImage(qrcodeImage, newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y, newQrcodeWidth, newQrcodeHeight, null);
|
||||
g2d.drawImage(qrcodeImage, newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - newQrcodeWidth - QRCODE_OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + OFFSET_Y, newQrcodeWidth, newQrcodeHeight, null);
|
||||
g2d.setFont(scenicFont);
|
||||
g2d.setColor(scenicColor);
|
||||
g2d.drawString(info.getScenicLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y + scenicLineHeight + scenicLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
||||
g2d.drawString(info.getScenicLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + OFFSET_Y + scenicLineHeight + scenicLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
||||
g2d.setFont(datetimeFont);
|
||||
g2d.setColor(datetimeColor);
|
||||
g2d.drawString(info.getDatetimeLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + + OFFSET_Y + scenicLineHeight + dtLineHeight + dtLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
||||
g2d.drawString(info.getDatetimeLine(), newImage.getWidth() + EXTRA_BORDER_PX - OFFSET_X - Math.max(scenicLineWidth, datetimeLineWidth), EXTRA_BORDER_PX + baseImage.getHeight() + OFFSET_Y + scenicLineHeight + dtLineHeight + dtLineHeight * FONT_GLOBAL_OFFSET_PERCENT);
|
||||
String fileName = info.getWatermarkedFile().getName();
|
||||
String formatName = "jpg"; // 默认格式为 jpg
|
||||
if (fileName.endsWith(".png")) {
|
||||
|
@@ -7,6 +7,7 @@ import com.ycwl.basic.constant.PermissionConstant;
|
||||
import com.ycwl.basic.constant.RequestConstant;
|
||||
import com.ycwl.basic.exception.CheckTokenException;
|
||||
import com.ycwl.basic.exception.MissTokenException;
|
||||
import com.ycwl.basic.exception.PermissionException;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,37 +16,36 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AuthInterceptor extends HandlerInterceptorAdapter {
|
||||
public class AuthInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
if (!(handler instanceof HandlerMethod)) {
|
||||
return super.preHandle(request, response, handler);
|
||||
if (!(handler instanceof HandlerMethod handlerMethod)) {
|
||||
return true;
|
||||
}
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
// 获取类上面的注解
|
||||
IgnoreToken ignoreClassToken = handlerMethod.getBeanType().getAnnotation(IgnoreToken.class);
|
||||
// 获取方法上的注解
|
||||
IgnoreToken ignoreMethodToken = handlerMethod.getMethodAnnotation(IgnoreToken.class);
|
||||
if (ignoreClassToken != null || ignoreMethodToken != null) {
|
||||
// 放行
|
||||
return super.preHandle(request, response, handler);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 放行白名单
|
||||
@@ -113,7 +113,6 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
BaseContextHandler.remove();
|
||||
super.afterCompletion(request, response, handler, ex);
|
||||
}
|
||||
|
||||
public String getToken(HttpServletRequest request) {
|
||||
|
@@ -30,7 +30,7 @@ public interface DeviceMapper {
|
||||
DeviceEntity getByDeviceId(Long deviceId);
|
||||
List<DeviceRespVO> listByScenicIdWithWVP(Long scenicId);
|
||||
|
||||
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId,@Param("userId") Long userId);
|
||||
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId);
|
||||
|
||||
DeviceConfigEntity getConfigByDeviceId(Long deviceId);
|
||||
int addConfig(DeviceConfigEntity deviceConfigEntity);
|
||||
|
@@ -36,5 +36,5 @@ public interface FaceMapper {
|
||||
|
||||
List<FaceRespVO> listByScenicAndUserId(String scenicId, Long userId);
|
||||
|
||||
List<FaceEntity> listEntityBeforeDate(Long scenicId, Date endDate);
|
||||
List<FaceEntity> listUnpaidEntityBeforeDate(Long scenicId, Date endDate);
|
||||
}
|
||||
|
10
src/main/java/com/ycwl/basic/mapper/PrintTaskMapper.java
Normal file
10
src/main/java/com/ycwl/basic/mapper/PrintTaskMapper.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface PrintTaskMapper extends BaseMapper<PrintTaskEntity> {
|
||||
int insertTask(PrintTaskEntity entity);
|
||||
}
|
@@ -42,4 +42,12 @@ public interface PrinterMapper {
|
||||
int setPhotoCropped(Long memberId, Long scenicId, Long id, String url);
|
||||
|
||||
int setPhotoQuantity(Long memberId, Long scenicId, Long id, Integer quantity);
|
||||
|
||||
List<MemberPrintResp> getUserPhotoByIds(List<Long> ids);
|
||||
|
||||
int setUserIsBuyItem(Long memberId, Long id, Long orderId);
|
||||
|
||||
void updateUserPhotoListToPrinter(Long memberId, Long scenicId, Integer printerId);
|
||||
|
||||
List<MemberPrintResp> listRelationByOrderId(Long orderId);
|
||||
}
|
@@ -0,0 +1,25 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
|
||||
import com.ycwl.basic.model.pc.scenicDeviceStats.entity.ScenicDeviceStatsEntity;
|
||||
import com.ycwl.basic.model.pc.scenicDeviceStats.resp.ScenicDeviceStatsResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 景区设备统计Mapper接口
|
||||
*/
|
||||
public interface ScenicDeviceStatsMapper {
|
||||
/**
|
||||
* 插入景区设备统计记录
|
||||
* @param stats 景区设备统计对象
|
||||
* @return 影响行数
|
||||
*/
|
||||
int insert(@Param("stats") ScenicDeviceStatsEntity stats);
|
||||
|
||||
List<ScenicDeviceStatsEntity> countDeviceStats(Date start, Date end);
|
||||
|
||||
List<ScenicDeviceStatsResp> countCachedStatsByScenicId(Long scenicId, Date start, Date end);
|
||||
List<ScenicDeviceStatsResp> countRealtimeStatsByScenicId(Long scenicId, Date start, Date end);
|
||||
}
|
@@ -79,4 +79,6 @@ public interface SourceMapper {
|
||||
List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);
|
||||
|
||||
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
|
||||
|
||||
int deleteUselessSource();
|
||||
}
|
||||
|
@@ -54,4 +54,6 @@ public interface VideoMapper {
|
||||
int deleteNotBuyRelations(Long scenicId, Date endDate);
|
||||
|
||||
int deleteNotBuyFaceRelations(Long userId, Long faceId);
|
||||
|
||||
int deleteUselessVideo();
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -18,6 +19,7 @@ import java.time.LocalDateTime;
|
||||
@ToString
|
||||
public class JwtInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5452605590172369563L;
|
||||
|
||||
/**
|
||||
|
@@ -4,6 +4,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 16:33
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "移动端订单查询对象")
|
||||
public class OrderAppPageReq extends BaseQueryParameterReq {
|
||||
|
@@ -4,7 +4,9 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "后台管理人员请求VO")
|
||||
public class AdminUserListReqVO extends BaseQueryParameterReq {
|
||||
|
@@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "")
|
||||
@ApiModel()
|
||||
public class UpdatePasswordReqVO {
|
||||
@ApiModelProperty(value = "id",hidden = true)
|
||||
private String id;
|
||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/12 10:00
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("查询推客记录请求参数")
|
||||
public class BrokerRecordReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:29
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("查询推客列表请求参数")
|
||||
public class BrokerReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -12,6 +13,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:53
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("设备查询参数")
|
||||
public class DeviceReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -8,6 +8,6 @@ public class DeviceSortRequest {
|
||||
@ApiModelProperty(value = "被操作模板的ID", required = true)
|
||||
private Long deviceId;
|
||||
|
||||
@ApiModelProperty(value = "排在其后的模板ID", required = false)
|
||||
@ApiModelProperty(value = "排在其后的模板ID")
|
||||
private Long afterDeviceId;
|
||||
}
|
@@ -5,6 +5,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:16
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("人脸查询参数")
|
||||
public class FaceReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -7,6 +7,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -14,6 +15,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:40
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("人脸样本查询参数")
|
||||
public class FaceSampleReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -13,6 +14,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 15:59
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("查询用户列表请求参数")
|
||||
public class MemberReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -7,6 +7,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 16:33
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "订单查询对象")
|
||||
public class OrderReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -6,12 +6,14 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("permission")
|
||||
public class PermissionEntity implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
|
@@ -13,6 +13,7 @@ public class MemberPrintResp {
|
||||
private String origUrl;
|
||||
private String cropUrl;
|
||||
private Integer quantity;
|
||||
private Integer printerId;
|
||||
private Long orderId;
|
||||
private Integer status;
|
||||
private Date createTime;
|
||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @Date:2024/11/29 17:24
|
||||
* 渲染机管理表
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("渲染机列表查询参数")
|
||||
public class RenderWorkerReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -4,7 +4,9 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "角色请求列表VO")
|
||||
public class RoleListReqVO extends BaseQueryParameterReq {
|
||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @Date:2024/12/02 10:24
|
||||
* 景区管理表
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("景区列表查询参数")
|
||||
public class ScenicReqQuery extends BaseQueryParameterReq {
|
||||
|
16
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/entity/ScenicDeviceStatsEntity.java
Normal file
16
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/entity/ScenicDeviceStatsEntity.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.ycwl.basic.model.pc.scenicDeviceStats.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 景区设备统计实体类
|
||||
*/
|
||||
@Data
|
||||
public class ScenicDeviceStatsEntity {
|
||||
private Long scenicId;
|
||||
private Long deviceId;
|
||||
private Date date;
|
||||
private Integer count;
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.ycwl.basic.model.pc.scenicDeviceStats.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DeviceStatsReq {
|
||||
private Date startTime;
|
||||
private Date endTime;
|
||||
}
|
11
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/resp/ScenicDeviceStatsListResp.java
Normal file
11
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/resp/ScenicDeviceStatsListResp.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.ycwl.basic.model.pc.scenicDeviceStats.resp;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ScenicDeviceStatsListResp {
|
||||
private List<ScenicDeviceStatsResp> data;
|
||||
private boolean realtime;
|
||||
}
|
17
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/resp/ScenicDeviceStatsResp.java
Normal file
17
src/main/java/com/ycwl/basic/model/pc/scenicDeviceStats/resp/ScenicDeviceStatsResp.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.ycwl.basic.model.pc.scenicDeviceStats.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ScenicDeviceStatsResp {
|
||||
private Long scenicId;
|
||||
private String scenicName;
|
||||
private Long deviceId;
|
||||
private String deviceName;
|
||||
private Integer count;
|
||||
private BigDecimal rate;
|
||||
}
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -15,6 +16,7 @@ import java.util.Date;
|
||||
* @Date:2024/12/02 11:29
|
||||
* 视频源
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel(value = "视频源查询对象")
|
||||
public class SourceReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -14,6 +15,7 @@ import java.util.Date;
|
||||
* @Date:2024/12/02 14:10
|
||||
* 任务列表
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("任务列表查询参数")
|
||||
public class TaskReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@@ -16,6 +17,7 @@ import java.util.Date;
|
||||
* @Date:2024/12/02 14:10
|
||||
* 模版
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("模版查询请求类")
|
||||
public class TemplateReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -8,6 +8,6 @@ public class TemplateSortRequest {
|
||||
@ApiModelProperty(value = "被操作模板的ID", required = true)
|
||||
private Long templateId;
|
||||
|
||||
@ApiModelProperty(value = "排在其后的模板ID", required = false)
|
||||
@ApiModelProperty(value = "排在其后的模板ID")
|
||||
private Long afterTemplateId;
|
||||
}
|
@@ -6,6 +6,7 @@ import com.ycwl.basic.model.common.BaseQueryParameterReq;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@@ -14,6 +15,7 @@ import java.util.Date;
|
||||
* @Date:2024/12/2 15:28
|
||||
* 视频成片
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ApiModel("成片查询请求类")
|
||||
public class VideoReqQuery extends BaseQueryParameterReq {
|
||||
|
@@ -0,0 +1,10 @@
|
||||
package com.ycwl.basic.model.printer.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FromSourceReq {
|
||||
List<Long> ids;
|
||||
}
|
@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,7 @@ public class UniqueId implements Serializable {
|
||||
* 固定 + 时间戳 + 工作机器ID + 数据中心ID + 序列号
|
||||
*/
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8632670752020316524L;
|
||||
|
||||
/**
|
||||
|
@@ -1,24 +0,0 @@
|
||||
package com.ycwl.basic.model.wx;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 微信获取token对象
|
||||
* @author: chenxi
|
||||
* @date: 2021/8/5 20:50
|
||||
*/
|
||||
@Data
|
||||
public class WechatAccessTokenVO extends WechatBaseVO{
|
||||
|
||||
/**
|
||||
* 微信access_token,由于微信接口返回数据,此处无法保证驼峰命名
|
||||
*/
|
||||
private String access_token;
|
||||
|
||||
/**
|
||||
* 过期时间,单位秒
|
||||
*/
|
||||
private Integer expires_in;
|
||||
|
||||
|
||||
}
|
@@ -1,7 +1,6 @@
|
||||
package com.ycwl.basic.model.wx;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -16,7 +15,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class WxchatCallbackSuccessData {
|
||||
public class WechatCallbackSuccessData {
|
||||
|
||||
/**
|
||||
* 商户订单号
|
||||
@@ -58,12 +57,4 @@ public class WxchatCallbackSuccessData {
|
||||
private BigDecimal totalMoney;
|
||||
|
||||
|
||||
public Date getSuccessTime() {
|
||||
return successTime;
|
||||
}
|
||||
|
||||
public void setSuccessTime(String successTime) {
|
||||
// Hutool工具包的方法,自动识别一些常用格式的日期字符串
|
||||
this.successTime = DateUtil.parse(successTime);
|
||||
}
|
||||
}
|
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,7 @@ import java.io.Serializable;
|
||||
@Accessors(chain = true)
|
||||
public class WxPayRespVO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean needPay = true;
|
||||
/**
|
||||
|
@@ -10,14 +10,11 @@ import java.util.Map;
|
||||
|
||||
public class NotifyFactory {
|
||||
public static INotifyAdapter get(NotifyType type) {
|
||||
switch (type) {
|
||||
case SERVER_CHAN:
|
||||
return new ServerChanNotifyAdapter();
|
||||
case WX_MP_SRV:
|
||||
return new WxMpSrvNotifyAdapter();
|
||||
default:
|
||||
throw new RuntimeException("不支持的通知类型");
|
||||
}
|
||||
return switch (type) {
|
||||
case SERVER_CHAN -> new ServerChanNotifyAdapter();
|
||||
case WX_MP_SRV -> new WxMpSrvNotifyAdapter();
|
||||
default -> throw new RuntimeException("不支持的通知类型");
|
||||
};
|
||||
}
|
||||
|
||||
public static INotifyAdapter get(NotifyType type, Map<String, String> config) {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.pay;
|
||||
|
||||
import com.ycwl.basic.pay.adapter.CongMingPayAdapter;
|
||||
import com.ycwl.basic.pay.adapter.IPayAdapter;
|
||||
import com.ycwl.basic.pay.adapter.WxMpPayAdapter;
|
||||
import com.ycwl.basic.pay.enums.PayAdapterType;
|
||||
@@ -8,6 +9,7 @@ import com.ycwl.basic.pay.exceptions.PayUnsupportedException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PayFactory {
|
||||
|
||||
@@ -22,12 +24,11 @@ public class PayFactory {
|
||||
}
|
||||
|
||||
public static IPayAdapter getAdapter(PayAdapterType type) {
|
||||
switch (type) {
|
||||
case WX_MP_PAY:
|
||||
return new WxMpPayAdapter();
|
||||
default:
|
||||
throw new PayUnsupportedException("不支持的Adapter类型");
|
||||
}
|
||||
return switch (type) {
|
||||
case WX_MP_PAY -> new WxMpPayAdapter();
|
||||
case CONG_MING_PAY -> new CongMingPayAdapter();
|
||||
default -> throw new PayUnsupportedException("不支持的Adapter类型");
|
||||
};
|
||||
}
|
||||
|
||||
protected static Map<String, IPayAdapter> namedAdapter = new HashMap<>();
|
||||
|
240
src/main/java/com/ycwl/basic/pay/adapter/CongMingPayAdapter.java
Normal file
240
src/main/java/com/ycwl/basic/pay/adapter/CongMingPayAdapter.java
Normal file
@@ -0,0 +1,240 @@
|
||||
package com.ycwl.basic.pay.adapter;
|
||||
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ycwl.basic.pay.entity.CancelOrderRequest;
|
||||
import com.ycwl.basic.pay.entity.CongMingPayConfig;
|
||||
import com.ycwl.basic.pay.entity.CreateOrderRequest;
|
||||
import com.ycwl.basic.pay.entity.CreateOrderResponse;
|
||||
import com.ycwl.basic.pay.entity.PayResponse;
|
||||
import com.ycwl.basic.pay.entity.RefundOrderRequest;
|
||||
import com.ycwl.basic.pay.entity.RefundOrderResponse;
|
||||
import com.ycwl.basic.pay.entity.RefundResponse;
|
||||
import com.ycwl.basic.pay.exceptions.PayException;
|
||||
import jakarta.servlet.ServletInputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CongMingPayAdapter implements IPayAdapter {
|
||||
private CongMingPayConfig config;
|
||||
private static final String MP_PAY_URI = "/api/hFivePay.do";
|
||||
private static final String QUERY_ORDER_URI = "/api/query.do";
|
||||
private static final String REFUND_ORDER_URI = "/api/refund.do";
|
||||
private static final String CANCEL_ORDER_URI = "/api/userCancelOrder.do";
|
||||
|
||||
public CongMingPayAdapter() {
|
||||
|
||||
}
|
||||
|
||||
public CongMingPayAdapter(CongMingPayConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadConfig(Map<String, String> config) {
|
||||
this.config = new CongMingPayConfig();
|
||||
this.config.setProgramId(config.get("programId"));
|
||||
this.config.setShopId(config.get("shopId"));
|
||||
this.config.setApiKey(config.get("apiKey"));
|
||||
this.config.setApiHost(config.get("apiHost"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreateOrderResponse createOrder(CreateOrderRequest request) {
|
||||
CreateOrderResponse resp = new CreateOrderResponse();
|
||||
if (request.getPrice() <= 0) {
|
||||
resp.setSkipPay(true);
|
||||
return resp;
|
||||
}
|
||||
String url = config.getApiHost() + MP_PAY_URI;
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("program_id", config.getProgramId());
|
||||
params.put("shop_id", config.getShopId());
|
||||
params.put("money", request.getPriceInYuan().toString());
|
||||
params.put("order_id", request.getOrderNo());
|
||||
if (StringUtils.isNotBlank(request.getGoodsName())) {
|
||||
params.put("goods_msg", request.getGoodsName());
|
||||
}
|
||||
params.put("device", "AI旅拍");
|
||||
params.put("notify_url", request.getNotifyUrl());
|
||||
params.put("s_source", "mini_app");
|
||||
params.put("sign", parseSign(params, config.getApiKey()));
|
||||
System.out.println(url);
|
||||
System.out.println(JSON.toJSONString(params));
|
||||
String response = HttpUtil.post(url, JSON.toJSONString(params));
|
||||
JSONObject json = JSONObject.parseObject(response);
|
||||
System.out.println(json);
|
||||
if (StringUtils.equals(json.getString("result_code"), "fail")) {
|
||||
throw new PayException("查询异常!异常提示:" + json.getString("error_msg"));
|
||||
}
|
||||
resp.setSkipPay(false);
|
||||
resp.setSuccess(true);
|
||||
resp.setOrderNo(json.getString("order_id"));
|
||||
resp.setExtData(json.toJavaObject(Map.class));
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getPaymentParams(CreateOrderResponse response) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (response.isSkipPay()) {
|
||||
result.put("skipPay", true);
|
||||
return result;
|
||||
}
|
||||
if (response.getExtData() == null) {
|
||||
throw new PayException("查询异常!异常提示:" + "订单信息异常");
|
||||
}
|
||||
result.put("payWay", "embeddedApp");
|
||||
result.put("appId", response.getExtData().get("appid"));
|
||||
result.put("path", response.getExtData().get("path"));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayResponse handleCallback(HttpServletRequest request) throws IOException {
|
||||
String moneyStr = request.getParameter("money");
|
||||
String orderId = request.getParameter("orderId");
|
||||
String resultCode = request.getParameter("result_code");
|
||||
PayResponse resp = new PayResponse();
|
||||
resp.setPayPriceInYuan(new BigDecimal(moneyStr));
|
||||
resp.setOrderNo(orderId);
|
||||
if (StringUtils.equalsIgnoreCase("success", resultCode)) {
|
||||
resp.setState(PayResponse.PAY_STATE.SUCCESS);
|
||||
} else {
|
||||
resp.setState(PayResponse.PAY_STATE.FAIL);
|
||||
}
|
||||
resp.setCustomResponse("success");
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PayResponse queryOrder(String orderNo) {
|
||||
PayResponse resp = new PayResponse();
|
||||
String url = config.getApiHost() + QUERY_ORDER_URI;
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("program_id", config.getProgramId());
|
||||
params.put("shop_id", config.getShopId());
|
||||
params.put("order_id", orderNo);
|
||||
params.put("sign", parseSign(params, config.getApiKey()));
|
||||
String response = HttpUtil.post(url, JSON.toJSONString(params));
|
||||
JSONObject json = JSONObject.parseObject(response);
|
||||
System.out.println(json);
|
||||
if (StringUtils.equals(json.getString("result_code"), "fail")) {
|
||||
throw new PayException("查询异常!异常提示:" + json.getString("error_msg"));
|
||||
}
|
||||
resp.setOriginalResponse(json);
|
||||
resp.setValid(true);
|
||||
resp.setOrderPriceInYuan(json.getBigDecimal("pay_ble"));
|
||||
resp.setPayPriceInYuan(json.getBigDecimal("paid_out"));
|
||||
resp.setOrderNo(json.getString("order_id"));
|
||||
switch (json.getString("order_status")) {
|
||||
case "2":
|
||||
resp.setState(PayResponse.PAY_STATE.NOT_PAY);
|
||||
break;
|
||||
case "1":
|
||||
resp.setState(PayResponse.PAY_STATE.SUCCESS);
|
||||
resp.setPayTime(json.getString("time_end"));
|
||||
break;
|
||||
case "0":
|
||||
resp.setState(PayResponse.PAY_STATE.FAIL);
|
||||
break;
|
||||
default:
|
||||
resp.setState(PayResponse.PAY_STATE.CANCEL);
|
||||
break;
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RefundOrderResponse refund(RefundOrderRequest request) {
|
||||
RefundOrderResponse resp = new RefundOrderResponse();
|
||||
if (request.getPrice() <= 0) {
|
||||
resp.setSuccess(true);
|
||||
return resp;
|
||||
}
|
||||
String url = config.getApiHost() + REFUND_ORDER_URI;
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("program_id", config.getProgramId());
|
||||
params.put("shop_id", config.getShopId());
|
||||
params.put("shop_order_id", request.getOrderNo());
|
||||
params.put("money", request.getRefundPriceInYuan().toString());
|
||||
params.put("refund_order_id", request.getRefundNo());
|
||||
params.put("sign", parseSign(params, config.getApiKey()));
|
||||
String response = HttpUtil.post(url, JSON.toJSONString(params));
|
||||
JSONObject json = JSONObject.parseObject(response);
|
||||
System.out.println(json);
|
||||
if (StringUtils.equalsIgnoreCase(json.getString("result_code"), "fail")) {
|
||||
throw new PayException("退款异常!异常提示:" + json.getString("error_msg"));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RefundResponse handleRefundCallback(HttpServletRequest request) throws IOException {
|
||||
String moneyStr = request.getParameter("money");
|
||||
String orderId = request.getParameter("orderId");
|
||||
String resultCode = request.getParameter("result_code");
|
||||
RefundResponse resp = new RefundResponse();
|
||||
resp.setValid(true);
|
||||
resp.setRefundPriceInYuan(new BigDecimal(moneyStr));
|
||||
resp.setOrderNo(orderId);
|
||||
if (StringUtils.equals("success", resultCode)) {
|
||||
resp.setSuccess();
|
||||
} else {
|
||||
resp.setFail();
|
||||
}
|
||||
resp.setCustomResponse("success");
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RefundResponse checkRefundStatus(String refundNo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelOrder(CancelOrderRequest request) {
|
||||
String url = config.getApiHost() + CANCEL_ORDER_URI;
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("program_id", config.getProgramId());
|
||||
params.put("shop_id", config.getShopId());
|
||||
params.put("order_id", request.getOrderNo());
|
||||
params.put("error_msg", request.getReason());
|
||||
params.put("sign", parseSign(params, config.getApiKey()));
|
||||
String response = HttpUtil.post(url, JSON.toJSONString(params));
|
||||
JSONObject json = JSONObject.parseObject(response);
|
||||
if (StringUtils.equals(json.getString("result_code"), "fail")) {
|
||||
throw new PayException("取消订单异常!异常提示:" + json.getString("error_msg"));
|
||||
}
|
||||
}
|
||||
|
||||
public static String parseSign(Map<String, Object> map, String key) {
|
||||
Collection<String> keyset = map.keySet();
|
||||
List<String> list = new ArrayList<>(keyset);
|
||||
Collections.sort(list);
|
||||
StringBuilder signStr = new StringBuilder();
|
||||
for (String key1 : list) {
|
||||
signStr.append(key1).append("=").append(map.get(key1)).append("&");
|
||||
}
|
||||
signStr.append("key=").append(key);
|
||||
return SecureUtil.md5(signStr.toString()).toUpperCase();
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@ import com.ycwl.basic.pay.entity.RefundResponse;
|
||||
import com.ycwl.basic.pay.entity.RefundOrderRequest;
|
||||
import com.ycwl.basic.pay.entity.RefundOrderResponse;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.ycwl.basic.pay.adapter;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.wechat.pay.java.core.Config;
|
||||
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
|
||||
import com.wechat.pay.java.core.RSAPublicKeyConfig;
|
||||
@@ -32,10 +33,9 @@ import com.ycwl.basic.pay.entity.RefundOrderResponse;
|
||||
import com.ycwl.basic.pay.entity.WxMpPayConfig;
|
||||
import com.ycwl.basic.pay.exceptions.PayWrongConfigException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.Base64Utils;
|
||||
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.ServletInputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -161,7 +161,7 @@ public class WxMpPayAdapter implements IPayAdapter {
|
||||
@Override
|
||||
public PayResponse handleCallback(HttpServletRequest request) throws IOException {
|
||||
ServletInputStream inputStream = request.getInputStream();
|
||||
StringBuffer body = new StringBuffer();
|
||||
StringBuilder body = new StringBuilder();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String s;
|
||||
// 读取回调请求体
|
||||
@@ -277,7 +277,7 @@ public class WxMpPayAdapter implements IPayAdapter {
|
||||
@Override
|
||||
public RefundResponse handleRefundCallback(HttpServletRequest request) throws IOException {
|
||||
ServletInputStream inputStream = request.getInputStream();
|
||||
StringBuffer body = new StringBuffer();
|
||||
StringBuilder body = new StringBuilder();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String s;
|
||||
// 读取回调请求体
|
||||
@@ -363,6 +363,6 @@ public class WxMpPayAdapter implements IPayAdapter {
|
||||
Signature sign = Signature.getInstance("SHA256withRSA");
|
||||
sign.initSign(merchantPrivateKey);
|
||||
sign.update(signatureStr.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64Utils.encodeToString(sign.sign());
|
||||
return Base64.encode(sign.sign());
|
||||
}
|
||||
}
|
||||
|
@@ -7,4 +7,5 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
public class CancelOrderRequest {
|
||||
private String orderNo;
|
||||
private String reason = "取消订单";
|
||||
}
|
||||
|
@@ -0,0 +1,11 @@
|
||||
package com.ycwl.basic.pay.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CongMingPayConfig {
|
||||
private String programId;
|
||||
private String shopId;
|
||||
private String apiKey;
|
||||
private String apiHost = "https://api.congmingpay.com";
|
||||
}
|
@@ -2,9 +2,12 @@ package com.ycwl.basic.pay.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class CreateOrderResponse {
|
||||
private boolean success;
|
||||
private boolean skipPay;
|
||||
private String orderNo;
|
||||
private Map<String, Object> extData;
|
||||
}
|
||||
|
@@ -1,16 +1,22 @@
|
||||
package com.ycwl.basic.pay.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class PayResponse {
|
||||
private boolean valid;
|
||||
private String orderNo;
|
||||
@JsonIgnore
|
||||
private Object originalResponse;
|
||||
private Integer orderPrice;
|
||||
private Integer payPrice;
|
||||
private PAY_STATE state;
|
||||
private String payTime;
|
||||
@JsonIgnore
|
||||
private String customResponse;
|
||||
|
||||
public boolean isPay() {
|
||||
return state == PAY_STATE.SUCCESS;
|
||||
@@ -24,8 +30,17 @@ public class PayResponse {
|
||||
return state == PAY_STATE.REFUND;
|
||||
}
|
||||
|
||||
public void setPayPriceInYuan(BigDecimal money) {
|
||||
payPrice = money.multiply(BigDecimal.valueOf(100)).intValue();
|
||||
}
|
||||
|
||||
public void setOrderPriceInYuan(BigDecimal money) {
|
||||
orderPrice = money.multiply(BigDecimal.valueOf(100)).intValue();
|
||||
}
|
||||
|
||||
public enum PAY_STATE {
|
||||
SUCCESS,
|
||||
NOT_PAY,
|
||||
CANCEL,
|
||||
REFUND,
|
||||
FAIL,
|
||||
|
@@ -3,6 +3,9 @@ package com.ycwl.basic.pay.entity;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RefundOrderRequest {
|
||||
@@ -11,4 +14,12 @@ public class RefundOrderRequest {
|
||||
private String orderNo;
|
||||
private String refundNo;
|
||||
private String notifyUrl;
|
||||
|
||||
public BigDecimal getRefundPriceInYuan() {
|
||||
return new BigDecimal(BigInteger.valueOf(refundPrice), 2);
|
||||
}
|
||||
|
||||
public void setRefundPriceInYuan(BigDecimal refundPriceInYuan) {
|
||||
this.refundPrice = refundPriceInYuan.multiply(BigDecimal.valueOf(100)).intValue();
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,23 @@
|
||||
package com.ycwl.basic.pay.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class RefundResponse {
|
||||
private boolean valid;
|
||||
private String orderNo;
|
||||
private String refundNo;
|
||||
@JsonIgnore
|
||||
private Object originalResponse;
|
||||
private Integer orderPrice;
|
||||
private Integer refundPrice;
|
||||
private PAY_STATE state;
|
||||
private String refundTime;
|
||||
@JsonIgnore
|
||||
private String customResponse;
|
||||
|
||||
public void setSuccess() {
|
||||
state = PAY_STATE.SUCCESS;
|
||||
@@ -21,6 +27,10 @@ public class RefundResponse {
|
||||
state = PAY_STATE.FAIL;
|
||||
}
|
||||
|
||||
public void setRefundPriceInYuan(BigDecimal bigDecimal) {
|
||||
refundPrice = bigDecimal.multiply(BigDecimal.valueOf(100)).intValue();
|
||||
}
|
||||
|
||||
public enum PAY_STATE {
|
||||
SUCCESS,
|
||||
FAIL
|
||||
|
@@ -1,20 +1,17 @@
|
||||
package com.ycwl.basic.pay.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum PayAdapterType {
|
||||
WX_MP_PAY("WX_MP_PAY"),
|
||||
CONG_MING_PAY("CONG_MING_PAY"),
|
||||
;
|
||||
|
||||
private String type;
|
||||
private final String type;
|
||||
|
||||
PayAdapterType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ public class FeiETicketPrinter {
|
||||
|
||||
HttpRequest post = HttpUtil.createPost(URL);
|
||||
post.header("Content-Type", "application/x-www-form-urlencoded");
|
||||
Map<String, Object> body = new HashMap<String, Object>();
|
||||
Map<String, Object> body = new HashMap<>();
|
||||
body.put("user",USER);
|
||||
String STIME = String.valueOf(System.currentTimeMillis()/1000);
|
||||
body.put("stime",STIME);
|
||||
|
@@ -45,12 +45,10 @@ public class ProfitSharingBiz {
|
||||
userAmount = amount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = amount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else if (user.getRateMode() == 3) { // 固定抽成
|
||||
} else { // 固定抽成
|
||||
userAmount = user.getRealRate();
|
||||
wxAmount = user.getWxRate();
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
@@ -77,13 +75,10 @@ public class ProfitSharingBiz {
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 2) { // 扣除固定抽成后的动态比例
|
||||
userAmount = mode2RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode2RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// 扣除固定抽成后的动态比例
|
||||
userAmount = mode2RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode2RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
@@ -109,13 +104,10 @@ public class ProfitSharingBiz {
|
||||
BigDecimal userAmount;
|
||||
BigDecimal wxAmount;
|
||||
BigDecimal manualAmount;
|
||||
if (user.getRateMode() == 4) { // 扣除其他所有类型抽成后的动态比例
|
||||
userAmount = mode4RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode4RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
// 扣除其他所有类型抽成后的动态比例
|
||||
userAmount = mode4RemainAmount.multiply(user.getRealRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
wxAmount = mode4RemainAmount.multiply(user.getWxRate()).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_DOWN);
|
||||
manualAmount = userAmount.subtract(wxAmount);
|
||||
ProfitSharingRecord record = new ProfitSharingRecord();
|
||||
record.setScenicId(scenicId);
|
||||
record.setOrderId(orderId);
|
||||
|
@@ -5,7 +5,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ProfitSharingConfigVO extends ProfitSharingConfig {
|
||||
private String scenicName;
|
||||
}
|
||||
|
@@ -66,7 +66,7 @@ public class ProfitSharingRecordServiceImpl implements ProfitSharingRecordServic
|
||||
map.put(item.getUserName(), item);
|
||||
});
|
||||
ProfitSharingTableRecordVO vo = new ProfitSharingTableRecordVO();
|
||||
ProfitSharingRecordRespVO recordRespVO = value.get(0);
|
||||
ProfitSharingRecordRespVO recordRespVO = value.getFirst();
|
||||
vo.setOrderId(recordRespVO.getOrderId());
|
||||
vo.setScenicId(recordRespVO.getScenicId());
|
||||
vo.setScenicName(recordRespVO.getScenicName());
|
||||
|
@@ -52,7 +52,7 @@ public interface AppMemberService {
|
||||
ApiResponse<?> agreement();
|
||||
|
||||
|
||||
ApiResponse updateScenicServiceNoticeStatus(Long scenicId);
|
||||
ApiResponse<String> updateScenicServiceNoticeStatus(Long scenicId);
|
||||
|
||||
ApiResponse<Integer> getScenicServiceNoticeStatus(Long scenicId);
|
||||
}
|
||||
|
@@ -22,5 +22,5 @@ public interface AppStatisticsService {
|
||||
|
||||
ApiResponse<AppStatisticsFunnelVO> userConversionFunnel(CommonQueryReq query);
|
||||
|
||||
ApiResponse addStatistics(StatisticsRecordAddReq req);
|
||||
ApiResponse<String> addStatistics(StatisticsRecordAddReq req);
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package com.ycwl.basic.service.mobile;
|
||||
|
||||
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
||||
import com.ycwl.basic.model.wx.WxchatCallbackSuccessData;
|
||||
import com.ycwl.basic.model.wx.WechatCallbackSuccessData;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import com.ycwl.basic.pay.entity.PayResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Map;
|
||||
|
||||
public interface WxPayService {
|
||||
@@ -20,13 +20,13 @@ public interface WxPayService {
|
||||
*/
|
||||
void payNotify(HttpServletRequest request);
|
||||
|
||||
void payNotify(Long scenicId, HttpServletRequest request);
|
||||
PayResponse payNotify(Long scenicId, HttpServletRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 微信支付结果查询
|
||||
*/
|
||||
WxchatCallbackSuccessData queryPay(Long orderId);
|
||||
WechatCallbackSuccessData queryPay(Long orderId);
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
|
@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.constant.NumberConstant;
|
||||
import com.ycwl.basic.constant.WeiXinConstant;
|
||||
import com.ycwl.basic.enums.BizCodeEnum;
|
||||
import com.ycwl.basic.enums.WechatErrorCodeEnum;
|
||||
import com.ycwl.basic.exception.AppException;
|
||||
@@ -20,7 +19,6 @@ import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.service.mobile.AppMemberService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import com.ycwl.basic.utils.BeanCopierUtils;
|
||||
import com.ycwl.basic.utils.JwtTokenUtil;
|
||||
import com.ycwl.basic.utils.SnowFlakeUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -48,6 +46,8 @@ public class AppMemberServiceImpl implements AppMemberService {
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
|
||||
public static final String GET_OPEN_ID = "https://api.weixin.qq.com/sns/jscode2session";
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getOpenId(Long scenicId, String code) {
|
||||
Map<String, Object> paramMap = new HashMap<>(NumberConstant.FOUR);
|
||||
@@ -57,7 +57,7 @@ public class AppMemberServiceImpl implements AppMemberService {
|
||||
paramMap.put("js_code", code);
|
||||
paramMap.put("grant_type", "authorization_code");
|
||||
try {
|
||||
String response = HttpUtil.post(WeiXinConstant.GET_OPEN_ID, paramMap);
|
||||
String response = HttpUtil.post(GET_OPEN_ID, paramMap);
|
||||
if (StringUtils.isBlank(response)) {
|
||||
return null;
|
||||
}
|
||||
@@ -96,14 +96,39 @@ public class AppMemberServiceImpl implements AppMemberService {
|
||||
List<MemberRespVO> list = memberMapper.list(memberReqQuery);
|
||||
if (list.isEmpty()) {
|
||||
MemberEntity memberEntity = new MemberEntity();
|
||||
BeanCopierUtils.copyProperties(userInfoDTO, memberEntity);
|
||||
memberEntity.setId(SnowFlakeUtil.getLongId());
|
||||
memberEntity.setScenicId(scenicId);
|
||||
memberEntity.setOpenId(openId.toString());
|
||||
memberEntity.setNickname(userInfoDTO.getNickname());
|
||||
memberEntity.setAvatarUrl(userInfoDTO.getAvatarUrl());
|
||||
memberEntity.setAgreement(1);
|
||||
memberEntity.setPhone(userInfoDTO.getPhone());
|
||||
memberEntity.setCountry(userInfoDTO.getCountry());
|
||||
memberEntity.setProvince(userInfoDTO.getProvince());
|
||||
memberEntity.setCity(userInfoDTO.getCity());
|
||||
memberMapper.add(memberEntity);
|
||||
BeanCopierUtils.copyProperties(memberEntity, memberRespVO);
|
||||
memberRespVO.setId(memberEntity.getId());
|
||||
memberRespVO.setOpenId(memberEntity.getOpenId());
|
||||
memberRespVO.setNickname(memberEntity.getNickname());
|
||||
memberRespVO.setAvatarUrl(memberEntity.getAvatarUrl());
|
||||
memberRespVO.setAgreement(1);
|
||||
memberRespVO.setPhone(memberEntity.getPhone());
|
||||
memberRespVO.setCountry(memberEntity.getCountry());
|
||||
memberRespVO.setProvince(memberEntity.getProvince());
|
||||
memberRespVO.setCity(memberEntity.getCity());
|
||||
memberRespVO.setScenicId(memberEntity.getScenicId());
|
||||
} else {
|
||||
BeanCopierUtils.copyProperties(list.get(NumberConstant.ZERO), memberRespVO);
|
||||
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.setName(memberRespVO.getNickname());
|
||||
@@ -127,7 +152,9 @@ public class AppMemberServiceImpl implements AppMemberService {
|
||||
public ApiResponse<?> update(WeChatUserInfoUpdateDTO userInfoUpdateDTO) {
|
||||
MemberEntity memberEntity = new MemberEntity();
|
||||
memberEntity.setId(Long.parseLong(BaseContextHandler.getUserId()));
|
||||
BeanCopierUtils.copyProperties(userInfoUpdateDTO, memberEntity);
|
||||
memberEntity.setNickname(userInfoUpdateDTO.getNickname());
|
||||
memberEntity.setAvatarUrl(userInfoUpdateDTO.getAvatarUrl());
|
||||
memberEntity.setAgreement(userInfoUpdateDTO.getAgreement());
|
||||
return ApiResponse.success(memberMapper.update(memberEntity));
|
||||
}
|
||||
|
||||
@@ -140,7 +167,7 @@ public class AppMemberServiceImpl implements AppMemberService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse updateScenicServiceNoticeStatus(Long scenicId) {
|
||||
public ApiResponse<String> updateScenicServiceNoticeStatus(Long scenicId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
Integer scenicServiceNoticeStatus = memberMapper.getScenicServiceNoticeStatus(scenicId, worker.getUserId());
|
||||
//没有就初始化为开启
|
||||
|
@@ -51,14 +51,14 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
@Override
|
||||
public ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(Long scenicId) {
|
||||
JwtInfo worker = JwtTokenUtil.getWorker();
|
||||
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(scenicId, worker.getUserId());
|
||||
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(scenicId);
|
||||
return ApiResponse.success(scenicDeviceCountVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<ScenicRespVO> getDetails(Long id) {
|
||||
ScenicRespVO scenicRespVO = scenicMapper.getAppById(id);
|
||||
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(id, -1L);
|
||||
ScenicDeviceCountVO scenicDeviceCountVO = deviceMapper.deviceCountByScenicId(id);
|
||||
scenicRespVO.setLensNum(scenicDeviceCountVO.getTotalDeviceCount());
|
||||
return ApiResponse.success(scenicRespVO);
|
||||
}
|
||||
|
@@ -219,7 +219,7 @@ public class AppStatisticsServiceImpl implements AppStatisticsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse addStatistics(StatisticsRecordAddReq req) {
|
||||
public ApiResponse<String> addStatistics(StatisticsRecordAddReq req) {
|
||||
// req.setId(SnowFlakeUtil.getLongId());
|
||||
if (req.getMemberId() == null) {
|
||||
try {
|
||||
|
@@ -19,10 +19,12 @@ import com.ycwl.basic.mapper.*;
|
||||
import com.ycwl.basic.model.mobile.goods.*;
|
||||
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
|
||||
import com.ycwl.basic.model.mobile.order.PriceObj;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.mp.MpConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
|
||||
import com.ycwl.basic.model.pc.source.entity.SourceWatermarkEntity;
|
||||
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
|
||||
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
|
||||
@@ -31,6 +33,7 @@ import com.ycwl.basic.model.pc.template.resp.TemplateRespVO;
|
||||
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
|
||||
import com.ycwl.basic.model.pc.video.req.VideoReqQuery;
|
||||
import com.ycwl.basic.model.pc.video.resp.VideoRespVO;
|
||||
import com.ycwl.basic.repository.DeviceRepository;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.repository.OrderRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
@@ -50,6 +53,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -90,6 +94,8 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
private FaceRepository faceRepository;
|
||||
@Autowired
|
||||
private TaskStatusBiz taskStatusBiz;
|
||||
@Autowired
|
||||
private DeviceRepository deviceRepository;
|
||||
|
||||
public ApiResponse<List<GoodsPageVO>> goodsList(GoodsReqQuery query) {
|
||||
//查询原素材
|
||||
@@ -138,7 +144,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
return true;
|
||||
}).map(type -> {
|
||||
GoodsPageVO goodsPageVO = new GoodsPageVO();
|
||||
goodsPageVO.setTemplateCoverUrl(goods.get(0).getUrl());
|
||||
goodsPageVO.setTemplateCoverUrl(goods.getFirst().getUrl());
|
||||
goodsPageVO.setFaceId(faceId);
|
||||
if (type == 1) {
|
||||
goodsPageVO.setGoodsName("录像集");
|
||||
@@ -177,7 +183,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
List<SourceRespVO> list = sourceMapper.listUser(sourceReqQuery);
|
||||
List<GoodsDetailVO> goodsDetailVOList = new ArrayList<>();
|
||||
|
||||
String goodsNamePrefix = "";
|
||||
String goodsNamePrefix;
|
||||
if (sourceType == 1) {
|
||||
goodsNamePrefix = "录像";
|
||||
} else if (sourceType == 2) {
|
||||
@@ -204,14 +210,14 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsDetailVO.setIsBuy(sourceRespVO.getIsBuy());
|
||||
if (sourceRespVO.getVideoUrl() != null) {
|
||||
try {
|
||||
URL url = new URL(sourceRespVO.getVideoUrl());
|
||||
URI url = URI.create(sourceRespVO.getVideoUrl());
|
||||
if (StringUtils.startsWith(url.getHost(), "100.64.")) {
|
||||
// 内网地址,需要代理
|
||||
goodsDetailVO.setVideoUrl("https://zhentuai.com/proxy?url=" + sourceRespVO.getVideoUrl());
|
||||
} else {
|
||||
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("url地址解析异常:{}", sourceRespVO.getVideoUrl(), e);
|
||||
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
|
||||
}
|
||||
@@ -304,14 +310,14 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
*/
|
||||
@Override
|
||||
public VideoTaskStatusVO getTaskStatusByFaceId(Long faceId) {
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
Long userId = face.getMemberId();
|
||||
VideoTaskStatusVO response = new VideoTaskStatusVO();
|
||||
response.setFaceId(faceId);
|
||||
FaceEntity face = faceRepository.getFace(faceId);
|
||||
if (face == null) {
|
||||
response.setStatus(0);
|
||||
response.setStatus(-1);
|
||||
return response;
|
||||
}
|
||||
Long userId = face.getMemberId();
|
||||
response.setFaceId(faceId);
|
||||
response.setScenicId(face.getScenicId());
|
||||
int faceCutStatus = taskStatusBiz.getFaceCutStatus(faceId);
|
||||
response.setCutStatus(faceCutStatus);
|
||||
@@ -356,12 +362,20 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
.count();
|
||||
response.setCount(finishedTask);
|
||||
if (!notFinishedTasks.isEmpty()) {
|
||||
response.setTemplateId(notFinishedTasks.get(0).getTemplateId());
|
||||
response.setTaskId(notFinishedTasks.get(0).getTaskId());
|
||||
response.setTemplateId(notFinishedTasks.getFirst().getTemplateId());
|
||||
response.setTaskId(notFinishedTasks.getFirst().getTaskId());
|
||||
response.setStatus(2);
|
||||
return response;
|
||||
}
|
||||
// 重查一下
|
||||
taskList = videoMapper.listRelationByFace(userId, faceId);
|
||||
MemberVideoEntity lastVideo = taskList.getLast();
|
||||
if (null == lastVideo.getVideoId()) {
|
||||
response.setTemplateId(lastVideo.getTemplateId());
|
||||
response.setTaskId(lastVideo.getTaskId());
|
||||
response.setStatus(2);
|
||||
return response;
|
||||
}
|
||||
MemberVideoEntity lastVideo = taskList.get(taskList.size() - 1);
|
||||
response.setTaskId(lastVideo.getTaskId());
|
||||
response.setTemplateId(lastVideo.getTemplateId());
|
||||
response.setVideoId(lastVideo.getVideoId());
|
||||
@@ -385,7 +399,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
response.setStatus(0);
|
||||
return response;
|
||||
}
|
||||
response.setScenicId(taskList.get(0).getScenicId());
|
||||
response.setScenicId(taskList.getFirst().getScenicId());
|
||||
response.setMaxCount(templateRepository.getTemplateListByScenicId(response.getScenicId()).size());
|
||||
List<MemberVideoEntity> notFinishedTasks = taskList.stream()
|
||||
.filter(task -> {
|
||||
@@ -407,18 +421,18 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
int faceCutStatus = taskStatusBiz.getFaceCutStatus(faceId);
|
||||
if (Integer.valueOf(0).equals(faceCutStatus)) {
|
||||
if (!notFinishedTasks.isEmpty()) {
|
||||
response.setTemplateId(notFinishedTasks.get(0).getTemplateId());
|
||||
response.setTemplateId(notFinishedTasks.getFirst().getTemplateId());
|
||||
}
|
||||
response.setStatus(2);
|
||||
return response;
|
||||
}
|
||||
if (!notFinishedTasks.isEmpty()) {
|
||||
response.setTemplateId(notFinishedTasks.get(0).getTemplateId());
|
||||
response.setTaskId(notFinishedTasks.get(0).getTaskId());
|
||||
response.setTemplateId(notFinishedTasks.getFirst().getTemplateId());
|
||||
response.setTaskId(notFinishedTasks.getFirst().getTaskId());
|
||||
response.setStatus(2);
|
||||
return response;
|
||||
}
|
||||
MemberVideoEntity lastVideo = taskList.get(taskList.size() - 1);
|
||||
MemberVideoEntity lastVideo = taskList.getLast();
|
||||
response.setTaskId(lastVideo.getTaskId());
|
||||
response.setTemplateId(lastVideo.getTemplateId());
|
||||
response.setVideoId(lastVideo.getVideoId());
|
||||
@@ -470,14 +484,14 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
goodsDetailVO.setGoodsId(sourceRespVO.getId());
|
||||
if (sourceRespVO.getVideoUrl() != null) {
|
||||
try {
|
||||
URL url = new URL(sourceRespVO.getVideoUrl());
|
||||
URI url = URI.create(sourceRespVO.getVideoUrl());
|
||||
if (StringUtils.startsWith(url.getHost(), "100.64.")) {
|
||||
// 内网地址,需要代理
|
||||
goodsDetailVO.setVideoUrl("https://zhentuai.com/proxy?url=" + sourceRespVO.getVideoUrl());
|
||||
} else {
|
||||
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("url地址解析异常:{}", sourceRespVO.getVideoUrl(), e);
|
||||
goodsDetailVO.setVideoUrl(sourceRespVO.getVideoUrl());
|
||||
}
|
||||
@@ -637,7 +651,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
ImageWatermarkOperatorEnum type = ImageWatermarkOperatorEnum.getByCode(scenicConfig.getWatermarkType());
|
||||
if (type != null) {
|
||||
IStorageAdapter adapter;
|
||||
if (scenicConfig != null && scenicConfig.getStoreType() != null) {
|
||||
if (scenicConfig.getStoreType() != null) {
|
||||
adapter = StorageFactory.get(scenicConfig.getStoreType());
|
||||
adapter.loadConfig(JSONObject.parseObject(scenicConfig.getStoreConfigJson(), Map.class));
|
||||
} else {
|
||||
@@ -662,6 +676,16 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
item.setUrl(any.get().getWatermarkUrl());
|
||||
} else {
|
||||
// 生成
|
||||
String text = scenicConfig.getWatermarkScenicText();
|
||||
if (StringUtils.isBlank(text)) {
|
||||
SourceEntity entity = sourceMapper.getEntity(item.getGoodsId());
|
||||
if (entity != null) {
|
||||
DeviceEntity device = deviceRepository.getDevice(entity.getDeviceId());
|
||||
if (device != null) {
|
||||
text = device.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
File dstFile = new File(item.getGoodsId() + ".jpg");
|
||||
File watermarkedFile = new File(item.getGoodsId() + "_" + type.getType() + "." + type.getPreferFileType());
|
||||
try {
|
||||
@@ -674,7 +698,7 @@ public class GoodsServiceImpl implements GoodsService {
|
||||
WatermarkInfo info = new WatermarkInfo();
|
||||
info.setOriginalFile(dstFile);
|
||||
info.setQrcodeFile(qrcode);
|
||||
info.setScenicLine(scenicConfig.getWatermarkScenicText());
|
||||
info.setScenicLine(text);
|
||||
info.setDatetime(item.getCreateTime());
|
||||
info.setDtFormat(scenicConfig.getWatermarkDtFormat());
|
||||
info.setWatermarkedFile(watermarkedFile);
|
||||
|
@@ -15,7 +15,7 @@ import com.ycwl.basic.model.pc.order.entity.OrderEntity;
|
||||
import com.ycwl.basic.model.pc.order.req.OrderUpdateReq;
|
||||
import com.ycwl.basic.model.pc.payment.entity.PaymentEntity;
|
||||
import com.ycwl.basic.model.wx.WXPayOrderReqVO;
|
||||
import com.ycwl.basic.model.wx.WxchatCallbackSuccessData;
|
||||
import com.ycwl.basic.model.wx.WechatCallbackSuccessData;
|
||||
import com.ycwl.basic.pay.adapter.IPayAdapter;
|
||||
import com.ycwl.basic.pay.entity.CancelOrderRequest;
|
||||
import com.ycwl.basic.pay.entity.CreateOrderRequest;
|
||||
@@ -32,7 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
@@ -80,6 +80,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
CreateOrderResponse order = scenicPayAdapter.createOrder(request);
|
||||
Map<String, Object> paymentParams = scenicPayAdapter.getPaymentParams(order);
|
||||
paymentParams.put("needPay", !order.isSkipPay());
|
||||
paymentParams.put("orderId", req.getOrderSn());
|
||||
return paymentParams;
|
||||
} catch (Exception e) {
|
||||
log.error("[微信支付]createOrder error", e);
|
||||
@@ -88,7 +89,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void payNotify(Long scenicId, HttpServletRequest request) {
|
||||
public PayResponse payNotify(Long scenicId, HttpServletRequest request) {
|
||||
IPayAdapter scenicPayAdapter = scenicService.getScenicPayAdapter(scenicId);
|
||||
try {
|
||||
PayResponse callbackResponse = scenicPayAdapter.handleCallback(request);
|
||||
@@ -108,6 +109,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
} catch (Exception e) {
|
||||
throw new AppException(BizCodeEnum.ADVANCE_PAYMENT_CALLBACK_FAILED, e.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,7 +118,7 @@ public class WxPayServiceImpl implements WxPayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxchatCallbackSuccessData queryPay(Long orderId) {
|
||||
public WechatCallbackSuccessData queryPay(Long orderId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user