Merge remote-tracking branch 'origin/feature/mall_product' into member_dev
# Conflicts: # sql/mysql/member_level.sql # yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberExperienceLogService.java # yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelLogService.java # yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/level/MemberLevelLogServiceImpl.java
This commit is contained in:
commit
4dd2d80887
|
@ -1,36 +0,0 @@
|
||||||
create table member_group
|
|
||||||
(
|
|
||||||
id bigint auto_increment comment '编号' primary key,
|
|
||||||
name varchar(30) default '' not null comment '名称',
|
|
||||||
remark varchar(255) default '' not null comment '备注',
|
|
||||||
status tinyint default 0 not null comment '状态',
|
|
||||||
creator varchar(64) default '' null comment '创建者',
|
|
||||||
create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间',
|
|
||||||
updater varchar(64) default '' null comment '更新者',
|
|
||||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
|
|
||||||
deleted bit default b'0' not null comment '是否删除',
|
|
||||||
tenant_id bigint default 0 not null comment '租户编号'
|
|
||||||
)
|
|
||||||
comment '用户分组';
|
|
||||||
|
|
||||||
alter table member_user add column group_id bigint null comment '用户分组编号';
|
|
||||||
|
|
||||||
-- 菜单 SQL
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status, component_name)
|
|
||||||
VALUES ('用户分组', '', 2, 5, 2262, 'group', '', 'member/group/index', 0, 'MemberGroup');
|
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
|
||||||
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
|
|
||||||
SELECT @parentId := LAST_INSERT_ID();
|
|
||||||
|
|
||||||
-- 按钮 SQL
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
|
|
||||||
VALUES ('用户分组查询', 'member:group:query', 3, 1, @parentId, '', '', '', 0);
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
|
|
||||||
VALUES ('用户分组创建', 'member:group:create', 3, 2, @parentId, '', '', '', 0);
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
|
|
||||||
VALUES ('用户分组更新', 'member:group:update', 3, 3, @parentId, '', '', '', 0);
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
|
|
||||||
VALUES ('用户分组删除', 'member:group:delete', 3, 4, @parentId, '', '', '', 0);
|
|
||||||
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
|
|
||||||
VALUES ('用户分组导出', 'member:group:export', 3, 5, @parentId, '', '', '', 0);
|
|
|
@ -1,10 +1,12 @@
|
||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.ReflectUtil;
|
import cn.hutool.core.util.ReflectUtil;
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
|
||||||
import cn.iocoder.yudao.framework.pay.core.client.exception.PayException;
|
import cn.iocoder.yudao.framework.pay.core.client.exception.PayException;
|
||||||
|
@ -16,6 +18,7 @@ import com.alipay.api.DefaultSigner;
|
||||||
import com.alipay.api.domain.AlipayTradeRefundModel;
|
import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||||
import com.alipay.api.request.AlipayTradeRefundRequest;
|
import com.alipay.api.request.AlipayTradeRefundRequest;
|
||||||
import com.alipay.api.response.AlipayTradeRefundResponse;
|
import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.DisplayName;
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentMatcher;
|
import org.mockito.ArgumentMatcher;
|
||||||
|
@ -52,6 +55,12 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest {
|
||||||
|
|
||||||
private AbstractAlipayPayClient client;
|
private AbstractAlipayPayClient client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子类需要实现该方法. 设置 client 的具体实现
|
||||||
|
*/
|
||||||
|
@BeforeEach
|
||||||
|
public abstract void setUp();
|
||||||
|
|
||||||
public void setClient(AbstractAlipayPayClient client) {
|
public void setClient(AbstractAlipayPayClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
@ -177,4 +186,28 @@ public abstract class AbstractAlipayClientTest extends BaseMockitoUnitTest {
|
||||||
// 断言
|
// 断言
|
||||||
assertThrows(PayException.class, () -> client.unifiedRefund(refundReqDTO));
|
assertThrows(PayException.class, () -> client.unifiedRefund(refundReqDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 Client 统一下单, 参数校验不通过")
|
||||||
|
public void test_unified_order_param_validate() {
|
||||||
|
// 准备请求参数
|
||||||
|
String outTradeNo = randomString();
|
||||||
|
String notifyUrl = randomURL();
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = randomPojo(PayOrderUnifiedReqDTO.class, o -> {
|
||||||
|
o.setOutTradeNo(outTradeNo);
|
||||||
|
o.setNotifyUrl(notifyUrl);
|
||||||
|
});
|
||||||
|
// 断言
|
||||||
|
assertThrows(ConstraintViolationException.class, () -> client.unifiedOrder(reqDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected PayOrderUnifiedReqDTO buildOrderUnifiedReqDTO(String notifyUrl, String outTradeNo, Integer price) {
|
||||||
|
return randomPojo(PayOrderUnifiedReqDTO.class, o -> {
|
||||||
|
o.setOutTradeNo(outTradeNo);
|
||||||
|
o.setNotifyUrl(notifyUrl);
|
||||||
|
o.setPrice(price);
|
||||||
|
o.setSubject(RandomUtil.randomString(32));
|
||||||
|
o.setBody(RandomUtil.randomString(32));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,114 @@
|
||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
|
import cn.hutool.http.Method;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.ArgumentMatcher;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED;
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
|
import static org.mockito.ArgumentMatchers.argThat;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
public class AlipayPcPayClientTest extends AbstractAlipayClientTest {
|
||||||
|
|
||||||
|
@InjectMocks
|
||||||
|
private AlipayPcPayClient client = new AlipayPcPayClient(randomLongId(), config);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
setClient(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 PC 网站支付 URL Display Mode 下单成功")
|
||||||
|
public void test_unified_order_url_display_mode_success() throws AlipayApiException {
|
||||||
|
// 准备返回对象
|
||||||
|
String notifyUrl = randomURL();
|
||||||
|
Integer price = randomInteger();
|
||||||
|
AlipayTradePagePayResponse response = randomPojo(AlipayTradePagePayResponse.class, o -> {
|
||||||
|
o.setSubCode("");
|
||||||
|
});
|
||||||
|
// mock
|
||||||
|
when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher<AlipayTradePagePayRequest>) request -> true),
|
||||||
|
eq(Method.GET.name()))).thenReturn(response);
|
||||||
|
// 准备请求参数
|
||||||
|
String outTradeNo = randomString();
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
// 设置 displayMode 为 null.
|
||||||
|
reqDTO.setDisplayMode(null);
|
||||||
|
|
||||||
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(WAITING.getStatus(), resp.getStatus());
|
||||||
|
assertEquals(PayOrderDisplayModeEnum.URL.getMode(), resp.getDisplayMode());
|
||||||
|
assertEquals(outTradeNo, resp.getOutTradeNo());
|
||||||
|
assertSame(response, resp.getRawData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 PC 网站支付 FORM Display Mode 下单成功")
|
||||||
|
public void test_unified_order_form_display_mode_success() throws AlipayApiException {
|
||||||
|
// 准备返回对象
|
||||||
|
String notifyUrl = randomURL();
|
||||||
|
Integer price = randomInteger();
|
||||||
|
AlipayTradePagePayResponse response = randomPojo(AlipayTradePagePayResponse.class, o -> {
|
||||||
|
o.setSubCode("");
|
||||||
|
});
|
||||||
|
// mock
|
||||||
|
when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher<AlipayTradePagePayRequest>) request -> true),
|
||||||
|
eq(Method.POST.name()))).thenReturn(response);
|
||||||
|
// 准备请求参数
|
||||||
|
String outTradeNo = randomString();
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
reqDTO.setDisplayMode(PayOrderDisplayModeEnum.FORM.getMode());
|
||||||
|
|
||||||
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(WAITING.getStatus(), resp.getStatus());
|
||||||
|
assertEquals(PayOrderDisplayModeEnum.FORM.getMode(), resp.getDisplayMode());
|
||||||
|
assertEquals(outTradeNo, resp.getOutTradeNo());
|
||||||
|
assertSame(response, resp.getRawData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 PC 网站支付,渠道返回失败")
|
||||||
|
public void test_unified_order_channel_failed() throws AlipayApiException {
|
||||||
|
// 准备响应对象
|
||||||
|
String subCode = randomString();
|
||||||
|
String subMsg = randomString();
|
||||||
|
AlipayTradePagePayResponse response = randomPojo(AlipayTradePagePayResponse.class, o -> {
|
||||||
|
o.setSubCode(subCode);
|
||||||
|
o.setSubMsg(subMsg);
|
||||||
|
});
|
||||||
|
// mock
|
||||||
|
when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher<AlipayTradePagePayRequest>) request -> true),
|
||||||
|
eq(Method.GET.name()))).thenReturn(response);
|
||||||
|
// 准备请求参数
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(randomURL(), randomString(), randomInteger());
|
||||||
|
reqDTO.setDisplayMode(PayOrderDisplayModeEnum.URL.getMode());
|
||||||
|
|
||||||
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(CLOSED.getStatus(), resp.getStatus());
|
||||||
|
assertEquals(subCode, resp.getChannelErrorCode());
|
||||||
|
assertEquals(subMsg, resp.getChannelErrorMsg());
|
||||||
|
assertSame(response, resp.getRawData());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
|
||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
|
@ -17,8 +16,6 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.mockito.ArgumentMatcher;
|
import org.mockito.ArgumentMatcher;
|
||||||
import org.mockito.InjectMocks;
|
import org.mockito.InjectMocks;
|
||||||
|
|
||||||
import javax.validation.ConstraintViolationException;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED;
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED;
|
||||||
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING;
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
@ -42,11 +39,12 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("支付包扫描支付下单成功")
|
@DisplayName("支付宝扫描支付下单成功")
|
||||||
public void test_unified_order_success() throws AlipayApiException {
|
public void test_unified_order_success() throws AlipayApiException {
|
||||||
// 准备返回对象
|
// 准备返回对象
|
||||||
String notifyUrl = randomURL();
|
String notifyUrl = randomURL();
|
||||||
String qrCode = randomString();
|
String qrCode = randomString();
|
||||||
|
Integer price = randomInteger();
|
||||||
AlipayTradePrecreateResponse response = randomPojo(AlipayTradePrecreateResponse.class, o -> {
|
AlipayTradePrecreateResponse response = randomPojo(AlipayTradePrecreateResponse.class, o -> {
|
||||||
o.setQrCode(qrCode);
|
o.setQrCode(qrCode);
|
||||||
o.setSubCode("");
|
o.setSubCode("");
|
||||||
|
@ -58,7 +56,7 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
||||||
}))).thenReturn(response);
|
}))).thenReturn(response);
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
String outTradeNo = randomString();
|
String outTradeNo = randomString();
|
||||||
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo);
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
|
||||||
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
// 断言
|
// 断言
|
||||||
|
@ -70,11 +68,12 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("支付包扫描支付,渠道返回失败")
|
@DisplayName("支付宝扫描支付,渠道返回失败")
|
||||||
public void test_unified_order_channel_failed() throws AlipayApiException {
|
public void test_unified_order_channel_failed() throws AlipayApiException {
|
||||||
String notifyUrl = randomURL();
|
String notifyUrl = randomURL();
|
||||||
String subCode = randomString();
|
String subCode = randomString();
|
||||||
String subMsg = randomString();
|
String subMsg = randomString();
|
||||||
|
Integer price = randomInteger();
|
||||||
AlipayTradePrecreateResponse response = randomPojo(AlipayTradePrecreateResponse.class, o -> {
|
AlipayTradePrecreateResponse response = randomPojo(AlipayTradePrecreateResponse.class, o -> {
|
||||||
o.setSubCode(subCode);
|
o.setSubCode(subCode);
|
||||||
o.setSubMsg(subMsg);
|
o.setSubMsg(subMsg);
|
||||||
|
@ -86,7 +85,7 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
||||||
}))).thenReturn(response);
|
}))).thenReturn(response);
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
String outTradeNo = randomString();
|
String outTradeNo = randomString();
|
||||||
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo);
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
|
||||||
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
// 断言
|
// 断言
|
||||||
|
@ -97,59 +96,38 @@ public class AlipayQrPayClientTest extends AbstractAlipayClientTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("支付包扫描支付,抛出系统异常")
|
@DisplayName("支付宝扫描支付, 抛出系统异常")
|
||||||
public void test_unified_order_throw_pay_exception() throws AlipayApiException {
|
public void test_unified_order_throw_pay_exception() throws AlipayApiException {
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
String outTradeNo = randomString();
|
String outTradeNo = randomString();
|
||||||
String notifyUrl = randomURL();
|
String notifyUrl = randomURL();
|
||||||
|
Integer price = randomInteger();
|
||||||
// mock
|
// mock
|
||||||
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
||||||
assertEquals(notifyUrl, request.getNotifyUrl());
|
assertEquals(notifyUrl, request.getNotifyUrl());
|
||||||
return true;
|
return true;
|
||||||
}))).thenThrow(new RuntimeException("系统异常"));
|
}))).thenThrow(new RuntimeException("系统异常"));
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo);
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo,price);
|
||||||
// 断言
|
// 断言
|
||||||
assertThrows(PayException.class, () -> client.unifiedOrder(reqDTO));
|
assertThrows(PayException.class, () -> client.unifiedOrder(reqDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@DisplayName("支付包扫描支付,抛出业务异常")
|
@DisplayName("支付宝 Client 统一下单,抛出业务异常")
|
||||||
public void test_unified_order_throw_service_exception() throws AlipayApiException {
|
public void test_unified_order_throw_service_exception() throws AlipayApiException {
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
String outTradeNo = randomString();
|
String outTradeNo = randomString();
|
||||||
String notifyUrl = randomURL();
|
String notifyUrl = randomURL();
|
||||||
|
Integer price = randomInteger();
|
||||||
// mock
|
// mock
|
||||||
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
when(defaultAlipayClient.execute(argThat((ArgumentMatcher<AlipayTradePrecreateRequest>) request -> {
|
||||||
assertEquals(notifyUrl, request.getNotifyUrl());
|
assertEquals(notifyUrl, request.getNotifyUrl());
|
||||||
return true;
|
return true;
|
||||||
}))).thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
}))).thenThrow(ServiceExceptionUtil.exception(GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR));
|
||||||
// 准备请求参数
|
// 准备请求参数
|
||||||
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo);
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
// 断言
|
// 断言
|
||||||
assertThrows(ServiceException.class, () -> client.unifiedOrder(reqDTO));
|
assertThrows(ServiceException.class, () -> client.unifiedOrder(reqDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("支付包扫描支付,参数校验不通过")
|
|
||||||
public void test_unified_order_param_validate() {
|
|
||||||
// 准备请求参数
|
|
||||||
String outTradeNo = randomString();
|
|
||||||
String notifyUrl = randomURL();
|
|
||||||
PayOrderUnifiedReqDTO reqDTO = randomPojo(PayOrderUnifiedReqDTO.class, o -> {
|
|
||||||
o.setOutTradeNo(outTradeNo);
|
|
||||||
o.setNotifyUrl(notifyUrl);
|
|
||||||
});
|
|
||||||
// 断言
|
|
||||||
assertThrows(ConstraintViolationException.class, () -> client.unifiedOrder(reqDTO));
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayOrderUnifiedReqDTO buildOrderUnifiedReqDTO(String notifyUrl, String outTradeNo) {
|
|
||||||
return randomPojo(PayOrderUnifiedReqDTO.class, o -> {
|
|
||||||
o.setOutTradeNo(outTradeNo);
|
|
||||||
o.setNotifyUrl(notifyUrl);
|
|
||||||
o.setSubject(RandomUtil.randomString(32));
|
|
||||||
o.setBody(RandomUtil.randomString(32));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
|
||||||
|
|
||||||
|
import cn.hutool.http.Method;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
|
||||||
|
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.domain.AlipayTradeWapPayModel;
|
||||||
|
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradeWapPayResponse;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.mockito.ArgumentMatcher;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.CLOSED;
|
||||||
|
import static cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum.WAITING;
|
||||||
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.mockito.ArgumentMatchers.argThat;
|
||||||
|
import static org.mockito.ArgumentMatchers.eq;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@link AlipayWapPayClient} 单元测试
|
||||||
|
*
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
public class AlipayWapPayClientTest extends AbstractAlipayClientTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝 H5 支付 Client
|
||||||
|
*/
|
||||||
|
@InjectMocks
|
||||||
|
private AlipayWapPayClient client = new AlipayWapPayClient(randomLongId(), config);
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setUp() {
|
||||||
|
setClient(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 H5 支付下单成功")
|
||||||
|
public void test_unified_order_success() throws AlipayApiException {
|
||||||
|
// 准备响应对象
|
||||||
|
String h5Body = randomString();
|
||||||
|
Integer price = randomInteger();
|
||||||
|
AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
|
||||||
|
o.setSubCode("");
|
||||||
|
o.setBody(h5Body);
|
||||||
|
});
|
||||||
|
String notifyUrl = randomURL();
|
||||||
|
// mock
|
||||||
|
when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher<AlipayTradeWapPayRequest>) request -> {
|
||||||
|
assertInstanceOf(AlipayTradeWapPayModel.class, request.getBizModel());
|
||||||
|
AlipayTradeWapPayModel bizModel = (AlipayTradeWapPayModel) request.getBizModel();
|
||||||
|
assertEquals(String.valueOf(price / 100.0), bizModel.getTotalAmount());
|
||||||
|
assertEquals(notifyUrl, request.getNotifyUrl());
|
||||||
|
return true;
|
||||||
|
}), eq(Method.GET.name()))).thenReturn(response);
|
||||||
|
|
||||||
|
String outTradeNo = randomString();
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(notifyUrl, outTradeNo, price);
|
||||||
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
|
assertEquals(WAITING.getStatus(), resp.getStatus());
|
||||||
|
assertEquals(PayOrderDisplayModeEnum.URL.getMode(), resp.getDisplayMode());
|
||||||
|
assertEquals(outTradeNo, resp.getOutTradeNo());
|
||||||
|
assertEquals(h5Body, resp.getDisplayContent());
|
||||||
|
assertSame(response, resp.getRawData());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("支付宝 H5 支付,渠道返回失败")
|
||||||
|
public void test_unified_order_channel_failed() throws AlipayApiException {
|
||||||
|
// 准备响应对象
|
||||||
|
String subCode = randomString();
|
||||||
|
String subMsg = randomString();
|
||||||
|
AlipayTradeWapPayResponse response = randomPojo(AlipayTradeWapPayResponse.class, o -> {
|
||||||
|
o.setSubCode(subCode);
|
||||||
|
o.setSubMsg(subMsg);
|
||||||
|
});
|
||||||
|
// mock
|
||||||
|
when(defaultAlipayClient.pageExecute(argThat((ArgumentMatcher<AlipayTradeWapPayRequest>) request -> true),
|
||||||
|
eq(Method.GET.name()))).thenReturn(response);
|
||||||
|
PayOrderUnifiedReqDTO reqDTO = buildOrderUnifiedReqDTO(randomURL(), randomString(), randomInteger());
|
||||||
|
|
||||||
|
PayOrderRespDTO resp = client.unifiedOrder(reqDTO);
|
||||||
|
// 断言
|
||||||
|
assertEquals(CLOSED.getStatus(), resp.getStatus());
|
||||||
|
assertEquals(subCode, resp.getChannelErrorCode());
|
||||||
|
assertEquals(subMsg, resp.getChannelErrorMsg());
|
||||||
|
assertSame(response, resp.getRawData());
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||||
@Data
|
@Data
|
||||||
public class BargainActivityBaseVO {
|
public class BargainActivityBaseVO {
|
||||||
|
|
||||||
@Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "越拼越省钱")
|
@Schema(description = "砍价活动名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "砍得越多省得越多,是兄弟就来砍我")
|
||||||
@NotNull(message = "砍价名称不能为空")
|
@NotNull(message = "砍价名称不能为空")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.*;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.*;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressUpdateReqVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
|
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||||
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||||
|
@ -67,6 +67,13 @@ public class DeliveryExpressController {
|
||||||
return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress));
|
return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取快递公司精简信息列表", description = "主要用于前端的下拉选项")
|
||||||
|
public CommonResult<List<DeliveryExpressSimpleRespVO>> getSimpleDeliveryExpressList() {
|
||||||
|
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
return success(DeliveryExpressConvert.INSTANCE.convertList1(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得快递公司分页")
|
@Operation(summary = "获得快递公司分页")
|
||||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")
|
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.*;
|
||||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
|
@ -16,14 +15,11 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 自提门店")
|
@Tag(name = "管理后台 - 自提门店")
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -67,6 +63,13 @@ public class DeliveryPickUpStoreController {
|
||||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convert(deliveryPickUpStore));
|
return success(DeliveryPickUpStoreConvert.INSTANCE.convert(deliveryPickUpStore));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@Operation(summary = "获取快递公司精简信息列表")
|
||||||
|
public CommonResult<List<DeliveryPickUpStoreSimpleRespVO>> getSimpleDeliveryPickUpStoreList() {
|
||||||
|
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
return success(DeliveryPickUpStoreConvert.INSTANCE.convertList1(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得自提门店列表")
|
@Operation(summary = "获得自提门店列表")
|
||||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||||
|
@ -84,16 +87,4 @@ public class DeliveryPickUpStoreController {
|
||||||
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult));
|
return success(DeliveryPickUpStoreConvert.INSTANCE.convertPage(pageResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @jason:导出去掉好列;简化下,一般用不到哈。
|
|
||||||
@GetMapping("/export-excel")
|
|
||||||
@Operation(summary = "导出自提门店 Excel")
|
|
||||||
@PreAuthorize("@ss.hasPermission('trade:delivery:pick-up-store:export')")
|
|
||||||
@OperateLog(type = EXPORT)
|
|
||||||
public void exportDeliveryPickUpStoreExcel(@Valid DeliveryPickUpStoreExportReqVO exportReqVO,
|
|
||||||
HttpServletResponse response) throws IOException {
|
|
||||||
List<DeliveryPickUpStoreDO> list = deliveryPickUpStoreService.getDeliveryPickUpStoreList(exportReqVO);
|
|
||||||
// 导出 Excel
|
|
||||||
List<DeliveryPickUpStoreExcelVO> datas = DeliveryPickUpStoreConvert.INSTANCE.convertList02(list);
|
|
||||||
ExcelUtils.write(response, "自提门店.xls", "数据", DeliveryPickUpStoreExcelVO.class, datas);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 快递公司精简信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeliveryExpressSimpleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6592")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "快递公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "顺丰速运")
|
||||||
|
@NotNull(message = "快递公司名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
}
|
|
@ -1,58 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
|
||||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
|
||||||
import cn.iocoder.yudao.module.system.enums.DictTypeConstants;
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class DeliveryPickUpStoreExcelVO {
|
|
||||||
|
|
||||||
@ExcelProperty("编号")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("门店名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ExcelProperty("门店简介")
|
|
||||||
private String introduction;
|
|
||||||
|
|
||||||
@ExcelProperty("门店手机")
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
@ExcelProperty("门店所在区域")
|
|
||||||
private String areaName;
|
|
||||||
|
|
||||||
@ExcelProperty("门店详细地址")
|
|
||||||
private String detailAddress;
|
|
||||||
|
|
||||||
@ExcelProperty("门店logo")
|
|
||||||
private String logo;
|
|
||||||
|
|
||||||
// TODO @jason:是不是可以加个 convert?
|
|
||||||
/**
|
|
||||||
* easy-excel 好像暂时不支持 LocalTime. 转成string
|
|
||||||
*/
|
|
||||||
@ExcelProperty("营业开始时间")
|
|
||||||
private String openingTime;
|
|
||||||
|
|
||||||
@ExcelProperty("营业结束时间")
|
|
||||||
private String closingTime;
|
|
||||||
|
|
||||||
@ExcelProperty("纬度")
|
|
||||||
private String latitude;
|
|
||||||
|
|
||||||
@ExcelProperty("经度")
|
|
||||||
private String longitude;
|
|
||||||
|
|
||||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
|
||||||
@DictFormat(DictTypeConstants.COMMON_STATUS)
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|
||||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 自提门店 Excel 导出 Request VO,参数和 DeliveryPickUpStorePageReqVO 是一致的")
|
|
||||||
@Data
|
|
||||||
public class DeliveryPickUpStoreExportReqVO {
|
|
||||||
|
|
||||||
@Schema(description = "门店名称", example = "李四")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "门店手机")
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
@Schema(description = "区域id", example = "18733")
|
|
||||||
private Integer areaId;
|
|
||||||
|
|
||||||
@Schema(description = "门店状态", example = "1")
|
|
||||||
@InEnum(CommonStatusEnum.class)
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
|
||||||
private LocalDateTime[] createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 自提门店精简信息 Response VO")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeliveryPickUpStoreSimpleRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "23128")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "门店名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "门店手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601892312")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18733")
|
||||||
|
private Integer areaId;
|
||||||
|
|
||||||
|
// TODO @puhui999:要把 areaName 也返回哈
|
||||||
|
|
||||||
|
@Schema(description = "门店详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "复旦大学路 188 号")
|
||||||
|
private String detailAddress;
|
||||||
|
|
||||||
|
}
|
|
@ -5,10 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
|
@ -79,12 +76,56 @@ public class TradeOrderController {
|
||||||
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user));
|
return success(TradeOrderConvert.INSTANCE.convert(order, orderItems, user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-express-track-list")
|
||||||
|
@Operation(summary = "获得交易订单的物流轨迹")
|
||||||
|
@Parameter(name = "id", description = "交易订单编号")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:order:query')")
|
||||||
|
public CommonResult<List<?>> getOrderExpressTrackList(@RequestParam("id") Long id) {
|
||||||
|
return success(TradeOrderConvert.INSTANCE.convertList02(
|
||||||
|
tradeOrderQueryService.getExpressTrackList(id, getLoginUserId())));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:put 请求哈
|
||||||
@PostMapping("/delivery")
|
@PostMapping("/delivery")
|
||||||
@Operation(summary = "发货订单")
|
@Operation(summary = "订单发货")
|
||||||
@PreAuthorize("@ss.hasPermission('trade:order:delivery')")
|
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||||
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
|
public CommonResult<Boolean> deliveryOrder(@RequestBody TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||||
tradeOrderUpdateService.deliveryOrder(getLoginUserId(), deliveryReqVO);
|
tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:put 请求哈,update-remark;
|
||||||
|
@PostMapping("/remark")
|
||||||
|
@Operation(summary = "订单备注")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||||
|
public CommonResult<Boolean> updateOrderRemark(@RequestBody TradeOrderRemarkReqVO reqVO) {
|
||||||
|
tradeOrderUpdateService.updateOrderRemark(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:put 请求哈,update-price;
|
||||||
|
@PostMapping("/adjust-price")
|
||||||
|
@Operation(summary = "订单调价")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||||
|
public CommonResult<Boolean> updateOrderPrice(@RequestBody TradeOrderUpdatePriceReqVO reqVO) {
|
||||||
|
tradeOrderUpdateService.updateOrderPrice(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999:put 请求哈,update-address;
|
||||||
|
@PostMapping("/adjust-address")
|
||||||
|
@Operation(summary = "修改订单收货地址")
|
||||||
|
@PreAuthorize("@ss.hasPermission('trade:order:update')")
|
||||||
|
public CommonResult<Boolean> updateOrderAddress(@RequestBody TradeOrderUpdateAddressReqVO reqVO) {
|
||||||
|
tradeOrderUpdateService.updateOrderAddress(reqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO @puhui999 订单物流详情
|
||||||
|
// TODO @puhui999 【前台】订单取消
|
||||||
|
// TODO @puhui999 【后台】订单取消
|
||||||
|
// TODO @puhui999 【前台】订单核销
|
||||||
|
// TODO @puhui999 【前台】订单删除
|
||||||
|
// TODO @puhui999 【后台】订单统计
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ import lombok.Data;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 交易订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
* 交易订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class TradeOrderBaseVO {
|
public class TradeOrderBaseVO {
|
||||||
|
|
||||||
|
@ -87,6 +87,12 @@ public class TradeOrderBaseVO {
|
||||||
|
|
||||||
// ========== 收件 + 物流基本信息 ==========
|
// ========== 收件 + 物流基本信息 ==========
|
||||||
|
|
||||||
|
@Schema(description = "配送方式", example = "10")
|
||||||
|
private Integer deliveryType;
|
||||||
|
|
||||||
|
@Schema(description = "自提门店", example = "10")
|
||||||
|
private Long pickUpStoreId;
|
||||||
|
|
||||||
@Schema(description = "配送模板编号", example = "1024")
|
@Schema(description = "配送模板编号", example = "1024")
|
||||||
private Long deliveryTemplateId;
|
private Long deliveryTemplateId;
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
|
||||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 订单发货 Request VO")
|
@Schema(description = "管理后台 - 订单发货 Request VO")
|
||||||
|
@ -16,18 +13,11 @@ public class TradeOrderDeliveryReqVO {
|
||||||
@NotNull(message = "订单编号不能为空")
|
@NotNull(message = "订单编号不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
// TODO @puhui999:可以去掉 type;如果无需发货,则 logisticsId 传递 0;logisticsNo 传递空串
|
|
||||||
@Schema(description = "发货类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
|
||||||
@InEnum(DeliveryTypeEnum.class)
|
|
||||||
@NotNull(message = "发货类型不能为空")
|
|
||||||
private Integer type;
|
|
||||||
|
|
||||||
@Schema(description = "发货物流公司编号", example = "1")
|
@Schema(description = "发货物流公司编号", example = "1")
|
||||||
@NotNull(message = "发货物流公司不能为空")
|
@NotNull(message = "发货物流公司不能为空")
|
||||||
private Long logisticsId;
|
private Long logisticsId;
|
||||||
|
|
||||||
@Schema(description = "发货物流单号", example = "SF123456789")
|
@Schema(description = "发货物流单号", example = "SF123456789")
|
||||||
@NotEmpty(message = "发货物流单号不能为空")
|
|
||||||
private String logisticsNo;
|
private String logisticsNo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ -30,6 +31,12 @@ public class TradeOrderPageReqVO extends PageParam {
|
||||||
@Mobile
|
@Mobile
|
||||||
private String userMobile;
|
private String userMobile;
|
||||||
|
|
||||||
|
@Schema(description = "发货物流公司编号", example = "1")
|
||||||
|
private Long logisticsId;
|
||||||
|
|
||||||
|
@Schema(description = "自提门店编号", example = "[1,2]")
|
||||||
|
private List<Long> pickUpStoreIds;
|
||||||
|
|
||||||
@Schema(description = "收件人名称", example = "小红")
|
@Schema(description = "收件人名称", example = "小红")
|
||||||
private String receiverName;
|
private String receiverName;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 订单备注 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TradeOrderRemarkReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "订单编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "商家备注", example = "你猜一下")
|
||||||
|
@NotEmpty(message = "订单备注不能为空")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 订单修改地址 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TradeOrderUpdateAddressReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotNull(message = "订单编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "收件人名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "z张三")
|
||||||
|
@NotEmpty(message = "收件人名称不能为空")
|
||||||
|
private String receiverName;
|
||||||
|
|
||||||
|
@Schema(description = "收件人手机", requiredMode = Schema.RequiredMode.REQUIRED, example = "19988188888")
|
||||||
|
@NotEmpty(message = "收件人手机不能为空")
|
||||||
|
private String receiverMobile;
|
||||||
|
|
||||||
|
@Schema(description = "收件人地区编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7310")
|
||||||
|
@NotNull(message = "收件人地区编号不能为空")
|
||||||
|
private Integer receiverAreaId;
|
||||||
|
|
||||||
|
@Schema(description = "收件人详细地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "昆明市五华区xxx小区xxx")
|
||||||
|
@NotEmpty(message = "收件人详细地址不能为空")
|
||||||
|
private String receiverDetailAddress;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.yudao.module.trade.controller.admin.order.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 订单改价 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TradeOrderUpdatePriceReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
@NotNull(message = "订单编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "订单调价,单位:分。正数,加价;负数,减价", requiredMode = Schema.RequiredMode.REQUIRED, example = "-100")
|
||||||
|
@NotNull(message = "订单调价价格不能为空")
|
||||||
|
private Integer adjustPrice;
|
||||||
|
|
||||||
|
}
|
|
@ -31,7 +31,7 @@ public class AppDeliverExpressController {
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获得快递公司列表")
|
@Operation(summary = "获得快递公司列表")
|
||||||
public CommonResult<List<AppDeliveryExpressRespVO>> getDeliveryExpressList() {
|
public CommonResult<List<AppDeliveryExpressRespVO>> getDeliveryExpressList() {
|
||||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressList(CommonStatusEnum.ENABLE.getStatus());
|
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
list.sort(Comparator.comparing(DeliveryExpressDO::getSort));
|
list.sort(Comparator.comparing(DeliveryExpressDO::getSort));
|
||||||
return success(DeliveryExpressConvert.INSTANCE.convertList03(list));
|
return success(DeliveryExpressConvert.INSTANCE.convertList03(list));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.*;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExcelVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressExcelVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.express.DeliveryExpressRespVO;
|
||||||
|
@ -29,6 +30,8 @@ public interface DeliveryExpressConvert {
|
||||||
|
|
||||||
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
|
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
|
||||||
|
|
||||||
|
List<DeliveryExpressSimpleRespVO> convertList1(List<DeliveryExpressDO> list);
|
||||||
|
|
||||||
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
|
List<AppDeliveryExpressRespVO> convertList03(List<DeliveryExpressDO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,18 @@
|
||||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExcelVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreRespVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreSimpleRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.Named;
|
import org.mapstruct.Named;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DeliveryPickUpStoreConvert {
|
public interface DeliveryPickUpStoreConvert {
|
||||||
|
|
||||||
|
@ -30,14 +28,10 @@ public interface DeliveryPickUpStoreConvert {
|
||||||
|
|
||||||
PageResult<DeliveryPickUpStoreRespVO> convertPage(PageResult<DeliveryPickUpStoreDO> page);
|
PageResult<DeliveryPickUpStoreRespVO> convertPage(PageResult<DeliveryPickUpStoreDO> page);
|
||||||
|
|
||||||
List<DeliveryPickUpStoreExcelVO> convertList02(List<DeliveryPickUpStoreDO> list);
|
|
||||||
|
|
||||||
@Mapping(source = "areaId", target = "areaName", qualifiedByName = "convertAreaIdToName")
|
|
||||||
DeliveryPickUpStoreExcelVO convert2(DeliveryPickUpStoreDO bean);
|
|
||||||
|
|
||||||
@Named("convertAreaIdToName")
|
@Named("convertAreaIdToName")
|
||||||
default String convertAreaIdToName(Integer areaId) {
|
default String convertAreaIdToName(Integer areaId) {
|
||||||
return AreaUtils.format(areaId);
|
return AreaUtils.format(areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DeliveryPickUpStoreSimpleRespVO> convertList1(List<DeliveryPickUpStoreDO> list);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,7 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCr
|
||||||
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
import cn.iocoder.yudao.module.trade.api.order.dto.TradeOrderRespDTO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.base.member.user.MemberUserRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.base.product.property.ProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDetailRespVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageItemRespVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemCommentCreateReqVO;
|
||||||
|
@ -278,4 +277,10 @@ public interface TradeOrderConvert {
|
||||||
|
|
||||||
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
|
List<AppOrderExpressTrackRespDTO> convertList02(List<ExpressTrackRespDTO> list);
|
||||||
|
|
||||||
|
TradeOrderDO convert(TradeOrderUpdateAddressReqVO reqVO);
|
||||||
|
|
||||||
|
TradeOrderDO convert(TradeOrderUpdatePriceReqVO reqVO);
|
||||||
|
|
||||||
|
TradeOrderDO convert(TradeOrderRemarkReqVO reqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
@ -23,15 +22,10 @@ public interface DeliveryPickUpStoreMapper extends BaseMapperX<DeliveryPickUpSto
|
||||||
.orderByDesc(DeliveryPickUpStoreDO::getId));
|
.orderByDesc(DeliveryPickUpStoreDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<DeliveryPickUpStoreDO> selectList(DeliveryPickUpStoreExportReqVO reqVO) {
|
default List<DeliveryPickUpStoreDO> selectListByStatus(Integer status) {
|
||||||
return selectList(new LambdaQueryWrapperX<DeliveryPickUpStoreDO>()
|
return selectList(DeliveryPickUpStoreDO::getStatus, status);
|
||||||
.likeIfPresent(DeliveryPickUpStoreDO::getName, reqVO.getName())
|
|
||||||
.eqIfPresent(DeliveryPickUpStoreDO::getPhone, reqVO.getPhone())
|
|
||||||
.eqIfPresent(DeliveryPickUpStoreDO::getAreaId, reqVO.getAreaId())
|
|
||||||
.eqIfPresent(DeliveryPickUpStoreDO::getStatus, reqVO.getStatus())
|
|
||||||
.betweenIfPresent(DeliveryPickUpStoreDO::getCreateTime, reqVO.getCreateTime())
|
|
||||||
.orderByDesc(DeliveryPickUpStoreDO::getId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,8 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||||
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||||
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
|
.eqIfPresent(TradeOrderDO::getPayChannelCode, reqVO.getPayChannelCode())
|
||||||
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal())
|
.eqIfPresent(TradeOrderDO::getTerminal,reqVO.getTerminal())
|
||||||
|
.eqIfPresent(TradeOrderDO::getLogisticsId, reqVO.getLogisticsId())
|
||||||
|
.inIfPresent(TradeOrderDO::getPickUpStoreId, reqVO.getPickUpStoreIds())
|
||||||
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
|
.betweenIfPresent(TradeOrderDO::getCreateTime, reqVO.getCreateTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,10 @@ public interface DeliveryExpressService {
|
||||||
List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO);
|
List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得快递公司列表
|
* 获取指定状态的快递公司列表
|
||||||
*
|
*
|
||||||
* @param status 状态
|
* @param status 状态
|
||||||
* @return 快递公司列表
|
* @return 快递公司列表
|
||||||
*/
|
*/
|
||||||
List<DeliveryExpressDO> getDeliveryExpressList(Integer status);
|
List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
@ -95,7 +96,7 @@ public class DeliveryExpressServiceImpl implements DeliveryExpressService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeliveryExpressDO> getDeliveryExpressList(Integer status) {
|
public List<DeliveryExpressDO> getDeliveryExpressListByStatus(Integer status) {
|
||||||
return deliveryExpressMapper.selectListByStatus(status);
|
return deliveryExpressMapper.selectListByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import javax.validation.*;
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自提门店 Service 接口
|
* 自提门店 Service 接口
|
||||||
*
|
*
|
||||||
|
@ -63,10 +64,10 @@ public interface DeliveryPickUpStoreService {
|
||||||
PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);
|
PageResult<DeliveryPickUpStoreDO> getDeliveryPickUpStorePage(DeliveryPickUpStorePageReqVO pageReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得自提门店列表, 用于 Excel 导出
|
* 获得指定状态的自提门店列表
|
||||||
*
|
*
|
||||||
* @param exportReqVO 查询条件
|
* @param status 状态
|
||||||
* @return 自提门店列表
|
* @return 自提门店列表
|
||||||
*/
|
*/
|
||||||
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO);
|
List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,20 @@ package cn.iocoder.yudao.module.trade.service.delivery;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreExportReqVO;
|
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStorePageReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.pickup.DeliveryPickUpStoreUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryPickUpStoreConvert;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryPickUpStoreMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryPickUpStoreMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.util.*;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.PICK_UP_STORE_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自提门店 Service 实现类
|
* 自提门店 Service 实现类
|
||||||
|
@ -78,7 +77,8 @@ public class DeliveryPickUpStoreServiceImpl implements DeliveryPickUpStoreServic
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreList(DeliveryPickUpStoreExportReqVO exportReqVO) {
|
public List<DeliveryPickUpStoreDO> getDeliveryPickUpStoreListByStatus(Integer status) {
|
||||||
return deliveryPickUpStoreMapper.selectList(exportReqVO);
|
return deliveryPickUpStoreMapper.selectListByStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package cn.iocoder.yudao.module.trade.service.order;
|
package cn.iocoder.yudao.module.trade.service.order;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdatePriceReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
||||||
|
@ -47,10 +50,9 @@ public interface TradeOrderUpdateService {
|
||||||
/**
|
/**
|
||||||
* 【管理员】发货交易订单
|
* 【管理员】发货交易订单
|
||||||
*
|
*
|
||||||
* @param userId 管理员编号
|
|
||||||
* @param deliveryReqVO 发货请求
|
* @param deliveryReqVO 发货请求
|
||||||
*/
|
*/
|
||||||
void deliveryOrder(Long userId, TradeOrderDeliveryReqVO deliveryReqVO);
|
void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【会员】收货交易订单
|
* 【会员】收货交易订单
|
||||||
|
@ -60,6 +62,27 @@ public interface TradeOrderUpdateService {
|
||||||
*/
|
*/
|
||||||
void receiveOrder(Long userId, Long id);
|
void receiveOrder(Long userId, Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【管理员】交易订单备注
|
||||||
|
*
|
||||||
|
* @param reqVO 请求
|
||||||
|
*/
|
||||||
|
void updateOrderRemark(TradeOrderRemarkReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【管理员】调整价格
|
||||||
|
*
|
||||||
|
* @param reqVO 请求
|
||||||
|
*/
|
||||||
|
void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 【管理员】调整地址
|
||||||
|
*
|
||||||
|
* @param reqVO 请求
|
||||||
|
*/
|
||||||
|
void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO);
|
||||||
|
|
||||||
// =================== Order Item ===================
|
// =================== Order Item ===================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -29,7 +29,10 @@ import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordUp
|
||||||
import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi;
|
import cn.iocoder.yudao.module.promotion.api.coupon.CouponApi;
|
||||||
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
|
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponUseReqDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
|
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdateAddressReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderUpdatePriceReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||||
|
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderRemarkReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementReqVO;
|
||||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderSettlementRespVO;
|
||||||
|
@ -53,6 +56,7 @@ import cn.iocoder.yudao.module.trade.service.price.TradePriceService;
|
||||||
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO;
|
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateReqBO;
|
||||||
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO;
|
import cn.iocoder.yudao.module.trade.service.price.bo.TradePriceCalculateRespBO;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -64,6 +68,7 @@ import java.util.Objects;
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_NOT_FOUND;
|
||||||
|
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.ORDER_UPDATE_PRICE_FAIL_PAID;
|
||||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -345,10 +350,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
*/
|
*/
|
||||||
private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) {
|
private KeyValue<TradeOrderDO, PayOrderRespDTO> validateOrderPayable(Long id, Long payOrderId) {
|
||||||
// 校验订单是否存在
|
// 校验订单是否存在
|
||||||
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
TradeOrderDO order = validateOrderExists(id);
|
||||||
if (order == null) {
|
|
||||||
throw exception(ORDER_NOT_FOUND);
|
|
||||||
}
|
|
||||||
// 校验订单未支付
|
// 校验订单未支付
|
||||||
if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) {
|
if (!TradeOrderStatusEnum.isUnpaid(order.getStatus()) || order.getPayStatus()) {
|
||||||
log.error("[validateOrderPaid][order({}) 不处于待支付状态,请进行处理!order 数据是:{}]",
|
log.error("[validateOrderPaid][order({}) 不处于待支付状态,请进行处理!order 数据是:{}]",
|
||||||
|
@ -391,14 +393,16 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deliveryOrder(Long userId, TradeOrderDeliveryReqVO deliveryReqVO) {
|
public void deliveryOrder(TradeOrderDeliveryReqVO deliveryReqVO) {
|
||||||
// TODO @puhui999:只有选择快递的,才可以发货
|
// TODO @puhui999:只有选择快递的,才可以发货
|
||||||
// 1.1 校验并获得交易订单(可发货)
|
// 1.1 校验并获得交易订单(可发货)
|
||||||
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
TradeOrderDO order = validateOrderDeliverable(deliveryReqVO.getId());
|
||||||
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
|
||||||
|
// TODO @puhui999:下面不修改 deliveryType,直接校验 deliveryType 是否为快递,是快递才可以发货;先做严格的方式哈。
|
||||||
// 判断发货类型
|
// 判断发货类型
|
||||||
|
TradeOrderDO updateOrderObj = new TradeOrderDO();
|
||||||
// 2.1 快递发货
|
// 2.1 快递发货
|
||||||
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.EXPRESS.getMode())) {
|
if (ObjectUtil.notEqual(deliveryReqVO.getLogisticsId(), 0L)) {
|
||||||
// 校验快递公司
|
// 校验快递公司
|
||||||
DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(deliveryReqVO.getLogisticsId());
|
DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(deliveryReqVO.getLogisticsId());
|
||||||
if (deliveryExpress == null) {
|
if (deliveryExpress == null) {
|
||||||
|
@ -408,27 +412,24 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
throw exception(EXPRESS_STATUS_NOT_ENABLE);
|
throw exception(EXPRESS_STATUS_NOT_ENABLE);
|
||||||
}
|
}
|
||||||
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode());
|
updateOrderObj.setLogisticsId(deliveryReqVO.getLogisticsId()).setLogisticsNo(deliveryReqVO.getLogisticsNo()).setDeliveryType(DeliveryTypeEnum.EXPRESS.getMode());
|
||||||
}
|
} else {
|
||||||
// TODO @puhui999:无需发货时,更新 logisticsId 为 0;
|
|
||||||
// 2.2 无需发货
|
// 2.2 无需发货
|
||||||
if (Objects.equals(deliveryReqVO.getType(), DeliveryTypeEnum.NULL.getMode())) {
|
updateOrderObj.setLogisticsId(0L).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
|
||||||
updateOrderObj.setLogisticsId(null).setLogisticsNo("").setDeliveryType(DeliveryTypeEnum.NULL.getMode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新 TradeOrderDO 状态为已发货,等待收货
|
// 更新 TradeOrderDO 状态为已发货,等待收货
|
||||||
updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now());
|
updateOrderObj.setStatus(TradeOrderStatusEnum.DELIVERED.getStatus()).setDeliveryTime(LocalDateTime.now());
|
||||||
int updateCount = tradeOrderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj);
|
int updateCount = tradeOrderMapper.updateByIdAndStatus(order.getId(), order.getStatus(), updateOrderObj);
|
||||||
if (updateCount == 0) {
|
if (updateCount == 0) {
|
||||||
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 芋艿:发送订单变化的消息
|
// TODO 芋艿:发送订单变化的消息
|
||||||
|
|
||||||
// 发送站内信
|
// 发送站内信
|
||||||
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
|
tradeMessageService.sendMessageWhenDeliveryOrder(new TradeOrderMessageWhenDeliveryOrderReqBO().setOrderId(order.getId())
|
||||||
.setUserId(userId).setMessage(null));
|
.setUserId(order.getUserId()).setMessage(null));
|
||||||
|
|
||||||
// TODO 芋艿:OrderLog
|
// TODO 芋艿:OrderLog
|
||||||
// TODO 设计:lili:是不是发货后,才支持售后?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -440,12 +441,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
* @return 交易订单
|
* @return 交易订单
|
||||||
*/
|
*/
|
||||||
private TradeOrderDO validateOrderDeliverable(Long id) {
|
private TradeOrderDO validateOrderDeliverable(Long id) {
|
||||||
// 校验订单是否存在
|
TradeOrderDO order = validateOrderExists(id);
|
||||||
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
|
||||||
if (order == null) {
|
|
||||||
throw exception(ORDER_NOT_FOUND);
|
|
||||||
}
|
|
||||||
// 校验订单是否是待发货状态
|
// 校验订单是否是待发货状态
|
||||||
|
// TODO @puhui999:已经发货,可以重新发货,修改信息;
|
||||||
if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) {
|
if (!TradeOrderStatusEnum.isUndelivered(order.getStatus())) {
|
||||||
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
throw exception(ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED);
|
||||||
}
|
}
|
||||||
|
@ -456,6 +454,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
// 订单类型:拼团
|
// 订单类型:拼团
|
||||||
if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
|
if (Objects.equals(TradeOrderTypeEnum.COMBINATION.getType(), order.getType())) {
|
||||||
// 校验订单拼团是否成功
|
// 校验订单拼团是否成功
|
||||||
|
// TODO @puhui999:是不是取反?
|
||||||
if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
|
if (combinationRecordApi.isCombinationRecordSuccess(order.getUserId(), order.getId())) {
|
||||||
throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS);
|
throw exception(ORDER_DELIVERY_FAIL_COMBINATION_RECORD_STATUS_NOT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -463,6 +462,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
// 订单类类型:砍价
|
// 订单类类型:砍价
|
||||||
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
|
if (Objects.equals(TradeOrderTypeEnum.BARGAIN.getType(), order.getType())) {
|
||||||
// 校验订单砍价是否成功
|
// 校验订单砍价是否成功
|
||||||
|
// TODO @puhui999:是不是取反?
|
||||||
if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
if (bargainRecordApi.isBargainRecordSuccess(order.getUserId(), order.getId())) {
|
||||||
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
|
throw exception(ORDER_DELIVERY_FAIL_BARGAIN_RECORD_STATUS_NOT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -470,6 +470,16 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private TradeOrderDO validateOrderExists(Long id) {
|
||||||
|
// 校验订单是否存在
|
||||||
|
TradeOrderDO order = tradeOrderMapper.selectById(id);
|
||||||
|
if (order == null) {
|
||||||
|
throw exception(ORDER_NOT_FOUND);
|
||||||
|
}
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void receiveOrder(Long userId, Long id) {
|
public void receiveOrder(Long userId, Long id) {
|
||||||
|
@ -489,6 +499,43 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
||||||
// TODO 芋艿:lili 发送商品被购买完成的数据
|
// TODO 芋艿:lili 发送商品被购买完成的数据
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateOrderRemark(TradeOrderRemarkReqVO reqVO) {
|
||||||
|
// 校验并获得交易订单
|
||||||
|
validateOrderExists(reqVO.getId());
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
TradeOrderDO order = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||||
|
tradeOrderMapper.updateById(order);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateOrderPrice(TradeOrderUpdatePriceReqVO reqVO) {
|
||||||
|
// 校验交易订单
|
||||||
|
TradeOrderDO order = validateOrderExists(reqVO.getId());
|
||||||
|
if (order.getPayStatus()) {
|
||||||
|
throw exception(ORDER_UPDATE_PRICE_FAIL_PAID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
// TODO @puhui999:TradeOrderItemDO 需要做 adjustPrice 的分摊;另外,支付订单那的价格,需要 update 下;
|
||||||
|
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||||
|
update.setPayPrice(update.getPayPrice() + update.getAdjustPrice());
|
||||||
|
tradeOrderMapper.updateById(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateOrderAddress(TradeOrderUpdateAddressReqVO reqVO) {
|
||||||
|
// 校验交易订单
|
||||||
|
validateOrderExists(reqVO.getId());
|
||||||
|
// TODO 是否需要校验订单是否发货
|
||||||
|
// TODO 发货后是否支持修改收货地址
|
||||||
|
|
||||||
|
// 更新
|
||||||
|
TradeOrderDO update = TradeOrderConvert.INSTANCE.convert(reqVO);
|
||||||
|
tradeOrderMapper.updateById(update);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验交易订单满足可售货的条件
|
* 校验交易订单满足可售货的条件
|
||||||
*
|
*
|
||||||
|
|
|
@ -56,6 +56,7 @@ public class TradeAfterSaleServiceTest extends BaseDbUnitTest {
|
||||||
private TradeOrderUpdateService tradeOrderUpdateService;
|
private TradeOrderUpdateService tradeOrderUpdateService;
|
||||||
@Resource
|
@Resource
|
||||||
private TradeOrderQueryService tradeOrderQueryService;
|
private TradeOrderQueryService tradeOrderQueryService;
|
||||||
|
|
||||||
@MockBean
|
@MockBean
|
||||||
private PayRefundApi payRefundApi;
|
private PayRefundApi payRefundApi;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,10 @@ import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderItemMapper;
|
||||||
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
|
import cn.iocoder.yudao.module.trade.dal.mysql.order.TradeOrderMapper;
|
||||||
import cn.iocoder.yudao.module.trade.enums.order.*;
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||||
|
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
|
||||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderConfig;
|
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderConfig;
|
||||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
@ -38,7 +41,6 @@ import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
|
||||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
@ -282,7 +284,7 @@ public class TradeOrderUpdateServiceTest extends BaseDbUnitTest {
|
||||||
// mock 方法(支付单)
|
// mock 方法(支付单)
|
||||||
|
|
||||||
// 调用
|
// 调用
|
||||||
tradeOrderUpdateService.deliveryOrder(randomLongId(), deliveryReqVO);
|
tradeOrderUpdateService.deliveryOrder(deliveryReqVO);
|
||||||
// 断言
|
// 断言
|
||||||
TradeOrderDO dbOrder = tradeOrderMapper.selectById(1L);
|
TradeOrderDO dbOrder = tradeOrderMapper.selectById(1L);
|
||||||
assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus());
|
assertEquals(dbOrder.getStatus(), TradeOrderStatusEnum.DELIVERED.getStatus());
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class MemberLevelBaseVO {
|
||||||
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "98")
|
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "98")
|
||||||
@NotNull(message = "享受折扣不能为空")
|
@NotNull(message = "享受折扣不能为空")
|
||||||
@Range(min = 0, max = 100, message = "享受折扣的范围为 0-100")
|
@Range(min = 0, max = 100, message = "享受折扣的范围为 0-100")
|
||||||
private Integer discount;
|
private Integer discountPercent;
|
||||||
|
|
||||||
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
@Schema(description = "等级图标", example = "https://www.iocoder.cn/yudao.jpg")
|
||||||
@URL(message = "等级图标必须是 URL 格式")
|
@URL(message = "等级图标必须是 URL 格式")
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class MemberLevelRecordBaseVO {
|
||||||
|
|
||||||
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
@Schema(description = "享受折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||||
@NotNull(message = "享受折扣不能为空")
|
@NotNull(message = "享受折扣不能为空")
|
||||||
private Integer discount;
|
private Integer discountPercent;
|
||||||
|
|
||||||
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
@Schema(description = "升级经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "13319")
|
||||||
@NotNull(message = "升级经验不能为空")
|
@NotNull(message = "升级经验不能为空")
|
||||||
|
|
|
@ -15,6 +15,9 @@ public class MemberPointRecordPageReqVO extends PageParam {
|
||||||
@Schema(description = "用户昵称", example = "张三")
|
@Schema(description = "用户昵称", example = "张三")
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "123")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "业务类型", example = "1")
|
@Schema(description = "业务类型", example = "1")
|
||||||
private Integer bizType;
|
private Integer bizType;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ public class MemberSignInRecordPageReqVO extends PageParam {
|
||||||
@Schema(description = "第几天签到", example = "10")
|
@Schema(description = "第几天签到", example = "10")
|
||||||
private Integer day;
|
private Integer day;
|
||||||
|
|
||||||
|
@Schema(description = "用户编号", example = "123")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
@Schema(description = "签到时间")
|
@Schema(description = "签到时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|
|
@ -29,9 +29,11 @@ public class MemberUserRespVO extends MemberUserBaseVO {
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
|
||||||
// ========== 其它信息 ==========
|
// ========== 其它信息 ==========
|
||||||
|
|
||||||
|
@Schema(description = "积分", example = "100")
|
||||||
|
private Integer point;
|
||||||
|
|
||||||
@Schema(description = "会员标签", example = "[红色, 快乐]")
|
@Schema(description = "会员标签", example = "[红色, 快乐]")
|
||||||
private List<String> tagNames;
|
private List<String> tagNames;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.member.dal.dataobject.level;
|
package cn.iocoder.yudao.module.member.dal.dataobject.level;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
import cn.iocoder.yudao.module.member.enums.MemberExperienceBizTypeEnum;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
@ -29,6 +30,8 @@ public class MemberExperienceRecordDO extends BaseDO {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MemberUserDO#getId()} 字段
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +48,10 @@ public class MemberExperienceRecordDO extends BaseDO {
|
||||||
* 标题
|
* 标题
|
||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
/**
|
/**
|
||||||
* 经验
|
* 经验
|
||||||
*/
|
*/
|
||||||
|
@ -53,9 +60,5 @@ public class MemberExperienceRecordDO extends BaseDO {
|
||||||
* 变更后的经验
|
* 变更后的经验
|
||||||
*/
|
*/
|
||||||
private Integer totalExperience;
|
private Integer totalExperience;
|
||||||
/**
|
|
||||||
* 描述
|
|
||||||
*/
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,18 +33,19 @@ public class MemberLevelDO extends BaseDO {
|
||||||
* 等级名称
|
* 等级名称
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
|
||||||
* 升级经验
|
|
||||||
*/
|
|
||||||
private Integer experience;
|
|
||||||
/**
|
/**
|
||||||
* 等级
|
* 等级
|
||||||
*/
|
*/
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
/**
|
||||||
|
* 升级经验
|
||||||
|
*/
|
||||||
|
private Integer experience;
|
||||||
/**
|
/**
|
||||||
* 享受折扣
|
* 享受折扣
|
||||||
*/
|
*/
|
||||||
private Integer discount;
|
private Integer discountPercent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等级图标
|
* 等级图标
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.iocoder.yudao.module.member.dal.dataobject.level;
|
package cn.iocoder.yudao.module.member.dal.dataobject.level;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
@ -30,20 +31,26 @@ public class MemberLevelRecordDO extends BaseDO {
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 用户编号
|
* 用户编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MemberUserDO#getId()} 字段
|
||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 等级编号
|
* 等级编号
|
||||||
|
*
|
||||||
|
* 关联 {@link MemberLevelDO#getId()} 字段
|
||||||
*/
|
*/
|
||||||
private Long levelId;
|
private Long levelId;
|
||||||
/**
|
/**
|
||||||
* 会员等级
|
* 会员等级
|
||||||
|
*
|
||||||
|
* 冗余 {@link MemberLevelDO#getLevel()} 字段
|
||||||
*/
|
*/
|
||||||
private Integer level;
|
private Integer level;
|
||||||
/**
|
/**
|
||||||
* 享受折扣
|
* 享受折扣
|
||||||
*/
|
*/
|
||||||
private Integer discount;
|
private Integer discountPercent;
|
||||||
/**
|
/**
|
||||||
* 升级经验
|
* 升级经验
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,6 +21,7 @@ public interface MemberPointRecordMapper extends BaseMapperX<MemberPointRecordDO
|
||||||
default PageResult<MemberPointRecordDO> selectPage(MemberPointRecordPageReqVO reqVO, Set<Long> userIds) {
|
default PageResult<MemberPointRecordDO> selectPage(MemberPointRecordPageReqVO reqVO, Set<Long> userIds) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberPointRecordDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<MemberPointRecordDO>()
|
||||||
.inIfPresent(MemberPointRecordDO::getUserId, userIds)
|
.inIfPresent(MemberPointRecordDO::getUserId, userIds)
|
||||||
|
.eqIfPresent(MemberPointRecordDO::getUserId, reqVO.getUserId())
|
||||||
.eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType())
|
.eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType())
|
||||||
.likeIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle())
|
.likeIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle())
|
||||||
.orderByDesc(MemberPointRecordDO::getId));
|
.orderByDesc(MemberPointRecordDO::getId));
|
||||||
|
|
|
@ -21,6 +21,7 @@ public interface MemberSignInRecordMapper extends BaseMapperX<MemberSignInRecord
|
||||||
default PageResult<MemberSignInRecordDO> selectPage(MemberSignInRecordPageReqVO reqVO, Set<Long> userIds) {
|
default PageResult<MemberSignInRecordDO> selectPage(MemberSignInRecordPageReqVO reqVO, Set<Long> userIds) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberSignInRecordDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<MemberSignInRecordDO>()
|
||||||
.inIfPresent(MemberSignInRecordDO::getUserId, userIds)
|
.inIfPresent(MemberSignInRecordDO::getUserId, userIds)
|
||||||
|
.eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId())
|
||||||
.eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay())
|
.eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay())
|
||||||
.betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.orderByDesc(MemberSignInRecordDO::getId));
|
.orderByDesc(MemberSignInRecordDO::getId));
|
||||||
|
|
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordRespVO;
|
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
|
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
||||||
public void testCreateLevel_success() {
|
public void testCreateLevel_success() {
|
||||||
// 准备参数
|
// 准备参数
|
||||||
MemberLevelCreateReqVO reqVO = randomPojo(MemberLevelCreateReqVO.class, o -> {
|
MemberLevelCreateReqVO reqVO = randomPojo(MemberLevelCreateReqVO.class, o -> {
|
||||||
o.setDiscount(randomInt());
|
o.setDiscountPercent(randomInt());
|
||||||
o.setIcon(randomURL());
|
o.setIcon(randomURL());
|
||||||
o.setBackgroundUrl(randomURL());
|
o.setBackgroundUrl(randomURL());
|
||||||
});
|
});
|
||||||
|
@ -76,7 +76,7 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
||||||
o.setLevel(dbLevel.getLevel());
|
o.setLevel(dbLevel.getLevel());
|
||||||
o.setExperience(dbLevel.getExperience());
|
o.setExperience(dbLevel.getExperience());
|
||||||
//以下是要修改的字段
|
//以下是要修改的字段
|
||||||
o.setDiscount(randomInt());
|
o.setDiscountPercent(randomInt());
|
||||||
o.setIcon(randomURL());
|
o.setIcon(randomURL());
|
||||||
o.setBackgroundUrl(randomURL());
|
o.setBackgroundUrl(randomURL());
|
||||||
});
|
});
|
||||||
|
@ -255,7 +255,7 @@ public class MemberLevelServiceImplTest extends BaseDbUnitTest {
|
||||||
private static MemberLevelDO randomLevelDO(Consumer<MemberLevelDO>... consumers) {
|
private static MemberLevelDO randomLevelDO(Consumer<MemberLevelDO>... consumers) {
|
||||||
Consumer<MemberLevelDO> consumer = (o) -> {
|
Consumer<MemberLevelDO> consumer = (o) -> {
|
||||||
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
o.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
o.setDiscount(randomInt(0, 100));
|
o.setDiscountPercent(randomInt(0, 100));
|
||||||
o.setIcon(randomURL());
|
o.setIcon(randomURL());
|
||||||
o.setBackgroundUrl(randomURL());
|
o.setBackgroundUrl(randomURL());
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@ public interface ErrorCodeConstants {
|
||||||
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
|
ErrorCode ORDER_IS_EXPIRED = new ErrorCode(1007002003, "支付订单已经过期");
|
||||||
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
|
ErrorCode ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1007002004, "发起支付报错,错误码:{},错误提示:{}");
|
||||||
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
|
ErrorCode ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1007002005, "支付订单退款失败,原因:状态不是已支付或已退款");
|
||||||
|
ErrorCode ORDER_UPDATE_PRICE_FAIL_PAID = new ErrorCode(1007002006, "支付订单调价失败,原因:支付订单已付款,不能调价");
|
||||||
|
|
||||||
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
||||||
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
ErrorCode ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
||||||
|
|
Loading…
Reference in New Issue