fix[通用模块]: 泛型校验优化
This commit is contained in:
+19
-14
@@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
@@ -72,15 +73,11 @@ public class OrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TencentPayProperties tencentPayProperties;
|
private TencentPayProperties tencentPayProperties;
|
||||||
|
|
||||||
//// @Value("tencent.appid")
|
@Value("cdn.oss-url")
|
||||||
// private String appId = "wx30a3c8de94a85584" ;
|
private String cdnOssUrl;
|
||||||
//
|
|
||||||
//// @Value("tencent.merchantId")
|
|
||||||
// private String mchid = "1703796518";
|
|
||||||
//
|
|
||||||
//// @Value("tencent.notifyUrl")
|
|
||||||
// private String notifyUrl = "http://img.goflytec.com/api-order/wechat/pay/notify" ;
|
|
||||||
|
|
||||||
|
@Value("cdn.url")
|
||||||
|
private String cdnUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
@@ -118,20 +115,19 @@ public class OrderController {
|
|||||||
|
|
||||||
PageResult<Order> result = orderService.findListByUser(params);
|
PageResult<Order> result = orderService.findListByUser(params);
|
||||||
if (result.getCount() > 0){
|
if (result.getCount() > 0){
|
||||||
List<Map> page = new ArrayList();
|
List<Map<String,Object>> page = new ArrayList<>();
|
||||||
for(Order order : result.getData()){
|
for(Order order : result.getData()){
|
||||||
Map<String,Object> orderFileMap = new HashMap<>();
|
Map<String,Object> orderFileMap = new HashMap<>();
|
||||||
orderFileMap.put("time", sdf.format(order.getCreateTime()));
|
orderFileMap.put("time", sdf.format(order.getCreateTime()));
|
||||||
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
|
orderFileMap.put("addr", tourismService.getTourismById(order.getTourismId()).getTourismAddress());
|
||||||
orderFileMap.put("orderNo", order.getOrderNo());
|
orderFileMap.put("orderNo", order.getOrderNo());
|
||||||
List<OrderFile> list = orderFileService.getOrderFileByOrderNo(order.getOrderNo());
|
List<OrderFile> list = orderFileService.getOrderFileByOrderNo(order.getOrderNo());
|
||||||
List<Map> resultList = new ArrayList<>();
|
List<Map<String,String>> resultList = new ArrayList<>();
|
||||||
if (list.size() > 0){
|
if (!list.isEmpty()){
|
||||||
for (OrderFile orderFile : list){
|
for (OrderFile orderFile : list){
|
||||||
Map imgMap = new HashMap();
|
Map<String,String> imgMap = new HashMap<>();
|
||||||
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
String url = fileCenterService.getViewUrlByName(orderFile.getFilePath());
|
||||||
url = url.replace("goflyapp.oss-cn-beijing.aliyuncs.com","cdn.goflytec.com");
|
imgMap.put("url", url.replace(cdnOssUrl,cdnUrl));
|
||||||
imgMap.put("url", url);
|
|
||||||
//@TODO 待优化file_type获取方式
|
//@TODO 待优化file_type获取方式
|
||||||
if (url != null && !"".equals(url) ){
|
if (url != null && !"".equals(url) ){
|
||||||
if (url.contains(".jpeg")){
|
if (url.contains(".jpeg")){
|
||||||
@@ -167,6 +163,7 @@ public class OrderController {
|
|||||||
public Result<Order> createOrder(@RequestBody Order order) {
|
public Result<Order> createOrder(@RequestBody Order order) {
|
||||||
|
|
||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
|
//@TODO 设置价格逻辑优化
|
||||||
order.setOrderAmount("1990");
|
order.setOrderAmount("1990");
|
||||||
order.setUserId(user.getId());
|
order.setUserId(user.getId());
|
||||||
if (order.getCodeId() == null){
|
if (order.getCodeId() == null){
|
||||||
@@ -371,4 +368,12 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
return Result.failed("不满足执行条件");
|
return Result.failed("不满足执行条件");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCdnOssUrl() {
|
||||||
|
return cdnOssUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCdnUrl() {
|
||||||
|
return cdnUrl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -40,7 +40,7 @@ public class WxPayController {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@PostMapping("/pay/Notify")
|
@PostMapping("/pay/Notify")
|
||||||
public String wechatPayNotify(HttpServletRequest request) throws IOException {
|
public void wechatPayNotify(HttpServletRequest request) throws IOException {
|
||||||
log.info("------收到微信支付回调通知------");
|
log.info("------收到微信支付回调通知------");
|
||||||
return payNotify(request);
|
return payNotify(request);
|
||||||
}
|
}
|
||||||
@@ -110,6 +110,9 @@ public class WxPayController {
|
|||||||
Order order = orderService.getOrderByNumber(transaction.getOutTradeNo());
|
Order order = orderService.getOrderByNumber(transaction.getOutTradeNo());
|
||||||
order.setOrderStatus(OrderStatus.PAID.getId());
|
order.setOrderStatus(OrderStatus.PAID.getId());
|
||||||
boolean res = orderService.updateOrder(order);
|
boolean res = orderService.updateOrder(order);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (res){
|
if (res){
|
||||||
returnMap.put("code", "SUCCESS");
|
returnMap.put("code", "SUCCESS");
|
||||||
returnMap.put("message", "成功");
|
returnMap.put("message", "成功");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum OrderStatus implements ZltEnum {
|
public enum OrderStatus implements ZltEnum {
|
||||||
UNPAID(0,"待支付"), PAID(1, "已支付排队中"), CANCELED(2, "已取消"),COMPLETE(3,"服务完成");
|
UNPAID(0,"待支付"), PAID(1, "已支付排队中"), CANCELED(2, "已取消"),DOING(4,"正在服务中"),COMPLETE(3,"服务完成");
|
||||||
|
|
||||||
OrderStatus(Integer id, String content) {
|
OrderStatus(Integer id, String content) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
+4
-8
@@ -41,9 +41,6 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
|
|
||||||
private final static String ORDER_LOCK = "order_lock_";
|
private final static String ORDER_LOCK = "order_lock_";
|
||||||
|
|
||||||
// 定义分布式锁的键,确保唯一性,这里以固定字符串加上当前时间戳来构造
|
|
||||||
private final static String ORDER_TIMEOUT_LOCK_ = "order_timeout_lock_" + System.currentTimeMillis();
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DistributedLock lock;
|
private DistributedLock lock;
|
||||||
|
|
||||||
@@ -53,7 +50,6 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
private JsapiServiceExtension service;
|
private JsapiServiceExtension service;
|
||||||
|
|
||||||
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||||
private SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy MMdd");
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderMapper orderMapper;
|
private OrderMapper orderMapper;
|
||||||
|
|
||||||
@@ -178,10 +174,10 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult findListByUser(Map<String, Object> params) {
|
public PageResult<Order> findListByUser(Map<String, Object> params) {
|
||||||
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
|
||||||
List<Order> list = baseMapper.findListByUser(page, params);
|
List<Order> list = baseMapper.findListByUser(page, params);
|
||||||
if (list != null && list.size() > 0) {
|
if (list != null && !list.isEmpty()) {
|
||||||
for (Order order : list) {
|
for (Order order : list) {
|
||||||
order.setCreatedTime(sdf.format(order.getCreateTime()));
|
order.setCreatedTime(sdf.format(order.getCreateTime()));
|
||||||
}
|
}
|
||||||
@@ -193,7 +189,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
public void updateOrderStatus() {
|
public void updateOrderStatus() {
|
||||||
|
|
||||||
List<Order> orders = baseMapper.getOrdersByStatus(OrderStatus.UNPAID.getId());
|
List<Order> orders = baseMapper.getOrdersByStatus(OrderStatus.UNPAID.getId());
|
||||||
if (orders != null && orders.size() > 0) {
|
if (orders != null && !orders.isEmpty()) {
|
||||||
for (Order order : orders) {
|
for (Order order : orders) {
|
||||||
QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();
|
QueryOrderByOutTradeNoRequest request = new QueryOrderByOutTradeNoRequest();
|
||||||
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
// 调用request.setXxx(val)设置所需参数,具体参数可见Request定义
|
||||||
@@ -218,7 +214,7 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
public Integer getOrderRankingByOrderId(Long orderId) {
|
public Integer getOrderRankingByOrderId(Long orderId) {
|
||||||
|
|
||||||
List<OrderRanking> result = orderMapper.getOrderRanking1();
|
List<OrderRanking> result = orderMapper.getOrderRanking1();
|
||||||
if (result.size() > 0) {
|
if (!result.isEmpty()) {
|
||||||
for (OrderRanking order : result) {
|
for (OrderRanking order : result) {
|
||||||
if (order.getId().equals(orderId)) {
|
if (order.getId().equals(orderId)) {
|
||||||
return order.getRanking();
|
return order.getRanking();
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ tencent:
|
|||||||
appSecret: ${zlt.security.tencent.app-secret}
|
appSecret: ${zlt.security.tencent.app-secret}
|
||||||
accessTokenUrl: ${zlt.security.tencent.accessTokenUrl}
|
accessTokenUrl: ${zlt.security.tencent.accessTokenUrl}
|
||||||
getwxacodeUrl: https://api.weixin.qq.com/wxa/getwxacode?access_token=
|
getwxacodeUrl: https://api.weixin.qq.com/wxa/getwxacode?access_token=
|
||||||
|
cdn:
|
||||||
|
oss-url: goflyapp.oss-cn-beijing.aliyuncs.com
|
||||||
|
url: cdn.goflytec.com
|
||||||
#审计日志
|
#审计日志
|
||||||
# audit-log:
|
# audit-log:
|
||||||
# enabled: true
|
# enabled: true
|
||||||
|
|||||||
Reference in New Issue
Block a user