Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
A
Afrishop refactored project
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Whispa
Afrishop refactored project
Commits
9f4144df
提交
9f4144df
authored
10月 13, 2020
作者:
Whispa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commit
上级
80416707
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
402 行增加
和
8 行删除
+402
-8
AuthController.java
...a/com/example/afrishop_v3/controllers/AuthController.java
+5
-4
CouponController.java
...com/example/afrishop_v3/controllers/CouponController.java
+30
-4
LogisticsController.java
.../example/afrishop_v3/controllers/LogisticsController.java
+96
-0
TbCfPlatformOrder.java
...ava/com/example/afrishop_v3/models/TbCfPlatformOrder.java
+262
-0
TbCfPlatformOrderRepository.java
...e/afrishop_v3/repository/TbCfPlatformOrderRepository.java
+7
-0
UserRepository.java
...va/com/example/afrishop_v3/repository/UserRepository.java
+2
-0
没有找到文件。
src/main/java/com/example/afrishop_v3/controllers/AuthController.java
浏览文件 @
9f4144df
...
@@ -103,19 +103,20 @@ public class AuthController extends Controller {
...
@@ -103,19 +103,20 @@ public class AuthController extends Controller {
@PostMapping
(
"/signup"
)
@PostMapping
(
"/signup"
)
public
Result
<?>
registerUser
(
@RequestBody
TbCfUserInfo
signUpRequest
)
{
public
Result
<?>
registerUser
(
@RequestBody
TbCfUserInfo
signUpRequest
)
{
try
{
try
{
Optional
<
TbCfUserInfo
>
byAccount
=
userRepository
.
find
ByAccount
(
signUpRequest
.
getAccount
());
boolean
byAccount
=
userRepository
.
exists
ByAccount
(
signUpRequest
.
getAccount
());
if
(
byAccount
.
isPresent
()
)
{
if
(
byAccount
)
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Error: Username is already taken!"
);
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Error: Username is already taken!"
);
}
}
Optional
<
TbCfUserInfo
>
byEmail
=
userRepository
.
find
ByFirebaseUid
(
signUpRequest
.
getEmail
());
boolean
byEmail
=
userRepository
.
exists
ByFirebaseUid
(
signUpRequest
.
getEmail
());
if
(
byEmail
.
isPresent
()
)
{
if
(
byEmail
)
{
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Error: Email is already in use!"
);
return
new
Result
(
ResultCodeEnum
.
VALIDATE_ERROR
.
getCode
(),
"Error: Email is already in use!"
);
}
}
signUpRequest
.
setFirebaseUid
(
signUpRequest
.
getEmail
());
signUpRequest
.
setFirebaseUid
(
signUpRequest
.
getEmail
());
signUpRequest
.
setAccount
(
signUpRequest
.
getEmail
());
signUpRequest
.
setUserId
(
IdUtil
.
createIdbyUUID
());
signUpRequest
.
setUserId
(
IdUtil
.
createIdbyUUID
());
...
...
src/main/java/com/example/afrishop_v3/controllers/CouponController.java
浏览文件 @
9f4144df
package
com
.
example
.
afrishop_v3
.
controllers
;
package
com
.
example
.
afrishop_v3
.
controllers
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.enums.ResultCodeEnum
;
import
com.example.afrishop_v3.models.TbCfToicoupon
;
import
com.example.afrishop_v3.models.TbCfToicoupon
;
import
com.example.afrishop_v3.repository.TbCfCouponRepository
;
import
com.example.afrishop_v3.repository.TbCfCouponRepository
;
import
com.example.afrishop_v3.repository.TbCfToicouponRepository
;
import
com.example.afrishop_v3.repository.TbCfToicouponRepository
;
import
com.example.afrishop_v3.security.services.AuthenticationUser
;
import
com.example.afrishop_v3.security.services.AuthenticationUser
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -26,7 +25,12 @@ public class CouponController {
...
@@ -26,7 +25,12 @@ public class CouponController {
@GetMapping
@GetMapping
public
Result
getUserCoupons
(){
public
Result
getUserCoupons
(){
String
userId
=
user
.
userId
();
return
queryCouponByUserId
(
user
.
userId
());
}
@GetMapping
(
"queryCouponByUserId"
)
public
Result
queryCouponByUserId
(
@RequestParam
(
"userId"
)
String
userId
){
List
<
TbCfToicoupon
>
availableCoupons
=
repository
.
queryUserAvailableCoupon
(
userId
);
List
<
TbCfToicoupon
>
availableCoupons
=
repository
.
queryUserAvailableCoupon
(
userId
);
List
<
TbCfToicoupon
>
expiredCoupons
=
repository
.
queryUserExpiredCoupon
(
userId
);
List
<
TbCfToicoupon
>
expiredCoupons
=
repository
.
queryUserExpiredCoupon
(
userId
);
List
<
TbCfToicoupon
>
usedCoupons
=
repository
.
queryUserUsedCoupon
(
userId
);
List
<
TbCfToicoupon
>
usedCoupons
=
repository
.
queryUserUsedCoupon
(
userId
);
...
@@ -39,4 +43,26 @@ public class CouponController {
...
@@ -39,4 +43,26 @@ public class CouponController {
return
new
Result
<>(
hashMap
);
return
new
Result
<>(
hashMap
);
}
}
@GetMapping
(
"{couponId}"
)
public
Result
queryCouponDetails
(
@PathVariable
(
"couponId"
)
String
couponId
){
return
new
Result
<>(
repository
.
findById
(
couponId
));
}
@GetMapping
(
"take/{couponId}"
)
public
Result
couponTake
(
@PathVariable
(
"couponId"
)
String
couponId
){
// TODO
//TbCfCouponEntity tbCfCouponEntity=grabCoupon(couponId);
// if(tbCfCouponEntity!=null) {
// //发放优惠券
// //giveOutCoupon(tbCfUserInfoVo.getUserId(),tbCfCouponEntity);
// //result.setData(tbCfCouponEntity);
// //result.setMessage("Successfully received");
// } else {
// }
return
new
Result
(
ResultCodeEnum
.
ERROR
.
getCode
(),
"The coupon has been snapped up"
);
}
}
}
src/main/java/com/example/afrishop_v3/controllers/LogisticsController.java
0 → 100644
浏览文件 @
9f4144df
package
com
.
example
.
afrishop_v3
.
controllers
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.afrishop_v3.base.Result
;
import
com.example.afrishop_v3.enums.ResultCodeEnum
;
import
com.example.afrishop_v3.models.TbCfPlatformOrder
;
import
com.example.afrishop_v3.repository.TbCfPlatformOrderRepository
;
import
com.example.afrishop_v3.util.HttpClientUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.*
;
@RestController
@RequestMapping
(
"/logistics"
)
public
class
LogisticsController
{
@Value
(
"${logistics.track}"
)
private
String
TRACK_API
;
@Value
(
"${logistics.sign}"
)
private
String
SIGN_API
;
@Value
(
"${logistics.stock}"
)
private
String
STOCK_API
;
@Value
(
"${logistics.user}"
)
private
String
USER_NO
;
@Value
(
"${logistics.token}"
)
private
String
TOKEN
;
private
final
TbCfPlatformOrderRepository
repository
;
public
LogisticsController
(
TbCfPlatformOrderRepository
repository
)
{
this
.
repository
=
repository
;
}
@GetMapping
(
"/getOrderLogistics/{orderDetailId}"
)
public
Result
getOrderLogistics
(
@PathVariable
(
"orderDetailId"
)
String
orderDetailId
)
{
Result
result
=
new
Result
();
try
{
/**
* {
* "user_no":"shd806",
* "token":"d44426bd5b64dd2",
* "data":[{"order_no":"75319701383402C"}]
* }
*/
Optional
<
TbCfPlatformOrder
>
optional
=
repository
.
findById
(
orderDetailId
);
//还未发货
if
(!
optional
.
isPresent
())
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
());
result
.
setMessage
(
"No logistics information"
);
return
result
;
}
TbCfPlatformOrder
platformOrder
=
optional
.
get
();
//封装请求参数
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"user_no"
,
USER_NO
);
paramMap
.
put
(
"token"
,
TOKEN
);
Map
<
String
,
String
>
orderNoMap
=
new
HashMap
<>();
orderNoMap
.
put
(
"order_no"
,
platformOrder
.
getPExpressNumber
());
//快递单号
List
<
Map
<
String
,
String
>>
list
=
new
ArrayList
<>();
list
.
add
(
orderNoMap
);
paramMap
.
put
(
"data"
,
list
);
//发送请求
String
body
=
HttpClientUtil
.
sendPostWithBodyParameter
(
TRACK_API
,
paramMap
);
//返回json数据给前端
result
.
setData
(
JSONObject
.
parseObject
(
body
));
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONArray
content
=
jsonObject
.
getJSONArray
(
"content"
);
for
(
int
i
=
0
;
i
<
content
.
size
();
i
++)
{
JSONObject
object
=
content
.
getJSONObject
(
i
);
String
data
=
object
.
getString
(
"data"
);
System
.
out
.
println
(
data
);
if
(
StringUtils
.
isBlank
(
data
))
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
());
result
.
setMessage
(
"No logistics information"
);
return
result
;
}
}
result
.
setMessage
(
ResultCodeEnum
.
SUCCESS
.
getDesc
());
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
SERVICE_ERROR
.
getCode
());
result
.
setMessage
(
e
.
getMessage
());
}
return
result
;
}
}
src/main/java/com/example/afrishop_v3/models/TbCfPlatformOrder.java
0 → 100644
浏览文件 @
9f4144df
package
com
.
example
.
afrishop_v3
.
models
;
import
lombok.Data
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 第三方平台对应订单信息实体
* 表名 tb_cf_platform_order
*
* @author lipengjun
* @date 2020-06-05 11:22:12
*/
@Entity
@Data
public
class
TbCfPlatformOrder
{
/**
* 对应id
*/
@Id
private
String
relativeId
;
/**
* 订单id
*/
private
String
orderId
;
/**
* 第三方订单id
*/
private
String
pOrderId
;
/**
* 商品ID
*/
private
String
itemId
;
/**
* 第三方平台名
*/
private
String
platformName
;
/**
* 第三方平台编号
*/
private
String
platformCode
;
/**
* 第三方发货地址
*/
private
String
pDeliveryAddress
;
/**
* 代购人
*/
private
String
userName
;
/**
* 代购人id
*/
private
String
userId
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 实际付款
*/
private
BigDecimal
realityPay
;
/**
* 第三方快递单号
*/
private
String
pExpressNumber
;
/**
* 商品品名id
*/
private
String
descripitionId
;
/**
* 物流状态 10:无 20:有
*/
private
Integer
logisticsStatus
;
/**
* 设置:对应id
*/
public
void
setRelativeId
(
String
relativeId
)
{
this
.
relativeId
=
relativeId
;
}
/**
* 获取:对应id
*/
public
String
getRelativeId
()
{
return
relativeId
;
}
/**
* 设置:订单id
*/
public
void
setOrderId
(
String
orderId
)
{
this
.
orderId
=
orderId
;
}
/**
* 获取:订单id
*/
public
String
getOrderId
()
{
return
orderId
;
}
/**
* 设置:第三方订单id
*/
public
void
setPOrderId
(
String
pOrderId
)
{
this
.
pOrderId
=
pOrderId
;
}
/**
* 获取:第三方订单id
*/
public
String
getPOrderId
()
{
return
pOrderId
;
}
/**
* 设置:商品ID
*/
public
void
setItemId
(
String
itemId
)
{
this
.
itemId
=
itemId
;
}
/**
* 获取:商品ID
*/
public
String
getItemId
()
{
return
itemId
;
}
/**
* 设置:第三方平台名
*/
public
void
setPlatformName
(
String
platformName
)
{
this
.
platformName
=
platformName
;
}
/**
* 获取:第三方平台名
*/
public
String
getPlatformName
()
{
return
platformName
;
}
/**
* 设置:第三方平台编号
*/
public
void
setPlatformCode
(
String
platformCode
)
{
this
.
platformCode
=
platformCode
;
}
/**
* 获取:第三方平台编号
*/
public
String
getPlatformCode
()
{
return
platformCode
;
}
/**
* 设置:第三方发货地址
*/
public
void
setPDeliveryAddress
(
String
pDeliveryAddress
)
{
this
.
pDeliveryAddress
=
pDeliveryAddress
;
}
/**
* 获取:第三方发货地址
*/
public
String
getPDeliveryAddress
()
{
return
pDeliveryAddress
;
}
/**
* 设置:代购人
*/
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
/**
* 获取:代购人
*/
public
String
getUserName
()
{
return
userName
;
}
/**
* 设置:代购人id
*/
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
/**
* 获取:代购人id
*/
public
String
getUserId
()
{
return
userId
;
}
/**
* 设置:创建时间
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* 获取:创建时间
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:实际付款
*/
public
void
setRealityPay
(
BigDecimal
realityPay
)
{
this
.
realityPay
=
realityPay
;
}
/**
* 获取:实际付款
*/
public
BigDecimal
getRealityPay
()
{
return
realityPay
;
}
/**
* 设置:第三方快递单号
*/
public
void
setPExpressNumber
(
String
pExpressNumber
)
{
this
.
pExpressNumber
=
pExpressNumber
;
}
/**
* 获取:第三方快递单号
*/
public
String
getPExpressNumber
()
{
return
pExpressNumber
;
}
/**
* 设置:商品品名id
*/
public
void
setDescripitionId
(
String
descripitionId
)
{
this
.
descripitionId
=
descripitionId
;
}
/**
* 获取:商品品名id
*/
public
String
getDescripitionId
()
{
return
descripitionId
;
}
/**
* 设置:物流状态 10:无 20:有
*/
public
void
setLogisticsStatus
(
Integer
logisticsStatus
)
{
this
.
logisticsStatus
=
logisticsStatus
;
}
/**
* 获取:物流状态 10:无 20:有
*/
public
Integer
getLogisticsStatus
()
{
return
logisticsStatus
;
}
}
src/main/java/com/example/afrishop_v3/repository/TbCfPlatformOrderRepository.java
0 → 100644
浏览文件 @
9f4144df
package
com
.
example
.
afrishop_v3
.
repository
;
import
com.example.afrishop_v3.models.TbCfPlatformOrder
;
import
org.springframework.data.repository.PagingAndSortingRepository
;
public
interface
TbCfPlatformOrderRepository
extends
PagingAndSortingRepository
<
TbCfPlatformOrder
,
String
>
{
}
src/main/java/com/example/afrishop_v3/repository/UserRepository.java
浏览文件 @
9f4144df
...
@@ -7,7 +7,9 @@ import java.util.Optional;
...
@@ -7,7 +7,9 @@ import java.util.Optional;
public
interface
UserRepository
extends
PagingAndSortingRepository
<
TbCfUserInfo
,
String
>
{
public
interface
UserRepository
extends
PagingAndSortingRepository
<
TbCfUserInfo
,
String
>
{
Optional
<
TbCfUserInfo
>
findByAccount
(
String
s
);
Optional
<
TbCfUserInfo
>
findByAccount
(
String
s
);
boolean
existsByAccount
(
String
s
);
Optional
<
TbCfUserInfo
>
findByFirebaseUid
(
String
s
);
Optional
<
TbCfUserInfo
>
findByFirebaseUid
(
String
s
);
boolean
existsByFirebaseUid
(
String
s
);
Optional
<
TbCfUserInfo
>
findFirstByEmail
(
String
s
);
Optional
<
TbCfUserInfo
>
findFirstByEmail
(
String
s
);
Optional
<
TbCfUserInfo
>
findByCode
(
String
s
);
Optional
<
TbCfUserInfo
>
findByCode
(
String
s
);
boolean
existsByCode
(
String
code
);
boolean
existsByCode
(
String
code
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论