Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
oms-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
oms-ci-test
Commits
af8cd8b2
提交
af8cd8b2
authored
8月 01, 2023
作者:
zhenjie
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' of
ssh://git.mmcuav.cn:8222/iuav/oms
into develop
上级
0ab2b6cf
bb029ef8
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
688 行增加
和
1 行删除
+688
-1
kustomization.yaml
kustomization/overlays/dev/kustomization.yaml
+1
-1
pom.xml
pom.xml
+6
-0
ResultEnum.java
src/main/java/com/mmc/oms/common/ResultEnum.java
+2
-0
DemandReleaseOrderController.java
...c/oms/controller/demand/DemandReleaseOrderController.java
+76
-0
EmojiUtils.java
...n/java/com/mmc/oms/controller/demand/util/EmojiUtils.java
+72
-0
DemandReleaseOrderDao.java
...in/java/com/mmc/oms/dao/demand/DemandReleaseOrderDao.java
+23
-0
DemandReleaseOrderDO.java
.../java/com/mmc/oms/entity/demand/DemandReleaseOrderDO.java
+134
-0
CommonPaymentVO.java
...ain/java/com/mmc/oms/model/vo/demand/CommonPaymentVO.java
+27
-0
DemandReleaseOrderVO.java
...ava/com/mmc/oms/model/vo/demand/DemandReleaseOrderVO.java
+79
-0
OrderRequestParamsVO.java
...ava/com/mmc/oms/model/vo/demand/OrderRequestParamsVO.java
+29
-0
PublisherPhoneVO.java
...in/java/com/mmc/oms/model/vo/demand/PublisherPhoneVO.java
+22
-0
UserPayInfoVO.java
src/main/java/com/mmc/oms/model/vo/demand/UserPayInfoVO.java
+30
-0
DemandReleaseOrderService.java
...com/mmc/oms/service/demand/DemandReleaseOrderService.java
+22
-0
DemandReleaseOrderServiceImpl.java
...ms/service/demand/Impl/DemandReleaseOrderServiceImpl.java
+125
-0
DemandReleaseOrderDao.xml
src/main/resources/mapper/demand/DemandReleaseOrderDao.xml
+40
-0
没有找到文件。
kustomization/overlays/dev/kustomization.yaml
浏览文件 @
af8cd8b2
...
...
@@ -14,4 +14,4 @@ patches:
images
:
-
name
:
REGISTRY/NAMESPACE/IMAGE:TAG
newName
:
mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/oms
newTag
:
8001b843dce366ad2dbfaa7d487c34f33fc888b6
newTag
:
afb7ddf2776b53bdcbb4f14def897363ec3e8e5d
pom.xml
浏览文件 @
af8cd8b2
...
...
@@ -24,6 +24,12 @@
</dependency>
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
java-emoji-converter
</artifactId>
<version>
0.1.1
</version>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpcore
</artifactId>
<version>
4.4.5
</version>
...
...
src/main/java/com/mmc/oms/common/ResultEnum.java
浏览文件 @
af8cd8b2
...
...
@@ -405,6 +405,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
THERE_IS_NO_SUCH_ORDER
(
"2017"
,
"没有当前订单,请输入正确的订单编号"
),
THE_TOKEN_CANNOT_BE_NULL
(
"2018"
,
"token不能为null"
),
THE_CURRENT_ACCOUNT_CANNOT_PLACE_ORDERS
(
"2019"
,
"后台管理账号不能下单"
),
NO_PAYMENT_REQUIRED
(
"20021"
,
"自己发布的需求无需支付"
),
THE_CURRENT_DEMAND_IS_PAID
(
"200022"
,
"当前需求已支付,无需重复支付"
),
THIRD_PARTY_ERRORS
(
"2020"
,
"第三方接口错误或者第三接口正在更新"
);
/**
...
...
src/main/java/com/mmc/oms/controller/demand/DemandReleaseOrderController.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
controller
.
demand
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mmc.oms.common.publicinterface.Insert
;
import
com.mmc.oms.common.publicinterface.Update
;
import
com.mmc.oms.common.result.ResultBody
;
import
com.mmc.oms.controller.BaseController
;
import
com.mmc.oms.model.vo.demand.CommonPaymentVO
;
import
com.mmc.oms.model.vo.demand.DemandReleaseOrderVO
;
import
com.mmc.oms.service.demand.DemandReleaseOrderService
;
import
io.swagger.annotations.*
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Author small
* @Date 2023/7/25 15:04
* @Version 1.0
*/
@Api
(
tags
=
{
"需求发布订单"
})
@RestController
@RequestMapping
(
"/releaseOrder"
)
public
class
DemandReleaseOrderController
extends
BaseController
{
@Autowired
private
DemandReleaseOrderService
releaseOrderService
;
@ApiIgnore
@ApiOperation
(
value
=
"小程序——需求发布订单"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/publish"
)
public
ResultBody
publish
(
@RequestBody
@Validated
(
value
=
{
Insert
.
class
})
DemandReleaseOrderVO
demandReleaseOrderVO
,
HttpServletRequest
request
)
{
demandReleaseOrderVO
.
setUserAccountId
(
this
.
getCurrentAccount
(
request
).
getUserAccountId
());
return
releaseOrderService
.
publish
(
demandReleaseOrderVO
,
request
);
}
@ApiOperation
(
value
=
"订单支付"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/orderPayment"
)
public
ResultBody
orderPayment
(
@RequestBody
@Validated
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
)
{
return
releaseOrderService
.
orderPayment
(
commonPaymentVO
,
request
,
this
.
getCurrentAccount
(
request
).
getUserAccountId
());
}
@ApiOperation
(
value
=
"获取发布者的电话"
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
ResultBody
.
class
)})
@PostMapping
(
"/getPublishPhone"
)
public
ResultBody
getPublishPhone
(
@RequestBody
@Validated
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
)
{
return
releaseOrderService
.
getPublishPhone
(
commonPaymentVO
,
request
,
this
.
getCurrentAccount
(
request
).
getUserAccountId
());
}
}
src/main/java/com/mmc/oms/controller/demand/util/EmojiUtils.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
controller
.
demand
.
util
;
import
com.github.binarywang.java.emoji.EmojiConverter
;
/**
* @Author small
* @Date 2023/7/27 10:32
* @Version 1.0
*/
public
class
EmojiUtils
{
private
static
EmojiConverter
emojiConverter
=
EmojiConverter
.
getInstance
();
/**
* 判断字符串有没有emoji字符
* @param source
* @return
*/
public
static
boolean
containsEmoji
(
String
source
)
{
int
len
=
source
.
length
();
boolean
isEmoji
=
false
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
hs
=
source
.
charAt
(
i
);
if
(
0xd800
<=
hs
&&
hs
<=
0xdbff
)
{
if
(
source
.
length
()
>
1
)
{
char
ls
=
source
.
charAt
(
i
+
1
);
int
uc
=
((
hs
-
0xd800
)
*
0x400
)
+
(
ls
-
0xdc00
)
+
0x10000
;
if
(
0x1d000
<=
uc
&&
uc
<=
0x1f77f
)
{
return
true
;
}
}
}
else
{
// non surrogate
if
(
0x2100
<=
hs
&&
hs
<=
0x27ff
&&
hs
!=
0x263b
)
{
return
true
;
}
else
if
(
0x2B05
<=
hs
&&
hs
<=
0x2b07
)
{
return
true
;
}
else
if
(
0x2934
<=
hs
&&
hs
<=
0x2935
)
{
return
true
;
}
else
if
(
0x3297
<=
hs
&&
hs
<=
0x3299
)
{
return
true
;
}
else
if
(
hs
==
0xa9
||
hs
==
0xae
||
hs
==
0x303d
||
hs
==
0x3030
||
hs
==
0x2b55
||
hs
==
0x2b1c
||
hs
==
0x2b1b
||
hs
==
0x2b50
||
hs
==
0x231a
)
{
return
true
;
}
if
(!
isEmoji
&&
source
.
length
()
>
1
&&
i
<
source
.
length
()
-
1
)
{
char
ls
=
source
.
charAt
(
i
+
1
);
if
(
ls
==
0x20e3
)
{
return
true
;
}
}
}
}
return
isEmoji
;
}
/**
* 带有表情的字符串Emoji转义为unicode,类似🙆。
* @param emoji
* @return
*/
public
static
String
emojiConverter2Html
(
String
emoji
)
{
String
result
=
null
;
if
(
null
!=
emoji
&&
emoji
.
length
()
>
0
)
{
result
=
emojiConverter
.
toHtml
(
emoji
);
}
return
result
;
}
}
src/main/java/com/mmc/oms/dao/demand/DemandReleaseOrderDao.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
dao
.
demand
;
import
com.mmc.oms.entity.demand.DemandReleaseOrderDO
;
import
com.mmc.oms.model.vo.demand.UserPayInfoVO
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* @Author small
* @Date 2023/7/25 15:53
* @Version 1.0
*/
@Mapper
public
interface
DemandReleaseOrderDao
{
void
addRequirementsInfo
(
DemandReleaseOrderDO
requirementsInfoDO
);
DemandReleaseOrderDO
orderPayment
(
String
orderNumber
);
void
updateOrderDemand
(
DemandReleaseOrderDO
releaseOrderDO
);
DemandReleaseOrderDO
selectPhone
(
String
orderNumber
);
}
src/main/java/com/mmc/oms/entity/demand/DemandReleaseOrderDO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
entity
.
demand
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.mmc.oms.common.publicinterface.Insert
;
import
com.mmc.oms.common.publicinterface.Update
;
import
com.mmc.oms.model.vo.demand.DemandReleaseOrderVO
;
import
com.mmc.oms.model.vo.demand.OrderRequestParamsVO
;
import
com.mmc.oms.model.vo.demand.UserPayInfoVO
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Author small
* @Date 2023/7/25 15:51
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
DemandReleaseOrderDO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1811974173256250060L
;
private
Integer
id
;
private
Integer
requirementTypeId
;
private
Integer
userAccountId
;
private
Integer
provinceCode
;
private
Integer
cityCode
;
private
Integer
districtCode
;
private
String
publishName
;
private
String
publishPhone
;
private
String
requireDescription
;
private
Integer
deleted
;
//是否解决
private
Boolean
solved
;
private
Date
createTime
;
private
Date
updateTime
;
@ApiModelProperty
(
value
=
"任务标题"
,
example
=
"任务标题001"
,
required
=
true
)
@NotBlank
(
message
=
"任务标题不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
@Size
(
max
=
15
,
message
=
"任务标题限制15个字"
)
private
String
taskTitle
;
@ApiModelProperty
(
value
=
"任务开始时间"
,
example
=
"2023-07-25"
,
required
=
true
)
@NotNull
(
message
=
"任务开始时间不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
taskStartTime
;
@ApiModelProperty
(
value
=
"任务结束时间"
,
example
=
"2023-07-26"
,
required
=
true
)
@NotNull
(
message
=
"任务开始时间不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
taskEndTime
;
@ApiModelProperty
(
value
=
"任务地址"
,
example
=
"广东省深圳市"
,
required
=
true
)
@NotBlank
(
message
=
"任务地址不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
private
String
taskAddress
;
@ApiModelProperty
(
value
=
"任务经度"
,
example
=
"23.344324"
,
required
=
true
)
@NotNull
(
message
=
"任务经度不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
private
Double
longitude
;
@ApiModelProperty
(
value
=
"任务纬度"
,
example
=
"44.344324"
,
required
=
true
)
@NotNull
(
message
=
"任务纬度不能为空"
,
groups
=
{
Insert
.
class
,
Update
.
class
})
private
Double
latitude
;
@ApiModelProperty
(
value
=
"描述图片"
,
example
=
"http://,http://"
,
required
=
false
)
private
String
requireUrl
;
@ApiModelProperty
(
value
=
"类型名称"
,
example
=
"航拍摄影"
)
private
String
requirementTypeName
;
@ApiModelProperty
(
value
=
"订单编号"
,
example
=
"R202307251459553408130"
)
private
String
orderNumber
;
@ApiModelProperty
(
value
=
"应支付金额 单位元"
,
example
=
"1.00"
)
private
BigDecimal
paramMoney
;
@ApiModelProperty
(
value
=
"实际支付金额 单位元"
,
example
=
"1.00"
)
private
BigDecimal
practicalMoney
;
@ApiModelProperty
(
value
=
"发布者id"
,
example
=
"1"
,
required
=
true
)
private
Integer
publishAccountId
;
@ApiModelProperty
(
value
=
"需求发布id"
,
required
=
true
)
private
Integer
requirementsInfoId
;
public
DemandReleaseOrderDO
(
DemandReleaseOrderVO
requirementsInfoVO
)
{
this
.
requirementTypeId
=
requirementsInfoVO
.
getRequirementTypeId
();
this
.
requirementTypeName
=
requirementsInfoVO
.
getRequirementTypeName
();
this
.
userAccountId
=
requirementsInfoVO
.
getUserAccountId
();
this
.
publishName
=
requirementsInfoVO
.
getPublishName
();
this
.
publishPhone
=
requirementsInfoVO
.
getPublishPhone
();
this
.
requireDescription
=
requirementsInfoVO
.
getRequireDescription
();
this
.
taskStartTime
=
requirementsInfoVO
.
getTaskStartTime
();
this
.
taskEndTime
=
requirementsInfoVO
.
getTaskEndTime
();
this
.
taskTitle
=
requirementsInfoVO
.
getTaskTitle
();
this
.
taskAddress
=
requirementsInfoVO
.
getTaskAddress
();
this
.
longitude
=
requirementsInfoVO
.
getLongitude
();
this
.
latitude
=
requirementsInfoVO
.
getLatitude
();
this
.
requireUrl
=
requirementsInfoVO
.
getRequireUrl
();
this
.
orderNumber
=
requirementsInfoVO
.
getOrderNumber
();
this
.
paramMoney
=
requirementsInfoVO
.
getParamMoney
();
this
.
publishAccountId
=
requirementsInfoVO
.
getPublishAccountId
();
this
.
requirementsInfoId
=
requirementsInfoVO
.
getRequirementsInfoId
();
}
public
DemandReleaseOrderDO
(
UserPayInfoVO
userPayInfoVO
,
BigDecimal
divide
)
{
this
.
orderNumber
=
userPayInfoVO
.
getOutTradeNo
();
this
.
practicalMoney
=
divide
;
this
.
userAccountId
=
userPayInfoVO
.
getUserAccountId
();
}
public
OrderRequestParamsVO
buildOrderRequestParamsVO
()
{
return
OrderRequestParamsVO
.
builder
().
orderNo
(
this
.
orderNumber
).
description
(
this
.
taskTitle
).
orderPort
(
3
)
.
build
();
}
}
src/main/java/com/mmc/oms/model/vo/demand/CommonPaymentVO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
model
.
vo
.
demand
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author small
* @Date 2023/7/25 17:32
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
CommonPaymentVO
{
@ApiModelProperty
(
value
=
"订单编号"
,
example
=
"R202307251459553408130"
)
private
String
orderNumber
;
@ApiModelProperty
(
value
=
"订单来源 0:产品商城 1:租赁订单 2:培训订单 3发布需求 ...其他后续加"
)
private
Integer
orderPort
;
}
src/main/java/com/mmc/oms/model/vo/demand/DemandReleaseOrderVO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
model
.
vo
.
demand
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @Author small
* @Date 2023/7/25 15:43
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
DemandReleaseOrderVO
{
private
static
final
long
serialVersionUID
=
-
447951390213113317L
;
@ApiModelProperty
(
value
=
"需求发布id"
,
required
=
true
)
private
Integer
requirementsInfoId
;
@ApiModelProperty
(
value
=
"需求类型id"
,
example
=
"1"
,
required
=
true
)
private
Integer
requirementTypeId
;
@ApiModelProperty
(
value
=
"任务标题"
,
example
=
"任务标题001"
,
required
=
true
)
private
String
taskTitle
;
@ApiModelProperty
(
value
=
"任务开始时间"
,
example
=
"2023-07-25"
,
required
=
true
)
private
Date
taskStartTime
;
@ApiModelProperty
(
value
=
"任务结束时间"
,
example
=
"2023-07-26"
,
required
=
true
)
private
Date
taskEndTime
;
@ApiModelProperty
(
value
=
"任务地址"
,
example
=
"广东省深圳市"
,
required
=
true
)
private
String
taskAddress
;
@ApiModelProperty
(
value
=
"任务经度"
,
example
=
"23.344324"
,
required
=
true
)
private
Double
longitude
;
@ApiModelProperty
(
value
=
"任务纬度"
,
example
=
"44.344324"
,
required
=
true
)
private
Double
latitude
;
@ApiModelProperty
(
value
=
"需求描述"
,
example
=
"描述一下"
,
required
=
true
)
private
String
requireDescription
;
@ApiModelProperty
(
value
=
"描述图片"
,
example
=
"http://,http://"
,
required
=
false
)
private
String
requireUrl
;
@ApiModelProperty
(
value
=
"发布者姓名"
,
example
=
"张三"
)
private
String
publishName
;
@ApiModelProperty
(
value
=
"发布者电话"
,
example
=
"1892994543"
,
required
=
true
)
private
String
publishPhone
;
@ApiModelProperty
(
value
=
"发布者id"
,
example
=
"1"
,
required
=
true
)
private
Integer
publishAccountId
;
/**
* 后台获取token里面的用户id
*/
@ApiModelProperty
(
value
=
"token用户id"
)
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"类型名称"
)
private
String
requirementTypeName
;
@ApiModelProperty
(
value
=
"订单编号"
,
example
=
"R202307251459553408130"
)
private
String
orderNumber
;
@ApiModelProperty
(
value
=
"应支付金额 单位元"
,
example
=
"1.00"
)
private
BigDecimal
paramMoney
;
}
src/main/java/com/mmc/oms/model/vo/demand/OrderRequestParamsVO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
model
.
vo
.
demand
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @Author small
* @Date 2023/7/25 17:39
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
OrderRequestParamsVO
implements
Serializable
{
@ApiModelProperty
(
value
=
"订单编号"
)
private
String
orderNo
;
@ApiModelProperty
(
value
=
"商品描述"
)
private
String
description
;
@ApiModelProperty
(
value
=
"订单金额(分为单位)"
)
private
Integer
amount
;
@ApiModelProperty
(
value
=
"订单来源 0:产品商城 1:租赁订单 2:培训订单 ...其他后续加"
)
private
Integer
orderPort
;
}
src/main/java/com/mmc/oms/model/vo/demand/PublisherPhoneVO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
model
.
vo
.
demand
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author small
* @Date 2023/7/26 17:34
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public
class
PublisherPhoneVO
{
@ApiModelProperty
(
value
=
"发布者电话"
,
example
=
"1892994543"
,
required
=
true
)
private
String
publishPhone
;
}
src/main/java/com/mmc/oms/model/vo/demand/UserPayInfoVO.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
model
.
vo
.
demand
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
/**
* @Author small
* @Date 2023/7/26 17:49
* @Version 1.0
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
UserPayInfoVO
{
@ApiModelProperty
(
"订单号"
)
private
String
outTradeNo
;
@ApiModelProperty
(
"支付成功时间"
)
private
String
successTime
;
@ApiModelProperty
(
"用户支付金额"
)
private
Integer
wxNotifyPayerTotal
;
@ApiModelProperty
(
"交易状态"
)
private
String
tradeState
;
@ApiModelProperty
(
"用户id"
)
private
Integer
userAccountId
;
}
src/main/java/com/mmc/oms/service/demand/DemandReleaseOrderService.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
service
.
demand
;
import
com.mmc.oms.common.result.ResultBody
;
import
com.mmc.oms.model.vo.demand.CommonPaymentVO
;
import
com.mmc.oms.model.vo.demand.DemandReleaseOrderVO
;
import
javax.servlet.http.HttpServletRequest
;
/**
* @Author small
* @Date 2023/7/25 15:48
* @Version 1.0
*/
public
interface
DemandReleaseOrderService
{
ResultBody
publish
(
DemandReleaseOrderVO
demandReleaseOrderVO
,
HttpServletRequest
request
);
ResultBody
orderPayment
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
);
ResultBody
getPublishPhone
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
);
}
src/main/java/com/mmc/oms/service/demand/Impl/DemandReleaseOrderServiceImpl.java
0 → 100644
浏览文件 @
af8cd8b2
package
com
.
mmc
.
oms
.
service
.
demand
.
Impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mmc.oms.common.RedisConstant
;
import
com.mmc.oms.common.ResultEnum
;
import
com.mmc.oms.common.json.JsonUtil
;
import
com.mmc.oms.common.result.ResultBody
;
import
com.mmc.oms.controller.demand.util.EmojiUtils
;
import
com.mmc.oms.dao.demand.DemandReleaseOrderDao
;
import
com.mmc.oms.entity.demand.DemandReleaseOrderDO
;
import
com.mmc.oms.model.dto.mall.ProductSpecPriceDTO
;
import
com.mmc.oms.model.dto.order.OrderInfoDTO
;
import
com.mmc.oms.model.vo.demand.CommonPaymentVO
;
import
com.mmc.oms.model.vo.demand.DemandReleaseOrderVO
;
import
com.mmc.oms.model.vo.demand.OrderRequestParamsVO
;
import
com.mmc.oms.model.vo.demand.UserPayInfoVO
;
import
com.mmc.oms.service.demand.DemandReleaseOrderService
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Author small
* @Date 2023/7/25 15:49
* @Version 1.0
*/
@Service
public
class
DemandReleaseOrderServiceImpl
implements
DemandReleaseOrderService
{
@Autowired
private
DemandReleaseOrderDao
releaseOrderDao
;
@Autowired
private
RestTemplate
restTemplate
;
@Value
(
"${payment.url}"
)
private
String
paymentUrl
;
@Autowired
private
StringRedisTemplate
stringRedisTemplate
;
@Override
public
ResultBody
publish
(
DemandReleaseOrderVO
demandReleaseOrderVO
,
HttpServletRequest
request
)
{
DemandReleaseOrderDO
requirementsInfoDO
=
new
DemandReleaseOrderDO
(
demandReleaseOrderVO
);
releaseOrderDao
.
addRequirementsInfo
(
requirementsInfoDO
);
return
ResultBody
.
success
();
}
@Override
public
ResultBody
orderPayment
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
)
{
String
token
=
request
.
getHeader
(
"token"
);
if
(
"3"
.
equals
(
commonPaymentVO
.
getOrderPort
().
toString
())){
DemandReleaseOrderDO
demandReleaseOrderDO
=
releaseOrderDao
.
orderPayment
(
commonPaymentVO
.
getOrderNumber
());
BigDecimal
paramMoney
=
demandReleaseOrderDO
.
getParamMoney
();
BigDecimal
multiply
=
paramMoney
.
multiply
(
new
BigDecimal
(
100
));
int
i
=
multiply
.
intValue
();
OrderRequestParamsVO
orderRequestParamsVO
=
demandReleaseOrderDO
.
buildOrderRequestParamsVO
();
orderRequestParamsVO
.
setAmount
(
i
);
BigDecimal
practicalMoney
=
demandReleaseOrderDO
.
getPracticalMoney
();
if
(
practicalMoney
!=
null
){
return
ResultBody
.
error
(
ResultEnum
.
THE_CURRENT_DEMAND_IS_PAID
);
}
if
(
i
!=
0
){
return
releaseOrder
(
orderRequestParamsVO
,
token
);
}
else
if
(
i
==
0
){
return
ResultBody
.
error
(
ResultEnum
.
NO_PAYMENT_REQUIRED
);
}
}
return
ResultBody
.
success
();
}
@Override
public
ResultBody
getPublishPhone
(
CommonPaymentVO
commonPaymentVO
,
HttpServletRequest
request
,
Integer
userAccountId
)
{
String
token
=
request
.
getHeader
(
"token"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"token"
,
token
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
null
,
headers
);
ResponseEntity
<
UserPayInfoVO
>
exchange
=
restTemplate
.
exchange
(
paymentUrl
+
"/wechat/queryUserPayInfo"
+
"?orderNo="
+
commonPaymentVO
.
getOrderNumber
(),
HttpMethod
.
GET
,
entity
,
UserPayInfoVO
.
class
);
UserPayInfoVO
body
=
exchange
.
getBody
();
if
(
body
.
getWxNotifyPayerTotal
()!=
null
){
BigDecimal
divide
=
BigDecimal
.
valueOf
(
Long
.
valueOf
(
body
.
getWxNotifyPayerTotal
())).
divide
(
new
BigDecimal
(
100
));
DemandReleaseOrderDO
requirementsInfoDO
=
new
DemandReleaseOrderDO
(
body
,
divide
);
releaseOrderDao
.
updateOrderDemand
(
requirementsInfoDO
);
DemandReleaseOrderDO
demandReleaseOrderDO
=
releaseOrderDao
.
selectPhone
(
requirementsInfoDO
.
getOrderNumber
());
stringRedisTemplate
.
opsForValue
().
set
(
demandReleaseOrderDO
.
getRequirementsInfoId
().
toString
(),
JsonUtil
.
parseObjToJson
(
demandReleaseOrderDO
));
return
ResultBody
.
success
(
demandReleaseOrderDO
.
getPublishPhone
());
}
return
ResultBody
.
success
();
}
public
ResultBody
releaseOrder
(
OrderRequestParamsVO
orderRequestParamsVO
,
String
token
)
{
boolean
emoji
=
EmojiUtils
.
containsEmoji
(
orderRequestParamsVO
.
getDescription
());
if
(
emoji
==
true
){
orderRequestParamsVO
.
setDescription
(
EmojiUtils
.
emojiConverter2Html
(
orderRequestParamsVO
.
getDescription
()));
}
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
add
(
"token"
,
token
);
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
orderRequestParamsVO
),
headers
);
ResponseEntity
<
Object
>
exchange
=
null
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
exchange
=
restTemplate
.
exchange
(
paymentUrl
+
"wechat/pay"
,
HttpMethod
.
POST
,
entity
,
Object
.
class
);
map
.
put
(
"Ok"
,
exchange
.
getBody
());
}
catch
(
RestClientException
e
)
{
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
return
ResultBody
.
success
(
map
);
}
}
src/main/resources/mapper/demand/DemandReleaseOrderDao.xml
0 → 100644
浏览文件 @
af8cd8b2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.mmc.oms.dao.demand.DemandReleaseOrderDao"
>
<insert
id=
"addRequirementsInfo"
parameterType=
"com.mmc.oms.entity.demand.DemandReleaseOrderDO"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO demand_release_order(requirement_type_id, user_account_id, publish_name, publish_phone,publish_account_id,
require_description, create_time,
update_time, task_title, task_start_time, task_end_time, task_address, longitude,
latitude, require_url,order_number,param_money,requirement_type_name,requirements_info_id)
VALUES (#{requirementTypeId}, #{userAccountId}, #{publishName}, #{publishPhone},#{publishAccountId},
#{requireDescription}, NOW(),
NOW(), #{taskTitle}, #{taskStartTime}, #{taskEndTime}, #{taskAddress}, #{longitude},
#{latitude}, #{requireUrl},#{orderNumber},#{paramMoney},#{requirementTypeName},#{requirementsInfoId});
</insert>
<select
id=
"orderPayment"
resultType=
"com.mmc.oms.entity.demand.DemandReleaseOrderDO"
>
select * from demand_release_order where order_number=#{orderNumber}
</select>
<update
id=
"updateOrderDemand"
parameterType=
"com.mmc.oms.entity.demand.DemandReleaseOrderDO"
>
UPDATE demand_release_order
<set>
<if
test=
"userAccountId != null"
>
user_account_id = #{userAccountId},
</if>
<if
test=
"practicalMoney != null"
>
practical_money = #{practicalMoney},
</if>
</set>
WHERE order_number = #{orderNumber}
</update>
<select
id=
"selectPhone"
resultType=
"com.mmc.oms.entity.demand.DemandReleaseOrderDO"
>
select publish_phone,requirements_info_id,user_account_id,order_number from demand_release_order where order_number = #{orderNumber}
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论