fix[订单中心]:前端接口调试,联调逻辑优化
This commit is contained in:
+16
-4
@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,6 +56,17 @@ public class HomeCarouselController {
|
|||||||
return pageResult;
|
return pageResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/app")
|
||||||
|
public Result<List<HomeCarousel>> homeList() {
|
||||||
|
List<HomeCarousel> list = homeCarouselService.list();
|
||||||
|
if (!list.isEmpty()){
|
||||||
|
for (HomeCarousel homeCarousel: list){
|
||||||
|
homeCarousel.setImageUrl(fileCenterService.getViewUrlByPath(homeCarousel.getImageUrl()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Result.succeed(list,"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public Result saveOrUpdate(@RequestBody HomeCarousel homeCarousel) {
|
public Result saveOrUpdate(@RequestBody HomeCarousel homeCarousel) {
|
||||||
return homeCarouselService.saveOrUpdateHomeCarousel(homeCarousel);
|
return homeCarouselService.saveOrUpdateHomeCarousel(homeCarousel);
|
||||||
@@ -70,9 +82,9 @@ public class HomeCarouselController {
|
|||||||
return Result.succeed(homeCarousel,"获取成功");
|
return Result.succeed(homeCarousel,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping()
|
@DeleteMapping("/{id}")
|
||||||
public Result delete(@RequestBody HomeCarousel homeCarousel) {
|
public Result delete(@PathVariable Long id) {
|
||||||
boolean result = homeCarouselService.removeById(homeCarousel.getId());
|
homeCarouselService.removeById(id);
|
||||||
return result ? Result.succeed(homeCarousel, "操作成功") : Result.failed("操作失败");
|
return Result.succeed("操作成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+35
-15
@@ -12,10 +12,7 @@ import com.central.order.config.TencentPayProperties;
|
|||||||
import com.central.order.enums.OrderStatus;
|
import com.central.order.enums.OrderStatus;
|
||||||
import com.central.order.feign.FileCenterService;
|
import com.central.order.feign.FileCenterService;
|
||||||
import com.central.order.feign.UserCenterService;
|
import com.central.order.feign.UserCenterService;
|
||||||
import com.central.order.model.Order;
|
import com.central.order.model.*;
|
||||||
import com.central.order.model.OrderFile;
|
|
||||||
import com.central.order.model.QrCode;
|
|
||||||
import com.central.order.model.TourismFile;
|
|
||||||
import com.central.order.service.*;
|
import com.central.order.service.*;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension;
|
||||||
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
import com.wechat.pay.java.service.payments.jsapi.model.Amount;
|
||||||
@@ -90,6 +87,8 @@ public class OrderController {
|
|||||||
|
|
||||||
@Value("${file.style}")
|
@Value("${file.style}")
|
||||||
private String fileStyle;
|
private String fileStyle;
|
||||||
|
// 获取当前日期,格式化为 yyyyMMdd
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstant.DATEMINUTE_FORMAT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
@@ -135,9 +134,6 @@ public class OrderController {
|
|||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
params.put("userId", user.getId());
|
params.put("userId", user.getId());
|
||||||
|
|
||||||
// 获取当前日期,格式化为 yyyyMMdd
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat(CommonConstant.DATEMINUTE_FORMAT);
|
|
||||||
|
|
||||||
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> page = new ArrayList<>();
|
||||||
@@ -264,17 +260,32 @@ public class OrderController {
|
|||||||
return Result.succeed(map,"获取成功");
|
return Result.succeed(map,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取订单排队总览信息")
|
||||||
|
@GetMapping("/queue/info/{orderNo}")
|
||||||
|
public Result<Map> getQueueInfoByOrderNo(@PathVariable("orderNo") String orderNo) {
|
||||||
|
|
||||||
|
Order order = orderService.getOrderByNumber(orderNo);
|
||||||
|
Assert.notNull(order,"订单数据不能为空");
|
||||||
|
QrCode qrCode = qrCodeService.getByCodeId(order.getCodeId());
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("price",appendPriceStr(qrCode.getPrice()));
|
||||||
|
Integer count = orderService.getOrderRankingByOrderId(order.getId());
|
||||||
|
map.put("count", count == 1 ? -1 : count-1 );
|
||||||
|
map.put("time",Math.multiplyExact((count-1),DEVICE_EXEC_TIME));
|
||||||
|
return Result.succeed(map,"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取用户是否存在排队订单")
|
@Operation(summary = "获取用户是否存在排队订单")
|
||||||
@GetMapping("/queue/info/user")
|
@GetMapping("/queue/info/user")
|
||||||
public Result<Integer> getQueueInfoByUser() {
|
public Result<List<Order>> getOrderInfoByUser() {
|
||||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||||
Long count = orderService.getOrderCountByStatusAndUser(OrderStatus.PAID.getId(),user.getId());
|
List<Order> orders = orderService.getOrderCountByStatusAndUser(user.getId(),new Integer[]{OrderStatus.PAID.getId(),OrderStatus.DOING.getId()});
|
||||||
if (count == 0){
|
if(!orders.isEmpty()){
|
||||||
return Result.succeed(0,"该用户未存在待执行订单");
|
for (Order order : orders){
|
||||||
}else if (count > 0 ){
|
order.setCreatedTime(sdf.format(order.getCreateTime()));
|
||||||
return Result.succeed(1,"存在待执行订单");
|
}
|
||||||
}
|
}
|
||||||
return Result.succeed(0,"该用户未存在待执行订单");
|
return Result.succeed(orders,"获取成功");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +376,7 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取订单对应的景区素材")
|
@Operation(summary = "获取订单对应的景区素材")
|
||||||
@GetMapping("/tourism/{orderNo}")
|
@GetMapping("/resource/tourism/{orderNo}")
|
||||||
public Result<List<TourismFile>> getTourismByOrder(@PathVariable("orderNo") String orderNo) {
|
public Result<List<TourismFile>> getTourismByOrder(@PathVariable("orderNo") String orderNo) {
|
||||||
Order order = orderService.getOrderByNumber(orderNo);
|
Order order = orderService.getOrderByNumber(orderNo);
|
||||||
Assert.notNull(order,"订单数据不存在");
|
Assert.notNull(order,"订单数据不存在");
|
||||||
@@ -378,6 +389,15 @@ public class OrderController {
|
|||||||
return Result.succeed(tourismFiles,"获取成功");
|
return Result.succeed(tourismFiles,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "获取订单对应的景区Info")
|
||||||
|
@GetMapping("/info/tourism/{orderNo}")
|
||||||
|
public Result<Tourism> getTourismInfoByOrder(@PathVariable("orderNo") String orderNo) {
|
||||||
|
Order order = orderService.getOrderByNumber(orderNo);
|
||||||
|
Assert.notNull(order,"订单数据不存在");
|
||||||
|
Tourism tourism = tourismService.getTourismById(order.getTourismId());
|
||||||
|
return Result.succeed(tourism,"获取成功");
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取订单的设备")
|
@Operation(summary = "获取订单的设备")
|
||||||
@GetMapping("/device/{orderNo}")
|
@GetMapping("/device/{orderNo}")
|
||||||
public Result<String> getDeviceByOrder(@PathVariable("orderNo") String orderNo) {
|
public Result<String> getDeviceByOrder(@PathVariable("orderNo") String orderNo) {
|
||||||
|
|||||||
+4
-4
@@ -125,9 +125,9 @@ public class QrCodeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@DeleteMapping()
|
@DeleteMapping("/{id}")
|
||||||
public Result delete(@RequestBody Tourism tourism) {
|
public Result delete(@PathVariable Long id) {
|
||||||
boolean result = qrCodeService.removeById(tourism);
|
qrCodeService.removeById(id);
|
||||||
return result ? Result.succeed(tourism, "操作成功") : Result.failed("操作失败");
|
return Result.succeed("操作成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -70,9 +70,9 @@ public class TourismFileController {
|
|||||||
return Result.succeed(tourismFile,"获取成功");
|
return Result.succeed(tourismFile,"获取成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping()
|
@DeleteMapping("/{id}")
|
||||||
public Result delete(@RequestBody TourismFile tourismFile) {
|
public Result delete(@PathVariable Long id) {
|
||||||
boolean result = tourismFileService.removeById(tourismFile.getId());
|
tourismFileService.removeById(id);
|
||||||
return result ? Result.succeed(tourismFile, "操作成功") : Result.failed("操作失败");
|
return Result.succeed( "操作成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public enum HomeCarouselType implements ZltEnum {
|
public enum HomeCarouselType implements ZltEnum {
|
||||||
HOME(0,"首页"),
|
HOME(0,"首页轮播"),
|
||||||
ACTIVITY(1, "活动"),
|
ACTIVITY(1, "活动"),
|
||||||
SHOOTING_ANGLE(2,"拍照角度"),
|
SHOOTING_ANGLE(2,"拍照角度"),
|
||||||
GUIDANCE(3,"引导"),
|
GUIDANCE(3,"引导"),
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ public class HomeCarousel extends SuperEntity {
|
|||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
private Long createId;
|
|
||||||
//租户ID
|
//租户ID
|
||||||
private Long tenantId;
|
private Long tenantId;
|
||||||
private String company;
|
private String company;
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ public interface IOrderService extends ISuperService<Order> {
|
|||||||
*/
|
*/
|
||||||
boolean updateOrder(Order order);
|
boolean updateOrder(Order order);
|
||||||
|
|
||||||
Long getOrderCountByStatusAndUser(Integer status, Long userId);
|
List<Order> getOrderCountByStatusAndUser(Long userId, Integer... status);
|
||||||
|
|
||||||
Long getOrderCountByStatus(Integer status);
|
Long getOrderCountByStatus(Integer status);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -157,9 +157,9 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getOrderCountByStatusAndUser(Integer status, Long userId) {
|
public List<Order> getOrderCountByStatusAndUser(Long userId, Integer... status) {
|
||||||
return baseMapper.selectCount(new QueryWrapper<Order>()
|
return baseMapper.selectList(new QueryWrapper<Order>()
|
||||||
.eq("order_status", status)
|
.in("order_status", status)
|
||||||
.eq("user_id", userId));
|
.eq("user_id", userId));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: user-center
|
name: user-center
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 124.222.128.40
|
ip: 124.222.128.40
|
||||||
# cloud:
|
# cloud:
|
||||||
# nacos:
|
# nacos:
|
||||||
# discovery:
|
# discovery:
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ spring.profiles.active=prod
|
|||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
spring.cloud.nacos.server-addr=47.94.136.130:8848
|
||||||
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
#spring.cloud.nacos.server-addr=127.0.0.1:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=gofly
|
||||||
spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=gofly
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
spring.cloud.nacos.config.shared-configs[0].data-id=common.yml
|
spring.cloud.nacos.config.shared-configs[0].data-id=common.yml
|
||||||
spring.cloud.nacos.config.shared-configs[0].refresh=true
|
spring.cloud.nacos.config.shared-configs[0].refresh=true
|
||||||
|
|||||||
@@ -141,7 +141,8 @@ zlt:
|
|||||||
/api-order/files/path,
|
/api-order/files/path,
|
||||||
/api-order/update,
|
/api-order/update,
|
||||||
/api-order/queue/first,
|
/api-order/queue/first,
|
||||||
/api-order/wechat/**
|
/api-order/wechat/**,
|
||||||
|
/api-order/home/carousel/app
|
||||||
auth:
|
auth:
|
||||||
urlPermission:
|
urlPermission:
|
||||||
#是否开启url级别权限
|
#是否开启url级别权限
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: uaa-server
|
name: uaa-server
|
||||||
# cloud:
|
cloud:
|
||||||
# nacos:
|
nacos:
|
||||||
# discovery:
|
discovery:
|
||||||
# ip: 124.222.128.40
|
ip: 124.222.128.40
|
||||||
|
|
||||||
encrypt:
|
encrypt:
|
||||||
key-store:
|
key-store:
|
||||||
|
|||||||
Reference in New Issue
Block a user