Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
oms
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
oms
Commits
141eeb5e
提交
141eeb5e
authored
5月 27, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rental(add)
上级
e8106efb
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
363 行增加
和
7 行删除
+363
-7
RestTemplateConfig.java
src/main/java/com/mmc/oms/config/RestTemplateConfig.java
+27
-0
RentalOrdersController.java
...n/java/com/mmc/oms/controller/RentalOrdersController.java
+20
-0
RentalOrdersDao.java
src/main/java/com/mmc/oms/dao/RentalOrdersDao.java
+11
-0
OrderInfoDO.java
src/main/java/com/mmc/oms/entity/OrderInfoDO.java
+4
-0
OrderInfoDTO.java
src/main/java/com/mmc/oms/model/dto/OrderInfoDTO.java
+3
-0
OrderInfoQO.java
src/main/java/com/mmc/oms/model/qo/OrderInfoQO.java
+76
-0
RentalOrdersServiceImpl.java
...ava/com/mmc/oms/service/Impl/RentalOrdersServiceImpl.java
+65
-7
RentalOrdersService.java
src/main/java/com/mmc/oms/service/RentalOrdersService.java
+6
-0
RentalOrdersDao.xml
src/main/resources/mapper/RentalOrdersDao.xml
+151
-0
没有找到文件。
src/main/java/com/mmc/oms/config/RestTemplateConfig.java
0 → 100644
浏览文件 @
141eeb5e
package
com
.
mmc
.
oms
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.client.ClientHttpRequestFactory
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.web.client.RestTemplate
;
/**
* @Author small @Date 2023/5/27 15:00 @Version 1.0
*/
@Configuration
public
class
RestTemplateConfig
{
@Bean
public
RestTemplate
restTemplate
(
ClientHttpRequestFactory
factory
)
{
return
new
RestTemplate
(
factory
);
}
@Bean
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
()
{
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
// 设置连接超时
factory
.
setConnectTimeout
(
15000
);
factory
.
setReadTimeout
(
5000
);
return
factory
;
}
}
src/main/java/com/mmc/oms/controller/RentalOrdersController.java
浏览文件 @
141eeb5e
...
...
@@ -2,12 +2,15 @@ package com.mmc.oms.controller;
import
com.mmc.oms.common.ResultBody
;
import
com.mmc.oms.model.dto.OrderInfoDTO
;
import
com.mmc.oms.model.qo.OrderInfoQO
;
import
com.mmc.oms.model.vo.LeaseOrderVO
;
import
com.mmc.oms.service.RentalOrdersService
;
import
io.swagger.annotations.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @Author small @Date 2023/5/26 10:49 @Version 1.0
*/
...
...
@@ -32,4 +35,21 @@ public class RentalOrdersController {
@ApiParam
(
value
=
"订单编号"
)
@RequestParam
(
required
=
true
)
String
orderNo
)
{
return
ResultBody
.
success
(
rentalOrdersService
.
getOrderDetail
(
orderNo
));
}
@ApiOperation
(
value
=
"租赁订单-分页-列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OrderInfoDTO
.
class
)})
@PostMapping
(
"listPcWechatOrder"
)
public
ResultBody
listPcWechatOrder
(
HttpServletRequest
request
,
@RequestBody
OrderInfoQO
param
)
{
return
ResultBody
.
success
(
// this.getCurrentAccount(request)
rentalOrdersService
.
listPcOrderInfo
(
param
,
null
));
}
@ApiOperation
(
value
=
"小程序-云仓-订单-分页-列表"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
OrderInfoDTO
.
class
)})
@PostMapping
(
"listPageWechatOrder"
)
public
ResultBody
listPageWechatOrder
(
HttpServletRequest
request
,
@RequestBody
OrderInfoQO
param
)
{
return
ResultBody
.
success
(
rentalOrdersService
.
listPageWechatOrder
(
null
,
param
));
}
}
src/main/java/com/mmc/oms/dao/RentalOrdersDao.java
浏览文件 @
141eeb5e
...
...
@@ -4,8 +4,11 @@ import com.mmc.oms.entity.CouponUserDO;
import
com.mmc.oms.entity.OrderInfoDO
;
import
com.mmc.oms.entity.OrderReceiptDO
;
import
com.mmc.oms.entity.OrderRefundDO
;
import
com.mmc.oms.model.qo.OrderInfoQO
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* @Author small @Date 2023/5/26 14:47 @Version 1.0
*/
...
...
@@ -22,4 +25,12 @@ public interface RentalOrdersDao {
void
insertOrderInfo
(
OrderInfoDO
orderInfo
);
void
insertOrderReceipt
(
OrderReceiptDO
receipt
);
Integer
countPcOrderInfo
(
OrderInfoQO
param
);
List
<
OrderInfoDO
>
listPcOrderInfo
(
OrderInfoQO
param
);
int
countPageOrderInfo
(
OrderInfoQO
param
);
List
<
OrderInfoDO
>
listPageOrderInfo
(
OrderInfoQO
param
);
}
src/main/java/com/mmc/oms/entity/OrderInfoDO.java
浏览文件 @
141eeb5e
...
...
@@ -121,6 +121,9 @@ public class OrderInfoDO implements Serializable {
@ApiModelProperty
(
value
=
"规格id"
,
example
=
"1"
)
private
Integer
specsId
;
@ApiModelProperty
(
value
=
"余额"
,
example
=
"4"
)
private
BigDecimal
balance
;
/**
* 辅助字段
*
...
...
@@ -165,6 +168,7 @@ public class OrderInfoDO implements Serializable {
.
returnTime
(
this
.
returnTime
)
.
couponId
(
this
.
couponId
)
.
specsId
(
this
.
specsId
)
.
balance
(
this
.
balance
)
.
build
();
}
...
...
src/main/java/com/mmc/oms/model/dto/OrderInfoDTO.java
浏览文件 @
141eeb5e
...
...
@@ -140,6 +140,9 @@ public class OrderInfoDTO implements Serializable {
@ApiModelProperty
(
value
=
"规格id"
,
example
=
"1"
)
private
Integer
specsId
;
@ApiModelProperty
(
value
=
"余额"
,
example
=
"4"
)
private
BigDecimal
balance
;
public
RepoCashDO
buildRepoCashDO
()
{
return
RepoCashDO
.
builder
()
.
uid
(
this
.
uid
)
...
...
src/main/java/com/mmc/oms/model/qo/OrderInfoQO.java
0 → 100644
浏览文件 @
141eeb5e
package
com
.
mmc
.
oms
.
model
.
qo
;
import
com.mmc.oms.common.Page
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Author small @Date 2023/5/27 15:52 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
// @ApiModel(value = "com.mmc.csf.model.qo.OrderInfoQO", description = "订单QO")
public
class
OrderInfoQO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
3503119623575892302L
;
@ApiModelProperty
(
value
=
"用户ID"
,
hidden
=
true
)
private
Integer
repoAccountId
;
@ApiModelProperty
(
value
=
"关键字"
)
private
String
keyword
;
@ApiModelProperty
(
value
=
"买家账号"
)
private
String
buyerAccount
;
@ApiModelProperty
(
value
=
"订单编号"
)
private
String
orderNo
;
@ApiModelProperty
(
value
=
"商品id"
)
private
String
wareInfoId
;
@ApiModelProperty
(
value
=
"商品名称"
)
private
String
wareTitle
;
@ApiModelProperty
(
value
=
"订单状态:查字典"
)
private
String
tranStatus
;
@ApiModelProperty
(
value
=
"开始时间"
)
private
String
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
)
private
String
endTime
;
@ApiModelProperty
(
value
=
"用户ID"
,
hidden
=
true
)
private
List
<
Integer
>
userIds
;
@ApiModelProperty
(
value
=
"单位ID"
,
hidden
=
true
)
private
List
<
Integer
>
companys
;
@ApiModelProperty
(
value
=
"页码"
,
required
=
true
)
@NotNull
(
message
=
"页码不能为空"
,
groups
=
{
Page
.
class
})
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageNo
;
@ApiModelProperty
(
value
=
"每页显示数"
,
required
=
true
)
@NotNull
(
message
=
"每页显示数不能为空"
,
groups
=
{
Page
.
class
})
@Min
(
value
=
1
,
groups
=
Page
.
class
)
private
Integer
pageSize
;
public
void
buildCurrentPage
()
{
this
.
pageNo
=
(
pageNo
-
1
)
*
pageSize
;
}
}
src/main/java/com/mmc/oms/service/Impl/RentalOrdersServiceImpl.java
浏览文件 @
141eeb5e
package
com
.
mmc
.
oms
.
service
.
Impl
;
import
com.mmc.oms.common.CodeUtil
;
import
com.mmc.oms.common.ResultBody
;
import
com.mmc.oms.common.ResultEnum
;
import
com.mmc.oms.common.TranStatusDic
;
import
com.mmc.oms.common.*
;
import
com.mmc.oms.dao.RentalOrdersDao
;
import
com.mmc.oms.entity.*
;
import
com.mmc.oms.model.dto.*
;
import
com.mmc.oms.model.qo.OrderInfoQO
;
import
com.mmc.oms.model.vo.LeaseOrderVO
;
import
com.mmc.oms.model.vo.OrderReceiptVO
;
import
com.mmc.oms.model.vo.PriceAcquisition
;
import
com.mmc.oms.model.vo.RentalOrderVO
;
import
com.mmc.oms.service.RentalOrdersService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.client.RestTemplate
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @Author small @Date 2023/5/26 10:53 @Version 1.0
...
...
@@ -26,8 +28,7 @@ import java.util.Date;
@Service
public
class
RentalOrdersServiceImpl
implements
RentalOrdersService
{
// @Autowired
// private RestTemplate restTemplate;
@Autowired
private
RestTemplate
restTemplate
;
@Autowired
private
RentalOrdersDao
rentalOrdersDao
;
...
...
@@ -50,7 +51,7 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
receipt
.
setOrderInfoId
(
orderInfo
.
getId
());
receipt
.
setCreateTime
(
cdate
);
rentalOrdersDao
.
insertOrderReceipt
(
receipt
);
orderInfo
.
setBalance
(
getRemainingBalance
(
param
.
getRepoAccountId
()));
OrderInfoDTO
dto
=
orderInfo
.
buildOrderInfoDTO
();
return
dto
;
...
...
@@ -90,6 +91,23 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
}
/**
* 通过用户id 获取用户剩余的金额
*
* @param repoAccountId
* @return
*/
public
BigDecimal
getRemainingBalance
(
Integer
repoAccountId
)
{
ResponseEntity
<
String
>
response
=
restTemplate
.
getForEntity
(
"http://localhost:8088/payment/repocash/RemainingBalance?repoAccountId="
+
repoAccountId
,
String
.
class
);
String
body
=
response
.
getBody
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
body
);
return
bigDecimal
;
}
/**
* 获取渠道等级
*
* @param userId
...
...
@@ -224,4 +242,44 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
}
return
orderInfo
;
}
@Override
public
PageResult
listPcOrderInfo
(
OrderInfoQO
param
,
BaseAccountDTO
cuser
)
{
if
(!
cuser
.
isManage
())
{
param
.
setCompanys
(
cuser
.
getCompanyInfo
().
getCompanys
());
}
Integer
count
=
rentalOrdersDao
.
countPcOrderInfo
(
param
);
if
(
count
==
0
)
{
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
}
Integer
pageNo
=
param
.
getPageNo
();
param
.
buildCurrentPage
();
List
<
OrderInfoDTO
>
data
=
rentalOrdersDao
.
listPcOrderInfo
(
param
).
stream
()
.
map
(
d
->
{
return
d
.
buildOrderInfoDTO
();
})
.
collect
(
Collectors
.
toList
());
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
}
@Override
public
PageResult
listPageWechatOrder
(
BaseAccountDTO
account
,
OrderInfoQO
param
)
{
param
.
setRepoAccountId
(
account
.
getId
());
int
count
=
rentalOrdersDao
.
countPageOrderInfo
(
param
);
if
(
count
==
0
)
{
return
PageResult
.
buildPage
(
param
.
getPageNo
(),
param
.
getPageSize
(),
count
);
}
Integer
pageNo
=
param
.
getPageNo
();
param
.
buildCurrentPage
();
List
<
OrderInfoDTO
>
data
=
rentalOrdersDao
.
listPageOrderInfo
(
param
).
stream
()
.
map
(
d
->
{
return
d
.
buildOrderInfoDTO
();
})
.
collect
(
Collectors
.
toList
());
return
PageResult
.
buildPage
(
pageNo
,
param
.
getPageSize
(),
count
,
data
);
}
}
src/main/java/com/mmc/oms/service/RentalOrdersService.java
浏览文件 @
141eeb5e
package
com
.
mmc
.
oms
.
service
;
import
com.mmc.oms.common.PageResult
;
import
com.mmc.oms.common.ResultBody
;
import
com.mmc.oms.model.dto.BaseAccountDTO
;
import
com.mmc.oms.model.dto.OrderInfoDTO
;
import
com.mmc.oms.model.qo.OrderInfoQO
;
import
com.mmc.oms.model.vo.LeaseOrderVO
;
import
com.mmc.oms.model.vo.RentalOrderVO
;
...
...
@@ -15,4 +17,8 @@ public interface RentalOrdersService {
OrderInfoDTO
getOrderDetail
(
String
orderNo
);
OrderInfoDTO
feignAddLease
(
LeaseOrderVO
param
);
PageResult
listPcOrderInfo
(
OrderInfoQO
param
,
BaseAccountDTO
cuser
);
PageResult
listPageWechatOrder
(
BaseAccountDTO
account
,
OrderInfoQO
param
);
}
src/main/resources/mapper/RentalOrdersDao.xml
浏览文件 @
141eeb5e
...
...
@@ -199,5 +199,156 @@
#{repoAddress}, #{bookPhone}, #{createTime})
</insert>
<select
id=
"countPcOrderInfo"
resultType=
"java.lang.Integer"
parameterType=
"com.mmc.oms.model.qo.OrderInfoQO"
>
select count(*)
from order_info o
<where>
1=1
<if
test=
" keyword1 != null and keyword1 != '' "
>
and (
o.uid like CONCAT('%',#{keyword1},'%')
or o.buyer_name like CONCAT('%',#{keyword1},'%')
)
</if>
<if
test=
" keyword2 != null and keyword2 != '' "
>
and (
o.order_no like CONCAT('%',#{keyword2},'%')
)
</if>
<if
test=
" keyword3 != null and keyword3 != '' "
>
and (
o.ware_no like CONCAT('%',#{keyword3},'%')
)
</if>
<if
test=
" keyword4 != null and keyword4 != '' "
>
and (
o.ware_title like CONCAT('%',#{keyword4},'%')
)
</if>
<if
test=
" startTime != null and startTime != '' "
>
and o.create_time
>
= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if
test=
" endTime != null and endTime != '' "
>
and o.create_time
<
= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if
test=
" tranStatus != null and tranStatus != '' "
>
and o.tran_status = #{tranStatus}
</if>
<if
test=
" userIds != null"
>
<foreach
collection=
"userIds"
item=
"id"
open=
"and o.repo_account_id in ("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
<if
test=
" companys != null "
>
<foreach
collection=
"companys"
item=
"id"
open=
"and o.rcd_company_id in ("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
</where>
</select>
<select
id=
"listPcOrderInfo"
resultMap=
"orderInfoResultMap"
parameterType=
"com.mmc.oms.model.qo.OrderInfoQO"
>
select o.id,o.order_no,o.ware_title,o.sku_title,o.ware_img,o.deposit,
o.unit_price,o.ware_num,o.buyer_name,o.buyer_phone,o.uid,o.remark,
o.tran_status,o.should_pay,o.actual_pay,o.pf_remark,o.create_time,o.ware_no,
rp.order_info_id,rp.receipt_method,rp.take_name,
rp.take_phone,rp.region,rp.detail_address,rp.repo_name,rp.repo_address,
rp.book_phone,rp.send_ex_code,rp.send_ex_no,rp.send_address,rp.ren_method,
rp.ren_phone,rp.ren_name,rp.ren_ex_code,rp.ren_ex_no,rp.ren_address,rp.ren_repo_name,
rp.ren_repo_addr,rp.ren_repo_phone
from order_info o
inner join order_receipt rp on rp.order_info_id=o.id
<where>
1=1
<if
test=
" keyword1 != null and keyword1 != '' "
>
and (
o.uid like CONCAT('%',#{keyword1},'%')
or o.buyer_name like CONCAT('%',#{keyword1},'%')
)
</if>
<if
test=
" keyword2 != null and keyword2 != '' "
>
and (
o.order_no like CONCAT('%',#{keyword2},'%')
)
</if>
<if
test=
" keyword3 != null and keyword3 != '' "
>
and (
o.ware_no like CONCAT('%',#{keyword3},'%')
)
</if>
<if
test=
" keyword4 != null and keyword4 != '' "
>
and (
o.ware_title like CONCAT('%',#{keyword4},'%')
)
</if>
<if
test=
" startTime != null and startTime != '' "
>
and o.create_time
>
= STR_TO_DATE(#{startTime},'%Y-%m-%d %H:%i:%s')
</if>
<if
test=
" endTime != null and endTime != '' "
>
and o.create_time
<
= STR_TO_DATE(#{endTime},'%Y-%m-%d %H:%i:%s')
</if>
<if
test=
" tranStatus != null and tranStatus != '' "
>
and o.tran_status = #{tranStatus}
</if>
<if
test=
" userIds != null"
>
<foreach
collection=
"userIds"
item=
"id"
open=
"and o.repo_account_id in ("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
<if
test=
" companys != null "
>
<foreach
collection=
"companys"
item=
"id"
open=
"and o.rcd_company_id in ("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
</where>
order by o.create_time DESC
limit #{pageNo},#{pageSize}
</select>
<select
id=
"countPageOrderInfo"
resultType=
"java.lang.Integer"
parameterType=
"com.mmc.oms.model.qo.OrderInfoQO"
>
select count(*)
from order_info o
<where>
o.repo_account_id = #{repoAccountId}
<if
test=
" tranStatus!=null and tranStatus!='' "
>
and o.tran_status = #{tranStatus}
</if>
<if
test=
" keyword!=null and keyword!='' "
>
and (
o.ware_title like CONCAT('%',#{keyword},'%')
or o.order_no like CONCAT('%',#{keyword},'%')
)
</if>
</where>
</select>
<select
id=
"listPageOrderInfo"
resultMap=
"orderInfoResultMap"
parameterType=
"com.mmc.oms.model.qo.OrderInfoQO"
>
select o.id,o.order_no,o.ware_title,o.ware_img,o.sku_title,o.tran_status,
o.ware_num,o.should_pay,o.actual_pay,
rp.order_info_id,rp.receipt_method,rp.take_name,
rp.take_phone,rp.region,rp.detail_address,rp.repo_name,rp.repo_address,
rp.book_phone,rp.send_ex_code,rp.send_ex_no,rp.send_address,rp.ren_method,
rp.ren_phone,rp.ren_name,rp.ren_ex_code,rp.ren_ex_no,rp.ren_address,rp.ren_repo_name,
rp.ren_repo_addr,rp.ren_repo_phone
from order_info o
inner join order_receipt rp on rp.order_info_id=o.id
<where>
o.repo_account_id = #{repoAccountId}
<if
test=
" tranStatus!=null and tranStatus!='' "
>
and o.tran_status = #{tranStatus}
</if>
<if
test=
" keyword!=null and keyword!='' "
>
and (
o.ware_title like CONCAT('%',#{keyword},'%')
or o.order_no like CONCAT('%',#{keyword},'%')
)
</if>
</where>
order by o.create_time DESC
limit #{pageNo},#{pageSize}
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论