This commit is contained in:
aiShuiJiaoDeXioShou 2024-10-01 09:11:14 +08:00
parent 2c7e87daa7
commit eeed81935a
17 changed files with 249 additions and 229 deletions

View File

@ -100,10 +100,6 @@
<groupId>cn.yskj.dev</groupId> <groupId>cn.yskj.dev</groupId>
<artifactId>yskj-spring-boot-starter-security</artifactId> <artifactId>yskj-spring-boot-starter-security</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.yskj.dev</groupId>
<artifactId>yskj-spring-boot-starter-security</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,7 @@
package cn.yskj.linghe.module.acdr.config;
public class Config {
public static Long PAY_APP_NO = 9L;
}

View File

@ -187,5 +187,11 @@
<version>2.1.0-snapshot</version> <version>2.1.0-snapshot</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>cn.yskj.dev</groupId>
<artifactId>yskj-module-pay-api</artifactId>
<version>2.1.0-snapshot</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -47,7 +47,9 @@ public class ChinaAddressController {
@ApiOperation(value = "中国地址表分页列表", response = ChinaAddress.class) @ApiOperation(value = "中国地址表分页列表", response = ChinaAddress.class)
@PostMapping(value = "/page") @PostMapping(value = "/page")
public GlobalResponse<ChinaAddress> list(GlobalResponse<ChinaAddress> page) { public GlobalResponse<ChinaAddress> list(GlobalResponse<ChinaAddress> page) {
return service.lambdaQuery().page(page); return service.lambdaQuery()
.eq(ChinaAddress::getUserId, AuthApi.getLoginIdAsLong())
.page(page);
} }
/** /**

View File

@ -1,28 +1,29 @@
package cn.yskj.linghe.module.acdr.controller.app.order.controller; package cn.yskj.linghe.module.acdr.controller.app.order.controller;
import cn.yskj.linghe.module.acdr.api.AuthApi;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.qrcode.QrCodeUtil; import cn.hutool.extra.qrcode.QrCodeUtil;
import cn.yskj.linghe.framework.common.util.servlet.ServletUtils;
import cn.yskj.linghe.module.acdr.api.AuthApi;
import cn.yskj.linghe.module.acdr.common.response.GlobalResponse;
import cn.yskj.linghe.module.acdr.config.Config;
import cn.yskj.linghe.module.acdr.controller.app.address.service.ChinaAddressService; import cn.yskj.linghe.module.acdr.controller.app.address.service.ChinaAddressService;
import cn.yskj.linghe.module.acdr.controller.app.config.service.ServiceConfig; import cn.yskj.linghe.module.acdr.controller.app.config.service.ServiceConfig;
import cn.yskj.linghe.module.acdr.controller.app.file.entity.FileMap; import cn.yskj.linghe.module.acdr.controller.app.file.entity.FileMap;
import cn.yskj.linghe.module.acdr.controller.app.file.service.FileMapService; import cn.yskj.linghe.module.acdr.controller.app.file.service.FileMapService;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order; import cn.yskj.linghe.module.acdr.controller.app.order.entity.AcdrOrder;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.PayInfo; import cn.yskj.linghe.module.acdr.controller.app.order.entity.PayInfo;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.QrCode; import cn.yskj.linghe.module.acdr.controller.app.order.entity.QrCode;
import cn.yskj.linghe.module.acdr.controller.app.order.mapper.QrCodeMapper; import cn.yskj.linghe.module.acdr.controller.app.order.mapper.QrCodeMapper;
import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState; import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState;
import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.PayType; import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.PayType;
import cn.yskj.linghe.module.acdr.controller.app.order.service.OrderService; import cn.yskj.linghe.module.acdr.controller.app.order.service.AcdrOrderService;
import cn.yskj.linghe.module.acdr.common.response.GlobalResponse;
import cn.yskj.linghe.module.acdr.controller.app.order.service.PayInfoService; import cn.yskj.linghe.module.acdr.controller.app.order.service.PayInfoService;
import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService; import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService;
import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetInfoService; import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetInfoService;
import cn.yskj.linghe.module.acdr.controller.app.user.service.UsersService; import cn.yskj.linghe.module.acdr.controller.app.user.service.UsersService;
import cn.yskj.linghe.module.pay.api.order.PayOrderApi;
import cn.yskj.linghe.module.pay.api.order.dto.PayOrderCreateReqDTO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -30,7 +31,6 @@ import jakarta.validation.groups.Default;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.DigestUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -38,10 +38,9 @@ import javax.imageio.ImageIO;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets; import java.math.RoundingMode;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -58,7 +57,7 @@ import java.util.Map;
@RequestMapping("/order") @RequestMapping("/order")
@Validated @Validated
@Slf4j @Slf4j
public class OrderController { public class AcdrOrderController {
@Resource @Resource
private FileMapService fileService; private FileMapService fileService;
@ -79,7 +78,7 @@ public class OrderController {
private PersonalServiceService personalServiceService; private PersonalServiceService personalServiceService;
@Resource @Resource
private OrderService orderService; private AcdrOrderService orderService;
@Resource @Resource
private PayInfoService payService; private PayInfoService payService;
@ -90,7 +89,10 @@ public class OrderController {
@Resource @Resource
private QrCodeMapper qrCodeMapper; private QrCodeMapper qrCodeMapper;
@ApiOperation(value = "详情", response = Order.class) @Resource
private PayOrderApi payOrderApi;
@ApiOperation(value = "详情", response = AcdrOrder.class)
@GetMapping(value = "/info/{id}") @GetMapping(value = "/info/{id}")
public GlobalResponse<Map<String, Object>> info( public GlobalResponse<Map<String, Object>> info(
@PathVariable Long id) { @PathVariable Long id) {
@ -101,44 +103,44 @@ public class OrderController {
@ApiOperation(value = "订单创建,服务预约") @ApiOperation(value = "订单创建,服务预约")
@PostMapping(value = "/create") @PostMapping(value = "/create")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public GlobalResponse<Map<Object, Object>> create( public GlobalResponse<AcdrOrder> create(
@Validated({PostMapping.class, Default.class}) @Validated({PostMapping.class, Default.class})
@RequestBody Order order) { @RequestBody AcdrOrder acdrOrder) {
// 判断当前被预约用户是否有时间, 没有时间就返回相关错误信息 // 判断当前被预约用户是否有时间, 没有时间就返回相关错误信息
if (orderService.isBooking(order)) { if (orderService.isBooking(acdrOrder)) {
return GlobalResponse.failure("该宠托师已经有预约时间了"); return GlobalResponse.failure("该宠托师已经有预约时间了");
} }
// 不能让顾客预约到自己创建的服务 // 不能让顾客预约到自己创建的服务
if (order.getPersonalServiceUserId().equals(AuthApi.getLoginIdAsLong())) { if (acdrOrder.getPersonalServiceUserId().equals(AuthApi.getLoginIdAsLong())) {
return GlobalResponse.failure("你不能预约自己创建的服务!"); return GlobalResponse.failure("你不能预约自己创建的服务!");
} }
order.setUserId(AuthApi.getLoginIdAsLong()) acdrOrder.setUserId(AuthApi.getLoginIdAsLong())
.setState(OrderState.待支付); .setState(OrderState.待支付);
// 判断创建订单是否成功 // 判断创建订单是否成功
boolean createOrder = orderService.save(order); boolean createOrder = orderService.save(acdrOrder);
var map = new HashMap<String, Serializable>(
Map.of(
"appId", appId,
"provider", "wxpay",
"timeStamp", DateUtil.current(),
"nonceStr", RandomUtil.randomString(32),
"package", "prepay_id=WXPay",
"signType", "MD5"
)
);
String keyvalue = MapUtil.join(map, "&", "=").toUpperCase();
map.put("paySign", DigestUtils.md5DigestAsHex(keyvalue.getBytes(StandardCharsets.UTF_8)).toUpperCase());
if (!createOrder) { if (!createOrder) {
return GlobalResponse.failure("创建订单失败"); return GlobalResponse.failure("创建订单失败");
} }
// 如果创建订单成功就把数据记录在后台管理系统里面
PayOrderCreateReqDTO dto = new PayOrderCreateReqDTO();
BigDecimal money = acdrOrder.getPrice().multiply(new BigDecimal("100"));
dto.setAppId(Config.PAY_APP_NO)
.setPrice(money.intValue())
.setSubject("宠物师服务")
.setBody("宠物是服务")
.setMerchantOrderId(String.valueOf(acdrOrder.getId()))
.setUserIp(ServletUtils.getClientIP())
.setExpireTime(acdrOrder.getExpireTime());
Long platformOrderId = payOrderApi.createOrder(dto);
acdrOrder.setPlatformOrderId(platformOrderId);
orderService.updateById(acdrOrder);
// 创建订单成功 // 创建订单成功
return GlobalResponse.success("新增成功!", MapUtil.ofEntries( return GlobalResponse.success("新增成功!", acdrOrder);
MapUtil.entry("payData", map),
MapUtil.entry("orderData", order)
));
} }
@ApiOperation(value = "订单支付") @ApiOperation(value = "订单支付")
@ -147,29 +149,31 @@ public class OrderController {
public GlobalResponse<String> pay(@PathVariable Long orderId, public GlobalResponse<String> pay(@PathVariable Long orderId,
// 这个是发送支付的信息过来 // 这个是发送支付的信息过来
@RequestBody Map<String, Object> payData) { @RequestBody Map<String, Object> payData) {
// 获取该支付的订单号 // 获取该支付的订单号
Order order = orderService.getById(orderId); AcdrOrder acdrOrder = orderService.getById(orderId);
// 判断订单的状态如果不为等待支付则返回错误 // 判断订单的状态如果不为等待支付则返回错误
if (!order.getState().equals(OrderState.待支付)) { if (!acdrOrder.getState().equals(OrderState.待支付)) {
return GlobalResponse.failure("您无法支付已经取消或者已经支付的订单"); throw new RuntimeException("您无法支付已经取消或者已经支付的订单");
} }
if (order.getState().equals(OrderState.已取消)) { acdrOrder.setState(OrderState.已支付)
return GlobalResponse.failure("该订单已取消请重新生成");
}
order.setState(OrderState.已支付)
.setIsPay(true); .setIsPay(true);
boolean update = orderService.updateById(order); boolean update = orderService.updateById(acdrOrder);
if (update) { if (!update) {
return GlobalResponse.failure("支付失败!"); throw new RuntimeException("订单支付失败");
} }
// 保存每一笔支付日志 // 保存每一笔支付日志
payService.save(new PayInfo() payService.save(new PayInfo()
.setAmount(order.getPrice()) .setAmount(acdrOrder.getPrice())
.setPaymentOrder(order.getId()) .setPaymentOrder(acdrOrder.getId())
.setPayee(order.getPersonalServiceUserId()) .setPayee(acdrOrder.getPersonalServiceUserId())
.setPaymentInfo("宠托师服务支付") .setPaymentInfo("宠托师服务支付")
.setType(PayType.支出)); .setType(PayType.支出));
// TODO 这里应该编写逻辑通知宠托师用户已经支付了订单
acdrOrder.setState(OrderState.待接单);
// 更新数据状态
orderService.updateById(acdrOrder);
return GlobalResponse.success("订单支付成功!"); return GlobalResponse.success("订单支付成功!");
} }
@ -183,31 +187,31 @@ public class OrderController {
public GlobalResponse<String> confirm( public GlobalResponse<String> confirm(
@PathVariable Long orderId) throws IOException { @PathVariable Long orderId) throws IOException {
// 判断是否是自己的订单信息,如果不是则该用户没有权限确认订单信息 // 判断是否是自己的订单信息,如果不是则该用户没有权限确认订单信息
Order order = orderService.lambdaQuery() AcdrOrder acdrOrder = orderService.lambdaQuery()
.eq(Order::getPersonalServiceUserId, AuthApi.getLoginIdAsLong()) .eq(AcdrOrder::getPersonalServiceUserId, AuthApi.getLoginIdAsLong())
.eq(Order::getId, orderId).one(); .eq(AcdrOrder::getId, orderId).one();
if (order == null) { if (acdrOrder == null) {
return GlobalResponse.failure("该订单信息已失效或者不是属于您的预约订单!"); return GlobalResponse.failure("该订单信息已失效或者不是属于您的预约订单!");
} }
// 判断该订单是否过期 // 判断该订单是否过期
if (order.getState().equals(OrderState.已取消)) { if (acdrOrder.getState().equals(OrderState.已取消)) {
return GlobalResponse.failure("该订单信息已过期!"); return GlobalResponse.failure("该订单信息已过期!");
} }
// 判断该订单是否已经被确定 // 判断该订单是否已经被确定
if (order.getState().equals(OrderState.已接单)) { if (acdrOrder.getState().equals(OrderState.已接单)) {
return GlobalResponse.failure("确定过的订单无法再次确定!"); return GlobalResponse.failure("确定过的订单无法再次确定!");
} }
// 判断该订单是否已经生成的二维码信息 // 判断该订单是否已经生成的二维码信息
if (!StrUtil.isBlank(order.getQrcode())) { if (!StrUtil.isBlank(acdrOrder.getQrcode())) {
return GlobalResponse.failure("该订单已经确定过了!"); return GlobalResponse.failure("该订单已经确定过了!");
} }
// 判断是否已经生成的二维码 // 判断是否已经生成的二维码
order.setState(OrderState.已接单); acdrOrder.setState(OrderState.已接单);
// 生成唯一ID // 生成唯一ID
QrCode qrCode = new QrCode().setCreateTime(LocalDateTime.now()) QrCode qrCode = new QrCode().setCreateTime(LocalDateTime.now())
.setServiceUserId(order.getPersonalServiceUserId()) .setServiceUserId(acdrOrder.getPersonalServiceUserId())
.setExpiredTime(order.getReservationTime().plusHours(serviceConfig.getServiceExpiredTime())) .setExpiredTime(acdrOrder.getReservationTime().plusHours(serviceConfig.getServiceExpiredTime()))
.setData(order.getId().toString()) .setData(acdrOrder.getId().toString())
.setIsUse(false); .setIsUse(false);
qrCodeMapper.insert(qrCode); qrCodeMapper.insert(qrCode);
@ -221,8 +225,8 @@ public class OrderController {
qrCode.setImgUrl(file.getUrl()); qrCode.setImgUrl(file.getUrl());
qrCodeMapper.updateById(qrCode); qrCodeMapper.updateById(qrCode);
order.setQrcode(file.getUrl()); acdrOrder.setQrcode(file.getUrl());
orderService.updateById(order); orderService.updateById(acdrOrder);
return GlobalResponse.success("确认客户预约成功!"); return GlobalResponse.success("确认客户预约成功!");
} }
@ -246,21 +250,27 @@ public class OrderController {
} }
// 获取订单信息 // 获取订单信息
String orderId = qrCode.getData(); String orderId = qrCode.getData();
Order order = orderService.getById(orderId); AcdrOrder acdrOrder = orderService.getById(orderId);
// 更新二维码状态 // 更新二维码状态
qrCode.setIsUse(true); qrCode.setIsUse(true);
qrCodeMapper.updateById(qrCode); qrCodeMapper.updateById(qrCode);
// 更新订单状态 // 更新订单状态
order.setState(OrderState.执行中); acdrOrder.setState(OrderState.执行中);
orderService.updateById(order); orderService.updateById(acdrOrder);
// 生成给宠托师的支付信息 // TODO 理论上这个到时间了才给分润的不过在这里就直接完成方便测试
// TODO 生成给宠托师的支付信息
PayInfo payInfo = new PayInfo() PayInfo payInfo = new PayInfo()
.setUserId(AuthApi.getLoginIdAsLong()) .setUserId(AuthApi.getLoginIdAsLong())
.setType(PayType.收入) .setType(PayType.收入)
.setPaymentOrder(order.getId()) .setPaymentOrder(acdrOrder.getId())
.setPayee(order.getUserId()) .setPayee(acdrOrder.getUserId())
.setAmount(order.getPrice()); .setAmount(acdrOrder.getPrice()
.subtract(acdrOrder.getPrice().multiply(new BigDecimal("0.1")))
.setScale(2, RoundingMode.UP)); // 设置小数位数并进一
payService.save(payInfo); payService.save(payInfo);
// 更新订单状态
acdrOrder.setState(OrderState.已完成);
orderService.updateById(acdrOrder);
return GlobalResponse.success("二维码扫描成功,该订单已完成!"); return GlobalResponse.success("二维码扫描成功,该订单已完成!");
} }
@ -277,20 +287,20 @@ public class OrderController {
public GlobalResponse<String> bookingCancel(@PathVariable Long orderId, public GlobalResponse<String> bookingCancel(@PathVariable Long orderId,
@RequestParam String shopRemark) { @RequestParam String shopRemark) {
Order order = orderService.lambdaQuery() AcdrOrder acdrOrder = orderService.lambdaQuery()
.eq(Order::getPersonalServiceUserId, AuthApi.getLoginIdAsLong()) .eq(AcdrOrder::getPersonalServiceUserId, AuthApi.getLoginIdAsLong())
.eq(Order::getId, orderId).one(); .eq(AcdrOrder::getId, orderId).one();
if (order == null) { if (acdrOrder == null) {
return GlobalResponse.failure("没有该订单信息!"); return GlobalResponse.failure("没有该订单信息!");
} }
// 判断该订单是否过期 // 判断该订单是否过期
if (order.getState().equals(OrderState.已取消)) { if (acdrOrder.getState().equals(OrderState.已取消)) {
return GlobalResponse.failure("该订单信息已过期!"); return GlobalResponse.failure("该订单信息已过期!");
} }
// 设置该订单状态为取消 // 设置该订单状态为取消
order.setState(OrderState.被商家_宠托师取消) acdrOrder.setState(OrderState.被商家_宠托师取消)
.setShopRemark(shopRemark); .setShopRemark(shopRemark);
orderService.updateById(order); orderService.updateById(acdrOrder);
return GlobalResponse.success("取消客户预约成功!"); return GlobalResponse.success("取消客户预约成功!");
} }
@ -304,19 +314,19 @@ public class OrderController {
@PostMapping(value = "/cancel/{orderId}") @PostMapping(value = "/cancel/{orderId}")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public GlobalResponse<String> cancel(@PathVariable Long orderId) { public GlobalResponse<String> cancel(@PathVariable Long orderId) {
Order order = orderService.lambdaQuery() AcdrOrder acdrOrder = orderService.lambdaQuery()
.eq(Order::getUserId, AuthApi.getLoginIdAsLong()) .eq(AcdrOrder::getUserId, AuthApi.getLoginIdAsLong())
.eq(Order::getId, orderId).one(); .eq(AcdrOrder::getId, orderId).one();
if (order == null) { if (acdrOrder == null) {
return GlobalResponse.failure("没有该订单信息!"); return GlobalResponse.failure("没有该订单信息!");
} }
// 判断该订单是否过期 // 判断该订单是否过期
if (order.getState().equals(OrderState.已取消)) { if (acdrOrder.getState().equals(OrderState.已取消)) {
return GlobalResponse.failure("该订单信息已过期,或者已取消!"); return GlobalResponse.failure("该订单信息已过期,或者已取消!");
} }
// 设置该订单状态为取消 // 设置该订单状态为取消
order.setState(OrderState.已取消); acdrOrder.setState(OrderState.已取消);
orderService.updateById(order); orderService.updateById(acdrOrder);
return GlobalResponse.success("取消客户预约成功!"); return GlobalResponse.success("取消客户预约成功!");
} }
@ -329,17 +339,16 @@ public class OrderController {
@ApiOperation(value = "查询指定用户所有的订单信息") @ApiOperation(value = "查询指定用户所有的订单信息")
@PostMapping("/query") @PostMapping("/query")
public GlobalResponse<Map<String, Object>> orders( public GlobalResponse<Map<String, Object>> orders(
@RequestBody GlobalResponse<Order> page, @RequestBody GlobalResponse<AcdrOrder> page,
@RequestParam String state) { @RequestParam String state) {
// 判断是否要查询全部的数据 // 判断是否要查询全部的数据
boolean isAll = StrUtil.isBlank(state); boolean isAll = StrUtil.isBlank(state);
OrderState orderState = OrderState.valueOf(state);
// 这个接口只能查自己的订单信息 // 这个接口只能查自己的订单信息
GlobalResponse<Order> res = orderService.lambdaQuery() GlobalResponse<AcdrOrder> res = orderService.lambdaQuery()
.eq(Order::getUserId, AuthApi.getLoginIdAsLong()) .eq(AcdrOrder::getUserId, AuthApi.getLoginIdAsLong())
.eq(!isAll, Order::getState, .eq(!isAll, AcdrOrder::getState,
isAll ? OrderState.待支付 : OrderState.valueOf(state)) isAll ? OrderState.待支付 : OrderState.valueOf(state))
// .ge(isAll, Order::getState, OrderState.WAIT_PAY)
// .le(isAll, Order::getState, OrderState.EVALUATED)
.page(page); .page(page);
GlobalResponse<Map<String, Object>> response = new GlobalResponse<>(); GlobalResponse<Map<String, Object>> response = new GlobalResponse<>();
response.setTotal(res.getTotal()) response.setTotal(res.getTotal())
@ -363,19 +372,20 @@ public class OrderController {
/** /**
* 获取目前宠托师所有的订单信息 * 获取目前宠托师所有的订单信息
*
* @author 林河 * @author 林河
*/ */
@ApiOperation(value = "查询指定用户所有的订单信息") @ApiOperation(value = "查询指定用户所有的订单信息")
@PostMapping("/ptOrdersInfo") @PostMapping("/ptOrdersInfo")
public GlobalResponse<Map<String, Object>> ptOrdersInfo() { public GlobalResponse<Map<String, Object>> ptOrdersInfo() {
List<Order> orders = orderService.lambdaQuery() List<AcdrOrder> acdrOrders = orderService.lambdaQuery()
.eq(Order::getPersonalServiceUserId, AuthApi.getLoginIdAsLong()) .eq(AcdrOrder::getPersonalServiceUserId, AuthApi.getLoginIdAsLong())
.and(wrapper -> wrapper.eq(Order::getState, OrderState.已支付) .and(wrapper ->
.or() wrapper.eq(AcdrOrder::getState, OrderState.待接单)
.eq(Order::getState, OrderState.已接单)) .or().eq(AcdrOrder::getState, OrderState.已接单))
.list(); .list();
var maps = orders.stream().map(orderService::orderInfo).toList(); var maps = acdrOrders.stream().map(orderService::orderInfo).toList();
return GlobalResponse.success("获取订阅用户信息成功!", maps); return GlobalResponse.success("获取当前用户手中所有订单成功!", maps);
} }
} }

View File

@ -12,9 +12,6 @@ import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import cn.yskj.linghe.module.acdr.controller.app.common.ExtendEntity;
import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.*; import jakarta.validation.constraints.*;
@ -22,7 +19,6 @@ import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.ToString; import lombok.ToString;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
/** /**
* <p> * <p>
@ -38,7 +34,7 @@ import org.springframework.format.annotation.DateTimeFormat;
@Accessors(chain = true) @Accessors(chain = true)
@TableName("acdr_order") @TableName("acdr_order")
@ApiModel(value = "Order对象", description = "订单实体类") @ApiModel(value = "Order对象", description = "订单实体类")
public class Order extends ExtendEntity implements Serializable { public class AcdrOrder extends ExtendEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -54,8 +50,6 @@ public class Order extends ExtendEntity implements Serializable {
@ApiModelProperty("预约时间") @ApiModelProperty("预约时间")
@TableField("reservation_time") @TableField("reservation_time")
@NotNull(message = "预约时间不能为空") @NotNull(message = "预约时间不能为空")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime reservationTime; private LocalDateTime reservationTime;
@ApiModelProperty("服务的小时") @ApiModelProperty("服务的小时")
@ -65,6 +59,8 @@ public class Order extends ExtendEntity implements Serializable {
@Max(value = 12, message = "服务的小时数不能大于12") @Max(value = 12, message = "服务的小时数不能大于12")
private Long serviceHours; private Long serviceHours;
private LocalDateTime expireTime;
@ApiModelProperty("被预约的服务主键") @ApiModelProperty("被预约的服务主键")
@TableField("personal_service_id") @TableField("personal_service_id")
@NotNull(message = "预约服务ID不能为空") @NotNull(message = "预约服务ID不能为空")
@ -133,4 +129,7 @@ public class Order extends ExtendEntity implements Serializable {
@TableField("order_error") @TableField("order_error")
private int orderError; private int orderError;
@TableField("platform_order_id")
private Long platformOrderId;
} }

View File

@ -1,6 +1,6 @@
package cn.yskj.linghe.module.acdr.controller.app.order.mapper; package cn.yskj.linghe.module.acdr.controller.app.order.mapper;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order; import cn.yskj.linghe.module.acdr.controller.app.order.entity.AcdrOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -13,6 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
* @since 2024-08-15 * @since 2024-08-15
*/ */
@Mapper @Mapper
public interface AppOrderMapper extends BaseMapper<Order> { public interface AppOrderMapper extends BaseMapper<AcdrOrder> {
} }

View File

@ -1,6 +1,6 @@
package cn.yskj.linghe.module.acdr.controller.app.order.scheduling; package cn.yskj.linghe.module.acdr.controller.app.order.scheduling;
import cn.yskj.linghe.module.acdr.controller.app.order.service.OrderService; import cn.yskj.linghe.module.acdr.controller.app.order.service.AcdrOrderService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
@ -11,7 +11,7 @@ import org.springframework.stereotype.Component;
public class OrderScheduledTasks { public class OrderScheduledTasks {
@Resource @Resource
private OrderService orderService; private AcdrOrderService orderService;
// 每隔5秒钟执行一次,在上一次执行完之后,等五秒再次执行 // 每隔5秒钟执行一次,在上一次执行完之后,等五秒再次执行
@Scheduled(fixedDelay = 5000) @Scheduled(fixedDelay = 5000)

View File

@ -1,7 +1,6 @@
package cn.yskj.linghe.module.acdr.controller.app.order.service; package cn.yskj.linghe.module.acdr.controller.app.order.service;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order; import cn.yskj.linghe.module.acdr.controller.app.order.entity.AcdrOrder;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map; import java.util.Map;
@ -14,12 +13,12 @@ import java.util.Map;
* @author 林河 * @author 林河
* @since 2024-08-15 * @since 2024-08-15
*/ */
public interface OrderService extends IService<Order> { public interface AcdrOrderService extends IService<AcdrOrder> {
Map<String, Object> orderInfo(Order order); Map<String, Object> orderInfo(AcdrOrder acdrOrder);
// 判断该宠托师是否已经被预约 // 判断该宠托师是否已经被预约
boolean isBooking(Order order); boolean isBooking(AcdrOrder acdrOrder);
// 检查订单状态并且更新 // 检查订单状态并且更新
boolean checkStateAndUpdate(); boolean checkStateAndUpdate();

View File

@ -3,7 +3,7 @@ package cn.yskj.linghe.module.acdr.controller.app.order.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.yskj.linghe.module.acdr.controller.app.address.entity.ChinaAddress; import cn.yskj.linghe.module.acdr.controller.app.address.entity.ChinaAddress;
import cn.yskj.linghe.module.acdr.controller.app.address.service.ChinaAddressService; import cn.yskj.linghe.module.acdr.controller.app.address.service.ChinaAddressService;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order; import cn.yskj.linghe.module.acdr.controller.app.order.entity.AcdrOrder;
import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState; import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState;
import cn.yskj.linghe.module.acdr.controller.app.personal.entity.PersonalService; import cn.yskj.linghe.module.acdr.controller.app.personal.entity.PersonalService;
import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService; import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService;
@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.yskj.linghe.module.acdr.controller.app.order.mapper.AppOrderMapper; import cn.yskj.linghe.module.acdr.controller.app.order.mapper.AppOrderMapper;
import cn.yskj.linghe.module.acdr.controller.app.order.service.OrderService; import cn.yskj.linghe.module.acdr.controller.app.order.service.AcdrOrderService;
import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetInfoService; import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetInfoService;
import cn.yskj.linghe.module.acdr.controller.app.user.entity.Users; import cn.yskj.linghe.module.acdr.controller.app.user.entity.Users;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -33,7 +33,7 @@ import java.util.Map;
*/ */
@Service @Service
@Slf4j @Slf4j
public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> implements OrderService { public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, AcdrOrder> implements AcdrOrderService {
@Resource @Resource
private ChinaAddressService addressService; private ChinaAddressService addressService;
@ -48,8 +48,8 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> impleme
private PersonalServiceService personalServiceService; private PersonalServiceService personalServiceService;
@Override @Override
public Map<String, Object> orderInfo(Order order) { public Map<String, Object> orderInfo(AcdrOrder acdrOrder) {
Map<String, Object> obj = BeanUtil.beanToMap(order); Map<String, Object> obj = BeanUtil.beanToMap(acdrOrder);
PetInfo pet = petInfoService.getById((Long) obj.get("pet")); PetInfo pet = petInfoService.getById((Long) obj.get("pet"));
obj.put("pet", pet); obj.put("pet", pet);
ChinaAddress address = addressService.getById((Long) obj.get("address")); ChinaAddress address = addressService.getById((Long) obj.get("address"));
@ -65,19 +65,19 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> impleme
// 判断该宠托师是否已经被预约 // 判断该宠托师是否已经被预约
@Override @Override
public boolean isBooking(Order order) { public boolean isBooking(AcdrOrder acdrOrder) {
// 判断当前被预约用户是否有时间, 没有时间就返回相关错误信息 // 判断当前被预约用户是否有时间, 没有时间就返回相关错误信息
var wrapper = new LambdaQueryWrapper<Order>(); var wrapper = new LambdaQueryWrapper<AcdrOrder>();
LocalDateTime rtInterval = order.getReservationTime(); LocalDateTime rtInterval = acdrOrder.getReservationTime();
LocalDateTime addAfterTime = rtInterval.plusHours(order.getServiceHours()); LocalDateTime addAfterTime = rtInterval.plusHours(acdrOrder.getServiceHours());
wrapper.eq(Order::getPersonalServiceUserId, order.getPersonalServiceUserId()) wrapper.eq(AcdrOrder::getPersonalServiceUserId, acdrOrder.getPersonalServiceUserId())
// 判断当前订单状态 // 判断当前订单状态
.and(l -> l.ge(Order::getState, OrderState.已支付) .and(l -> l.ge(AcdrOrder::getState, OrderState.已支付)
.le(Order::getState, OrderState.已评价)) .le(AcdrOrder::getState, OrderState.已评价))
// 判断预约时间是否正确 // 判断预约时间是否正确
.and(l -> l.ge(Order::getReservationTime, order.getReservationTime()) .and(l -> l.ge(AcdrOrder::getReservationTime, acdrOrder.getReservationTime())
.le(Order::getReservationTime, addAfterTime)); .le(AcdrOrder::getReservationTime, addAfterTime));
Order one = this.getOne(wrapper); AcdrOrder one = this.getOne(wrapper);
return one != null; return one != null;
} }
@ -88,9 +88,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> impleme
// 这一块逻辑是判断订单是否支付 // 这一块逻辑是判断订单是否支付
// 获取当前时间 // 获取当前时间
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<AcdrOrder> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(Order::getState, OrderState.已取消) updateWrapper.set(AcdrOrder::getState, OrderState.已取消)
.eq(Order::getState, OrderState.待支付) .eq(AcdrOrder::getState, OrderState.待支付)
// 判断当前时间是不是大于订单过期时间 // 判断当前时间是不是大于订单过期时间
.apply("DATE_ADD(create_time, INTERVAL 15 MINUTE) < {0}", now); .apply("DATE_ADD(create_time, INTERVAL 15 MINUTE) < {0}", now);
// 执行更新操作 // 执行更新操作
@ -99,9 +99,9 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> impleme
// 判断宠托师是否接单 // 判断宠托师是否接单
// 这里是处理如果没有被接单的情况(10小时之内) // 这里是处理如果没有被接单的情况(10小时之内)
LambdaUpdateWrapper<Order> payE = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<AcdrOrder> payE = new LambdaUpdateWrapper<>();
payE.set(Order::getState, OrderState.已超时) payE.set(AcdrOrder::getState, OrderState.已超时)
.eq(Order::getState, OrderState.待接单) .eq(AcdrOrder::getState, OrderState.待接单)
.apply("DATE_ADD(create_time, INTERVAL 10 HOUR) < {0}", now); .apply("DATE_ADD(create_time, INTERVAL 10 HOUR) < {0}", now);
boolean payEUpdate = this.update(null, payE); boolean payEUpdate = this.update(null, payE);
//if (!payEUpdate) log.info("订单接单状态更新为空"); //if (!payEUpdate) log.info("订单接单状态更新为空");
@ -109,18 +109,18 @@ public class OrderServiceImpl extends ServiceImpl<AppOrderMapper, Order> impleme
// 判断购买的订单(服务劵)是否过期 // 判断购买的订单(服务劵)是否过期
// 判断宠托师是否在指定的时间内服务了 // 判断宠托师是否在指定的时间内服务了
// 如果超过了服务时间 // 如果超过了服务时间
LambdaUpdateWrapper<Order> timeIf = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<AcdrOrder> timeIf = new LambdaUpdateWrapper<>();
timeIf.set(Order::getState, OrderState.已超时) timeIf.set(AcdrOrder::getState, OrderState.已超时)
.eq(Order::getState, OrderState.已接单) .eq(AcdrOrder::getState, OrderState.已接单)
.apply("reservation_time < {0}", now); .apply("reservation_time < {0}", now);
boolean timeIfUpdate = this.update(null, timeIf); boolean timeIfUpdate = this.update(null, timeIf);
//if (!timeIfUpdate) log.info("订单服务时间更新为空"); //if (!timeIfUpdate) log.info("订单服务时间更新为空");
// 该订单如果一直在执行中(超过了24个小时)则触发程序保护机制强制让该订单完结并缓存该订单 // 该订单如果一直在执行中(超过了24个小时)则触发程序保护机制强制让该订单完结并缓存该订单
LambdaUpdateWrapper<Order> execIf = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<AcdrOrder> execIf = new LambdaUpdateWrapper<>();
execIf.set(Order::getFinishTime, now) execIf.set(AcdrOrder::getFinishTime, now)
.set(Order::getState, OrderState.待分润) .set(AcdrOrder::getState, OrderState.待分润)
.eq(Order::getState, OrderState.已接单) .eq(AcdrOrder::getState, OrderState.已接单)
.apply("DATE_ADD(reservation_time, INTERVAL 24 HOUR) < {0}", now); .apply("DATE_ADD(reservation_time, INTERVAL 24 HOUR) < {0}", now);
boolean execIfUpdate = this.update(null, execIf); boolean execIfUpdate = this.update(null, execIf);
//if (!execIfUpdate) log.error("已接单服务时间更新为空"); //if (!execIfUpdate) log.error("已接单服务时间更新为空");

View File

@ -1,20 +1,12 @@
package cn.yskj.linghe.module.acdr.controller.app.personal.controller; package cn.yskj.linghe.module.acdr.controller.app.personal.controller;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.yskj.linghe.module.acdr.controller.app.address.service.ServiceAddressService; import cn.hutool.core.util.StrUtil;
import cn.yskj.linghe.module.acdr.controller.app.personal.entity.PersonalService;
import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService;
import cn.yskj.linghe.module.acdr.controller.app.pet.entity.PetInfo;
import cn.yskj.linghe.module.acdr.controller.app.pet.entity.PetSpecialistCertificate;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import cn.yskj.linghe.module.acdr.common.response.GlobalResponse; import cn.yskj.linghe.module.acdr.common.response.GlobalResponse;
import cn.yskj.linghe.module.acdr.controller.app.address.service.ServiceAddressService; import cn.yskj.linghe.module.acdr.controller.app.address.service.ServiceAddressService;
import cn.yskj.linghe.module.acdr.controller.app.order.entity.Order; import cn.yskj.linghe.module.acdr.controller.app.order.entity.AcdrOrder;
import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState; import cn.yskj.linghe.module.acdr.controller.app.order.orderenum.OrderState;
import cn.yskj.linghe.module.acdr.controller.app.order.service.OrderService; import cn.yskj.linghe.module.acdr.controller.app.order.service.AcdrOrderService;
import cn.yskj.linghe.module.acdr.controller.app.personal.entity.PersonalService; import cn.yskj.linghe.module.acdr.controller.app.personal.entity.PersonalService;
import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService; import cn.yskj.linghe.module.acdr.controller.app.personal.service.PersonalServiceService;
import cn.yskj.linghe.module.acdr.controller.app.pet.entity.PetInfo; import cn.yskj.linghe.module.acdr.controller.app.pet.entity.PetInfo;
@ -23,6 +15,10 @@ import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetInfoService;
import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetSpecialistCertificateService; import cn.yskj.linghe.module.acdr.controller.app.pet.service.PetSpecialistCertificateService;
import cn.yskj.linghe.module.acdr.controller.app.user.entity.Users; import cn.yskj.linghe.module.acdr.controller.app.user.entity.Users;
import cn.yskj.linghe.module.acdr.controller.app.user.service.UsersService; import cn.yskj.linghe.module.acdr.controller.app.user.service.UsersService;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.validation.groups.Default; import jakarta.validation.groups.Default;
@ -68,7 +64,7 @@ public class PersonalServiceController {
private PetSpecialistCertificateService pscs; private PetSpecialistCertificateService pscs;
@Resource @Resource
private OrderService orderService; private AcdrOrderService orderService;
@PostMapping("/push") @PostMapping("/push")
@ -160,29 +156,29 @@ public class PersonalServiceController {
* @author linghe * @author linghe
* 展示宠物个人服务详细信息 * 展示宠物个人服务详细信息
* 返回如下数据 * 返回如下数据
* // 将这些数据都打散装配到Map当中 * // 将这些数据都打散装配到Map当中
* var map = MapUtil.<String, Object>builder() * var map = MapUtil.<String, Object>builder()
* .put("serviceId", p.getId()) * .put("serviceId", p.getId())
* .put("serviceName", p.getServiceName()) * .put("serviceName", p.getServiceName())
* .put("bgUrl", p.getUrl()) * .put("bgUrl", p.getUrl())
* .put("description", p.getDescription()) * .put("description", p.getDescription())
* .put("serviceType", p.getType()) * .put("serviceType", p.getType())
* .put("latitude", p.getLatitude()) * .put("latitude", p.getLatitude())
* .put("longitude", p.getLongitude()) * .put("longitude", p.getLongitude())
* .put("address", p.getAddress()) * .put("address", p.getAddress())
* .put("serviceState", p.getState()) * .put("serviceState", p.getState())
* .put("createTime", p.getCreateTime()) * .put("createTime", p.getCreateTime())
* .put("updateTime", p.getUpdateTime()) * .put("updateTime", p.getUpdateTime())
* .put("price", p.getPrice()) * .put("price", p.getPrice())
* .put("serviceUserId", p.getUserId()) // 服务者ID * .put("serviceUserId", p.getUserId()) // 服务者ID
* .put("userName", user.getNickname()) * .put("userName", user.getNickname())
* .put("userAvatar", user.getAvatar()) * .put("userAvatar", user.getAvatar())
* .put("pets", pets) * .put("pets", pets)
* // 添加认证时间 * // 添加认证时间
* .put("certificationTime", calculateTimeDifference(LocalDateTime.now(), psc.getCreateTime())) * .put("certificationTime", calculateTimeDifference(LocalDateTime.now(), psc.getCreateTime()))
* .put("serviceNumber", psc.getServiceNumber()) * .put("serviceNumber", psc.getServiceNumber())
* .put("comments", comments) * .put("comments", comments)
* .map(); * .map();
*/ */
@GetMapping("/service/{id}") @GetMapping("/service/{id}")
public GlobalResponse<Map<String, Object>> personalDetail(@PathVariable Long id) { public GlobalResponse<Map<String, Object>> personalDetail(@PathVariable Long id) {
@ -214,32 +210,32 @@ public class PersonalServiceController {
// 获取该宠托师以往的订单评论信息, 只获取历史数据的前一条 // 获取该宠托师以往的订单评论信息, 只获取历史数据的前一条
// 获取服务次数 // 获取服务次数
long commitNums = orderService.count(new LambdaQueryWrapper<Order>() long commitNums = orderService.count(new LambdaQueryWrapper<AcdrOrder>()
.eq(Order::getPersonalServiceUserId, userId) .eq(AcdrOrder::getPersonalServiceUserId, userId)
.eq(Order::getState, OrderState.已评价) .eq(AcdrOrder::getState, OrderState.已评价)
.isNotNull(Order::getFeedback) .isNotNull(AcdrOrder::getFeedback)
.isNotNull(Order::getStar)); .isNotNull(AcdrOrder::getStar));
// 获取之后获取该用户的评论信息 // 获取之后获取该用户的评论信息
Order commentsOrder = null; AcdrOrder commentsAcdrOrder = null;
if(commitNums > 0) { if (commitNums > 0) {
commentsOrder = orderService.lambdaQuery() commentsAcdrOrder = orderService.lambdaQuery()
.eq(Order::getPersonalServiceUserId, userId) .eq(AcdrOrder::getPersonalServiceUserId, userId)
.eq(Order::getState, OrderState.已评价) .eq(AcdrOrder::getState, OrderState.已评价)
.isNotNull(Order::getFeedback) .isNotNull(AcdrOrder::getFeedback)
.isNotNull(Order::getStar) .isNotNull(AcdrOrder::getStar)
.orderByDesc(Order::getStar) .orderByDesc(AcdrOrder::getStar)
.orderByDesc(Order::getCreateTime) .orderByDesc(AcdrOrder::getCreateTime)
.last("LIMIT 1") .last("LIMIT 1")
.one(); .one();
} }
Map<String, Object> comments = null; Map<String, Object> comments = null;
if (commentsOrder != null) { if (commentsAcdrOrder != null) {
comments = new HashMap<>(); comments = new HashMap<>();
Users users = usersService.getById(commentsOrder.getUserId()); Users users = usersService.getById(commentsAcdrOrder.getUserId());
comments.put("star", commentsOrder.getStar()); comments.put("star", commentsAcdrOrder.getStar());
comments.put("comment", commentsOrder.getFeedback()); comments.put("comment", commentsAcdrOrder.getFeedback());
comments.put("commentNum", commitNums); comments.put("commentNum", commitNums);
comments.put("userName", users.getNickname()); comments.put("userName", users.getNickname());
comments.put("userAvatar", users.getAvatar()); comments.put("userAvatar", users.getAvatar());
@ -354,9 +350,11 @@ public class PersonalServiceController {
// 构建查询条件 // 构建查询条件
LambdaQueryWrapper<PersonalService> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PersonalService> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PersonalService::getProvince, province) wrapper.eq(StrUtil.isNotBlank(province), PersonalService::getProvince, province)
.eq(PersonalService::getCity, city) .eq(StrUtil.isNotBlank(city), PersonalService::getCity, city)
.eq(PersonalService::getDistrict, district); .eq(StrUtil.isNotBlank(district)
&& !district.equals("[]"),
PersonalService::getDistrict, district);
// 根据服务名称过滤如果提供 // 根据服务名称过滤如果提供
if (serviceName != null && !serviceName.trim().isEmpty()) { if (serviceName != null && !serviceName.trim().isEmpty()) {

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>cn.yskj.dev</groupId> <groupId>cn.yskj.dev</groupId>
<artifactId>yskj-module-contact</artifactId> <artifactId>yskj-module-contact</artifactId>
<version>2.1.0-snapshot</version> <version>${revision}</version>
</parent> </parent>
<artifactId>yskj-module-contact-api</artifactId> <artifactId>yskj-module-contact-api</artifactId>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>cn.yskj.dev</groupId> <groupId>cn.yskj.dev</groupId>
<artifactId>yskj-module-contact</artifactId> <artifactId>yskj-module-contact</artifactId>
<version>2.1.0-snapshot</version> <version>${revision}</version>
</parent> </parent>
<artifactId>yskj-module-contact-biz</artifactId> <artifactId>yskj-module-contact-biz</artifactId>

View File

@ -3,11 +3,8 @@ package cn.yskj.linghe.module.pay.dal.mysql.channel;
import cn.yskj.linghe.framework.mybatis.core.mapper.BaseMapperX; import cn.yskj.linghe.framework.mybatis.core.mapper.BaseMapperX;
import cn.yskj.linghe.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.yskj.linghe.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.yskj.linghe.module.pay.dal.dataobject.channel.PayChannelDO; import cn.yskj.linghe.module.pay.dal.dataobject.channel.PayChannelDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

View File

@ -45,7 +45,9 @@ spring:
primary: master primary: master
datasource: datasource:
master: master:
url: jdbc:mysql://127.0.0.1:3306/cwet?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/cwet?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://116.204.119.171:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/cwet?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@ -53,19 +55,20 @@ spring:
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 # url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
username: root username: acdr
password: root password: linghe2024
# username: sa # SQL Server 连接的示例 # username: sa # SQL Server 连接的示例
# password: Yskj@2024 # SQL Server 连接的示例 # password: Yskj@2024 # SQL Server 连接的示例
# username: SYSDBA # DM 连接的示例 # username: SYSDBA # DM 连接的示例
# password: SYSDBA001 # DM 连接的示例 # password: SYSDBA001 # DM 连接的示例
# username: root # OpenGauss 连接的示例 # username: root # OpenGauss 连接的示例
# password: Yskj@2024 # OpenGauss 连接的示例 # password: Yskj@2024 # OpenGauss 连接的示例
slave: # 模拟从库,可根据自己需要修改 # slave: # 模拟从库,可根据自己需要修改
# lazy: true # 开启懒加载,保证启动速度 # lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://116.204.119.171:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root # url: jdbc:mysql://127.0.0.1:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
password: root # username: acdr
# password: linghe2024
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data: data:

View File

@ -45,7 +45,9 @@ spring:
primary: master primary: master
datasource: datasource:
master: master:
url: jdbc:mysql://127.0.0.1:3306/cwet?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/cwet?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://116.204.119.171:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
url: jdbc:mysql://127.0.0.1:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
@ -53,19 +55,20 @@ spring:
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例 # url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
# url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例
username: root username: acdr
password: root password: linghe2024
# username: sa # SQL Server 连接的示例 # username: sa # SQL Server 连接的示例
# password: Yskj@2024 # SQL Server 连接的示例 # password: Yskj@2024 # SQL Server 连接的示例
# username: SYSDBA # DM 连接的示例 # username: SYSDBA # DM 连接的示例
# password: SYSDBA001 # DM 连接的示例 # password: SYSDBA001 # DM 连接的示例
# username: root # OpenGauss 连接的示例 # username: root # OpenGauss 连接的示例
# password: Yskj@2024 # OpenGauss 连接的示例 # password: Yskj@2024 # OpenGauss 连接的示例
slave: # 模拟从库,可根据自己需要修改 # slave: # 模拟从库,可根据自己需要修改
# lazy: true # 开启懒加载,保证启动速度 # lazy: true # 开启懒加载,保证启动速度
url: jdbc:mysql://127.0.0.1:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://116.204.119.171:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
username: root # url: jdbc:mysql://127.0.0.1:3306/acdr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true
password: root # username: acdr
# password: linghe2024
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
data: data:
@ -221,12 +224,6 @@ yskj:
wxa-code: wxa-code:
env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop" env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop"
tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc
sms-code: # 短信验证码相关的配置项
expire-times: 10m
send-frequency: 1m #方便测试
send-maximum-quantity-per-day: 10 #方便测试
begin-code: 1111 # 这里配置 9999 的原因是,测试方便。
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
justauth: justauth:
enabled: true enabled: true
@ -263,6 +260,11 @@ path:
file: ${path.home}file\ file: ${path.home}file\
profile: ${path.home}profile\ profile: ${path.home}profile\
phone:
key: e1bc0661299f1303aef1c5659d0ae1c6
model: 263680
url: http://v.juhe.cn/sms/send
sky: sky:
wechat: wechat:
appid: wxbcbdfd32af81ee15 appid: wxbcbdfd32af81ee15

View File

@ -1,15 +1,16 @@
# 生产环境:只在打包时使用 # 生产环境:只在打包时使用
NODE_ENV=production NODE_ENV=production
VITE_PORT=8088
VITE_DEV=false VITE_DEV=false
# 请求路径 # 请求路径
VITE_BASE_URL='http://localhost:48080' VITE_BASE_URL='https://api.cwzoonest.cn'
# 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务 # 文件上传类型server - 后端上传, client - 前端直连上传仅支持S3服务
VITE_UPLOAD_TYPE=server VITE_UPLOAD_TYPE=server
# 上传路径 # 上传路径
VITE_UPLOAD_URL='http://localhost:48080/admin-api/infra/file/upload' VITE_UPLOAD_URL='https://api.cwzoonest.cn/admin-api/infra/file/upload'
# 接口地址 # 接口地址
VITE_API_URL=/admin-api VITE_API_URL=/admin-api