Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dm_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
dm_project
Commits
2eca6b14
Commit
2eca6b14
authored
Jan 04, 2021
by
ysongq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
eeae9c4a
Changes
22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
250 additions
and
578 deletions
+250
-578
AuthModeEnum.java
.../src/main/java/com/jz/common/enums/auth/AuthModeEnum.java
+9
-0
AuthTypeEnum.java
.../src/main/java/com/jz/common/enums/auth/AuthTypeEnum.java
+2
-0
RestTemplateUtils.java
.../src/main/java/com/jz/common/utils/RestTemplateUtils.java
+65
-0
WebUtils.java
jz-dm-common/src/main/java/com/jz/common/utils/WebUtils.java
+0
-450
Application.java
jz-dm-mall/src/main/java/com/jz/dm/mall/Application.java
+7
-0
DataGoodsApiDto.java
...all/moduls/controller/goods/bean/dto/DataGoodsApiDto.java
+3
-0
OrderController.java
...m/jz/dm/mall/moduls/controller/order/OrderController.java
+0
-1
PayController.java
...a/com/jz/dm/mall/moduls/controller/pay/PayController.java
+3
-1
PayDto.java
...java/com/jz/dm/mall/moduls/controller/pay/dto/PayDto.java
+4
-1
AuthMallUserApiReq.java
...dm/mall/moduls/controller/pay/req/AuthMallUserApiReq.java
+3
-2
StatusReq.java
...a/com/jz/dm/mall/moduls/controller/pay/req/StatusReq.java
+22
-0
FinanceTradeFlow.java
...n/java/com/jz/dm/mall/moduls/entity/FinanceTradeFlow.java
+6
-86
FinanceCustomerAssetsDao.java
...om/jz/dm/mall/moduls/mapper/FinanceCustomerAssetsDao.java
+3
-1
OrderDao.java
.../src/main/java/com/jz/dm/mall/moduls/mapper/OrderDao.java
+0
-1
OrderService.java
...main/java/com/jz/dm/mall/moduls/service/OrderService.java
+0
-2
PayService.java
...c/main/java/com/jz/dm/mall/moduls/service/PayService.java
+1
-1
OrderServiceImpl.java
.../com/jz/dm/mall/moduls/service/impl/OrderServiceImpl.java
+0
-3
PayServiceImpl.java
...va/com/jz/dm/mall/moduls/service/impl/PayServiceImpl.java
+39
-4
DataGoodsApiDao.xml
jz-dm-mall/src/main/resources/mapperconf/DataGoodsApiDao.xml
+1
-0
FinanceCustomerAssetsDao.xml
...rc/main/resources/mapperconf/FinanceCustomerAssetsDao.xml
+23
-4
MakeDataBankApiReq.java
...uls/controller/goods/bean/request/MakeDataBankApiReq.java
+6
-6
DataGoodsServiceImpl.java
...m/jz/manage/moduls/service/impl/DataGoodsServiceImpl.java
+53
-15
No files found.
jz-dm-common/src/main/java/com/jz/common/enums/auth/AuthModeEnum.java
View file @
2eca6b14
...
...
@@ -34,4 +34,13 @@ public enum AuthModeEnum {
public
String
getText
()
{
return
text
;
}
public
static
AuthModeEnum
fromTypeName
(
String
typeName
)
{
for
(
AuthModeEnum
type
:
AuthModeEnum
.
values
())
{
if
(
type
.
name
().
equals
(
typeName
))
{
return
type
;
}
}
return
null
;
}
}
jz-dm-common/src/main/java/com/jz/common/enums/auth/AuthTypeEnum.java
View file @
2eca6b14
...
...
@@ -29,4 +29,6 @@ public enum AuthTypeEnum {
public
String
getText
()
{
return
text
;
}
}
jz-dm-common/src/main/java/com/jz/common/utils/RestTemplateUtils.java
0 → 100644
View file @
2eca6b14
package
com
.
jz
.
common
.
utils
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.client.RestTemplate
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/31
* @Version:
*/
public
class
RestTemplateUtils
{
private
static
class
SingletonRestTemplate
{
static
final
RestTemplate
INSTANCE
=
new
RestTemplate
();
}
private
RestTemplateUtils
()
{
}
public
static
RestTemplate
getInstance
()
{
return
SingletonRestTemplate
.
INSTANCE
;
}
/**
* post 请求
* @param url 请求路径
* @param data body数据
* @param token JWT所需的Token,不需要的可去掉
* @return
*/
public
static
String
post
(
String
url
,
String
data
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Accept"
,
"application/json"
);
headers
.
add
(
"Content-Encoding"
,
"UTF-8"
);
headers
.
add
(
"Content-Type"
,
"application/json; charset=UTF-8"
);
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
data
,
headers
);
return
RestTemplateUtils
.
getInstance
().
postForObject
(
url
,
requestEntity
,
String
.
class
);
}
/**
* get 请求
* @param url 请求路径
* @param token JWT所需的Token,不需要的可去掉
* @return
*/
public
static
String
get
(
String
url
,
String
token
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Accept"
,
"application/json"
);
headers
.
add
(
"Content-Encoding"
,
"UTF-8"
);
headers
.
add
(
"Content-Type"
,
"application/json; charset=UTF-8"
);
if
(
token
!=
null
)
{
headers
.
add
(
"Authorization"
,
token
);
}
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
null
,
headers
);
ResponseEntity
<
String
>
response
=
RestTemplateUtils
.
getInstance
().
exchange
(
url
,
HttpMethod
.
GET
,
requestEntity
,
String
.
class
);
String
responseBody
=
response
.
getBody
();
return
responseBody
;
}
}
\ No newline at end of file
jz-dm-common/src/main/java/com/jz/common/utils/WebUtils.java
deleted
100644 → 0
View file @
eeae9c4a
This diff is collapsed.
Click to expand it.
jz-dm-mall/src/main/java/com/jz/dm/mall/Application.java
View file @
2eca6b14
...
...
@@ -3,8 +3,10 @@ package com.jz.dm.mall;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
org.springframework.web.client.RestTemplate
;
@SpringBootApplication
@EnableRedisHttpSession
...
...
@@ -18,4 +20,9 @@ public class Application {
}
@Bean
public
RestTemplate
restTemplate
()
{
return
new
RestTemplate
();
}
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/goods/bean/dto/DataGoodsApiDto.java
View file @
2eca6b14
...
...
@@ -78,6 +78,9 @@ public class DataGoodsApiDto implements Serializable {
@ApiModelProperty
(
value
=
"返回类型"
)
private
String
returnType
;
@ApiModelProperty
(
value
=
"apiKey"
)
private
String
apiKey
;
/**
* 更新时间
*/
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/order/OrderController.java
View file @
2eca6b14
...
...
@@ -5,7 +5,6 @@ import com.jz.common.constant.Constants;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderRequest
;
import
com.jz.dm.mall.moduls.controller.order.dto.PayDto
;
import
com.jz.dm.mall.moduls.service.OrderService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/pay/PayController.java
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
pay
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.
order
.dto.PayDto
;
import
com.jz.dm.mall.moduls.controller.
pay
.dto.PayDto
;
import
com.jz.dm.mall.moduls.service.PayService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
*/
@RestController
@RequestMapping
(
"/pay"
)
@CrossOrigin
@Api
(
tags
=
"支付controller"
)
public
class
PayController
{
...
...
@@ -25,6 +26,7 @@ public class PayController {
@PostMapping
(
"/payment"
)
@ApiOperation
(
value
=
"支付功能"
)
public
Result
payController
(
@RequestBody
PayDto
payDto
)
throws
Exception
{
// payDto是请求
Result
result
=
new
Result
();
try
{
result
=
payService
.
goodsPay
(
payDto
);
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/
order
/dto/PayDto.java
→
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/
pay
/dto/PayDto.java
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
order
.
dto
;
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
pay
.
dto
;
import
com.jz.common.enums.auth.AuthModeEnum
;
import
com.jz.common.enums.auth.AuthTypeEnum
;
...
...
@@ -27,6 +27,9 @@ public class PayDto implements Serializable {
@ApiModelProperty
(
value
=
"企业id"
)
private
Long
departmentId
;
@ApiModelProperty
(
value
=
"apiKey"
)
private
String
apiKey
;
@ApiModelProperty
(
value
=
"资产账户id"
)
private
String
assetsId
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/pay/req/AuthMallUserApiReq.java
View file @
2eca6b14
...
...
@@ -8,6 +8,7 @@ import lombok.Data;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @ClassName:
...
...
@@ -43,9 +44,9 @@ public class AuthMallUserApiReq implements Serializable {
private
AuthModeEnum
authMode
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
false
)
private
String
validStartTime
;
private
Date
validStartTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
false
)
private
String
validEndTime
;
private
Date
validEndTime
;
@ApiModelProperty
(
value
=
"备注"
,
required
=
false
)
private
String
remark
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/controller/pay/req/StatusReq.java
0 → 100644
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
controller
.
pay
.
req
;
import
lombok.Data
;
/**
* @ClassName:
* @Author: Carl
* @Date: 2021/1/3
* @Version:
*/
@Data
public
class
StatusReq
{
private
Boolean
success
;
private
String
message
;
private
String
code
;
private
String
[]
data
;
}
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/entity/FinanceTradeFlow.java
View file @
2eca6b14
...
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
...
...
@@ -17,6 +18,7 @@ import java.util.Date;
*/
@TableName
(
"t_finance_trade_flow"
)
@ApiModel
@Data
public
class
FinanceTradeFlow
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
55257582310832314L
;
/**
...
...
@@ -58,97 +60,15 @@ public class FinanceTradeFlow implements Serializable {
* 创建人
*/
private
String
crePerson
;
private
Date
uptTime
;
private
String
uptPerson
;
/**
* 删除标识
*/
private
String
delFlag
;
public
Long
getAssetsId
()
{
return
AssetsId
;
}
public
void
setAssetsId
(
Long
assetsId
)
{
AssetsId
=
assetsId
;
}
public
Long
getTradeFlowId
()
{
return
tradeFlowId
;
}
public
void
setTradeFlowId
(
Long
tradeFlowId
)
{
this
.
tradeFlowId
=
tradeFlowId
;
}
public
Long
getOrderId
()
{
return
orderId
;
}
public
void
setOrderId
(
Long
orderId
)
{
this
.
orderId
=
orderId
;
}
public
Long
getCashOutId
()
{
return
cashOutId
;
}
public
void
setCashOutId
(
Long
cashOutId
)
{
this
.
cashOutId
=
cashOutId
;
}
public
Long
getCustomerBalanceId
()
{
return
customerBalanceId
;
}
public
void
setCustomerBalanceId
(
Long
customerBalanceId
)
{
this
.
customerBalanceId
=
customerBalanceId
;
}
public
String
getTradeFlowNumber
()
{
return
tradeFlowNumber
;
}
public
void
setTradeFlowNumber
(
String
tradeFlowNumber
)
{
this
.
tradeFlowNumber
=
tradeFlowNumber
;
}
public
BigDecimal
getTradeMoney
()
{
return
tradeMoney
;
}
public
void
setTradeMoney
(
BigDecimal
tradeMoney
)
{
this
.
tradeMoney
=
tradeMoney
;
}
public
String
getTradeType
()
{
return
tradeType
;
}
public
void
setTradeType
(
String
tradeType
)
{
this
.
tradeType
=
tradeType
;
}
public
Date
getCreTime
()
{
return
creTime
;
}
public
void
setCreTime
(
Date
creTime
)
{
this
.
creTime
=
creTime
;
}
public
String
getCrePerson
()
{
return
crePerson
;
}
public
void
setCrePerson
(
String
crePerson
)
{
this
.
crePerson
=
crePerson
;
}
public
String
getDelFlag
()
{
return
delFlag
;
}
public
void
setDelFlag
(
String
delFlag
)
{
this
.
delFlag
=
delFlag
;
}
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/FinanceCustomerAssetsDao.java
View file @
2eca6b14
...
...
@@ -26,5 +26,7 @@ public interface FinanceCustomerAssetsDao extends BaseMapper<FinanceCustomerAsse
FinanceCustomerAssets
findById
(
@Param
(
"assetsId"
)
Long
assetsId
);
void
addAssets
(
FinanceCustomerAssets
assets
);
void
updateAssets
(
FinanceCustomerAssets
assets
);
}
\ No newline at end of file
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/mapper/OrderDao.java
View file @
2eca6b14
...
...
@@ -4,7 +4,6 @@ import com.jz.common.base.BaseMapper;
import
com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiDto
;
import
com.jz.dm.mall.moduls.controller.order.bean.DataGoodsApiParamsDto
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
com.jz.dm.mall.moduls.controller.order.dto.PayDto
;
import
com.jz.dm.mall.moduls.entity.Order
;
import
org.apache.ibatis.annotations.Param
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/OrderService.java
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.common.bean.PageInfoResponse
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderDto
;
import
com.jz.dm.mall.moduls.controller.order.bean.OrderRequest
;
import
com.jz.dm.mall.moduls.controller.order.dto.PayDto
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Map
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/PayService.java
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.
order
.dto.PayDto
;
import
com.jz.dm.mall.moduls.controller.
pay
.dto.PayDto
;
/**
* @ClassName:
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/OrderServiceImpl.java
View file @
2eca6b14
...
...
@@ -6,10 +6,7 @@ import com.jz.common.bean.PageInfoResponse;
import
com.jz.common.constant.Constants
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.order.bean.*
;
import
com.jz.dm.mall.moduls.controller.order.dto.PayDto
;
import
com.jz.dm.mall.moduls.entity.Order
;
import
com.jz.dm.mall.moduls.mapper.OrderDao
;
import
com.jz.dm.mall.moduls.service.OrderService
;
...
...
jz-dm-mall/src/main/java/com/jz/dm/mall/moduls/service/impl/PayServiceImpl.java
View file @
2eca6b14
package
com
.
jz
.
dm
.
mall
.
moduls
.
service
.
impl
;
import
com.alibaba.druid.support.json.JSONUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.gson.JsonObject
;
import
com.jz.common.constant.ResultCode
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.enums.auth.AuthModeEnum
;
import
com.jz.common.enums.auth.AuthTypeEnum
;
import
com.jz.common.utils.DateUtils
;
import
com.jz.common.utils.NumberUtils
;
import
com.jz.common.utils.RestTemplateUtils
;
import
com.jz.common.utils.Result
;
import
com.jz.dm.mall.moduls.controller.order.dto.PayDto
;
import
com.jz.dm.mall.moduls.controller.pay.dto.PayDto
;
import
com.jz.dm.mall.moduls.controller.pay.req.AuthMallUserApiReq
;
import
com.jz.dm.mall.moduls.controller.pay.req.StatusReq
;
import
com.jz.dm.mall.moduls.entity.*
;
import
com.jz.dm.mall.moduls.mapper.*
;
import
com.jz.dm.mall.moduls.service.PayService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.client.RestTemplate
;
import
java.math.BigDecimal
;
...
...
@@ -43,6 +58,9 @@ public class PayServiceImpl implements PayService {
@Autowired
private
FinanceTradeFlowDao
financeTradeFlowDao
;
@Autowired
private
RestTemplate
restTemplate
;
/**
* 新增订单
*
...
...
@@ -112,11 +130,28 @@ public class PayServiceImpl implements PayService {
return
Result
.
error
(
"金额不足!请充值!"
);
}
BigDecimal
subtract
=
bigDecimal
.
subtract
(
bigDecima2
);
String
uri
=
"http://127.0.0.1:8088/api/auth/mall-user-auth-api"
;
AuthMallUserApiReq
apiReq
=
new
AuthMallUserApiReq
();
apiReq
.
setApiKey
(
payDto
.
getApiKey
());
apiReq
.
setAuthMode
(
AuthModeEnum
.
RECORD_TIME_MODE
);
apiReq
.
setAuthType
(
AuthTypeEnum
.
DATA_BANK_AUTH
);
apiReq
.
setOrgCode
(
"WAISJYX40E3e"
);
// TODO
apiReq
.
setOrgType
(
"OUT"
);
apiReq
.
setUserId
(
payDto
.
getCustomerId
()
+
""
);
apiReq
.
setValidStartTime
(
order
.
getTakeEffectTime
());
apiReq
.
setValidEndTime
(
order
.
getInvalidTime
());
String
post
=
RestTemplateUtils
.
post
(
uri
,
JSON
.
toJSONString
(
apiReq
));
JSONObject
params
=
JSONObject
.
parseObject
(
post
);
if
(
params
.
get
(
"success"
).
equals
(
"false"
)
||
StringUtils
.
isEmpty
(
params
.
get
(
"data"
))){
return
Result
.
of_error
(
"授权失败!"
);
}
assets
.
setUseMoney
(
subtract
);
assets
.
setTotalMoney
(
subtract
);
assets
.
set
Cre
Time
(
DateUtils
.
getToday
());
assets
.
set
Cre
Person
(
payDto
.
getCustomerId
()+
""
);
financeCustomerAssetsDao
.
add
Assets
(
assets
);
assets
.
set
Upt
Time
(
DateUtils
.
getToday
());
assets
.
set
Upt
Person
(
payDto
.
getCustomerId
()+
""
);
financeCustomerAssetsDao
.
update
Assets
(
assets
);
// 新增记录表
Long
assetsId
=
assets
.
getAssetsId
();
...
...
jz-dm-mall/src/main/resources/mapperconf/DataGoodsApiDao.xml
View file @
2eca6b14
...
...
@@ -35,6 +35,7 @@
t1.upt_time AS uptTime,
t1.return_data_example AS returnDataExample,
t1.request_example AS requestExample,
t1.api_key as apiKey,
t2.data_picture as dataPicture,
t3.supplier_name AS supplierName,
t4.api_params_id AS apiParamsId,
...
...
jz-dm-mall/src/main/resources/mapperconf/FinanceCustomerAssetsDao.xml
View file @
2eca6b14
...
...
@@ -169,9 +169,28 @@
where assets_id = #{assetsId}
</select>
<insert
id=
"addAssets"
keyProperty=
"assetsId"
useGeneratedKeys=
"true"
>
INSERT INTO t_finance_customer_assets ( department_id, use_money, total_money, cre_time, cre_person)
VALUES
(#{departmentId}, #{useMoney}, #{totalMoney}, #{creTime}, #{crePerson})
<insert
id=
"updateAssets"
parameterType=
"com.jz.dm.mall.moduls.entity.FinanceCustomerAssets"
>
update t_finance_customer_assets
<set>
<if
test=
"departmentId != null"
>
department_id = #{departmentId},
</if>
<if
test=
"useMoney != null"
>
use_money = #{useMoney},
</if>
<if
test=
"totalMoney != null"
>
total_money = #{totalMoney},
</if>
<if
test=
"uptTime != null"
>
upt_time = #{uptTime},
</if>
<if
test=
"uptPerson != null and uptPerson != ''"
>
upt_person = #{uptPerson},
</if>
<if
test=
"delFlag != null and delFlag != ''"
>
del_flag = #{delFlag},
</if>
</set>
where assets_id = #{assetsId}
</insert>
</mapper>
\ No newline at end of file
jz-dm-manage/src/main/java/com/jz/manage/moduls/controller/goods/bean/request/MakeDataBankApiReq.java
View file @
2eca6b14
...
...
@@ -24,19 +24,19 @@ public class MakeDataBankApiReq implements Serializable {
@NotNull
(
message
=
"api类型不能为空"
)
public
String
apiType
;
@ApiModelProperty
(
value
=
"apiId 等价于apiKey"
,
required
=
true
)
@NotNull
(
message
=
"apiId不能为空"
)
public
String
apiId
;
//
@ApiModelProperty(value = "apiId 等价于apiKey",required = true)
//
@NotNull(message = "apiId不能为空")
//
public String apiId;
@ApiModelProperty
(
value
=
"接口描述"
,
required
=
false
)
public
String
apiDesc
;
@ApiModelProperty
(
value
=
"api版本"
,
required
=
false
)
public
String
version
;
//
@ApiModelProperty(value = "api版本",required = false)
//
public String version;
@ApiModelProperty
(
value
=
"传输方式(1为HTTPS,2为HTTP)"
,
required
=
true
)
@NotNull
(
message
=
"传输方式不能为空"
)
public
String
transMode
;
public
String
apiProtocl
;
@ApiModelProperty
(
value
=
"加密方式0 无,1:MD5 2:RSA"
,
required
=
true
)
@NotNull
(
message
=
"加密方式不能为空"
)
...
...
jz-dm-manage/src/main/java/com/jz/manage/moduls/service/impl/DataGoodsServiceImpl.java
View file @
2eca6b14
package
com
.
jz
.
manage
.
moduls
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -12,10 +14,8 @@ import com.jz.common.constant.Constants;
import
com.jz.common.constant.RedisMessageConstant
;
import
com.jz.common.constant.ResultMsg
;
import
com.jz.common.entity.DataGoods
;
import
com.jz.common.utils.
DateUtils
;
import
com.jz.common.utils.
*
;
import
com.jz.common.utils.Result
;
import
com.jz.common.utils.WebUtils
;
import
com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto
;
import
com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsListDto
;
import
com.jz.manage.moduls.controller.goods.bean.request.DataApiUpReq
;
...
...
@@ -29,6 +29,7 @@ import com.jz.manage.moduls.mapper.DataGoodsApiParamsDao;
import
com.jz.manage.moduls.mapper.DataGoodsDao
;
import
com.jz.manage.moduls.service.DataGoodsService
;
import
java.io.IOException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -37,6 +38,13 @@ import java.util.Map;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -283,19 +291,20 @@ public class DataGoodsServiceImpl implements DataGoodsService {
apiReq
.
setApiDesc
(
dataApiUpReq
.
getApiDesc
());
apiReq
.
setApiExample
(
""
);
apiReq
.
setApiFunction
(
dataApiUpReq
.
getApiFunction
());
apiReq
.
setApiId
(
dataApiUpReq
.
getApiKey
());
//
apiReq.setApiId(dataApiUpReq.getApiKey());
apiReq
.
setApiType
(
dataApiUpReq
.
getApiType
());
apiReq
.
setVersion
(
dataApiUpReq
.
getVersionNumber
());
apiReq
.
setTransMode
(
dataApiUpReq
.
getTransMode
());
apiReq
.
setType
(
dataApiUpReq
.
getEncryMode
());
apiReq
.
setTargetUrl
(
dataApiUpReq
.
getTargetUrl
());
apiReq
.
setTimeout
(
dataApiUpReq
.
getOverTime
()
+
""
);
apiReq
.
setReqHeaders
(
"sdadasd"
);
apiReq
.
setRequestParam
(
"sdadasdd"
);
apiReq
.
setResponseParam
(
"fklfhklfhlh"
);
apiReq
.
setRespCode
(
"sdkadlahlf"
);
// apiReq.setFileId(1L);
// apiReq.setFileId(1L);
String
url
=
"http://127.0.0.1:8088/api/producer/addDataBankApiInfo"
;
System
.
out
.
println
(
JSON
.
toJSONString
(
apiReq
));
// String post = RestTemplateUtils.post(url, JSON.toJSONString(apiReq) );
// String post = WebUtils.post(url, JSON.toJSONString(apiReq));
String
s
=
doPostJson
(
url
,
JSON
.
toJSONString
(
apiReq
));
System
.
out
.
println
(
"dopost:"
+
s
);
// 赋值params
Long
goodsApi
=
dataGoodsApi
.
getGoodsApi
();
...
...
@@ -307,15 +316,18 @@ public class DataGoodsServiceImpl implements DataGoodsService {
dataApiUpReq
.
setCrePerson
(
user
.
getUserId
()
+
""
);
BeanUtils
.
copyProperties
(
dataApiUpReq
,
params
);
apiParamsDao
.
insert
(
params
);
}
}
}
//
try
{
String
url
=
"http://192.168.1.114:8088/api/producer/addDataBankApiInfo"
;
WebUtils
.
postJSON
(
url
,
apiReq
);
String
url
=
"http://127.0.0.1:8088/api/producer/addDataBankApiInfo"
;
System
.
out
.
println
(
JSON
.
toJSONString
(
apiReq
));
// String post = RestTemplateUtils.post(url, JSON.toJSONString(apiReq) );
// String post = WebUtils.post(url, JSON.toJSONString(apiReq));
// JSONObject object = doPOst(url, JSON.toJSONString(apiReq));
// System.out.println(object);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
...
...
@@ -325,5 +337,31 @@ public class DataGoodsServiceImpl implements DataGoodsService {
// return Result.of_success(ResultMsg.SUCCESS, ResultCode.SUCCESS);
return
Result
.
of_success
(
ResultMsg
.
SUCCESS
,
dataApiUpReq
);
}
public
static
String
doPostJson
(
String
url
,
String
json
)
{
// 创建Httpclient对象
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpResponse
response
=
null
;
String
resultString
=
""
;
try
{
// 创建Http Post请求
HttpPost
httpPost
=
new
HttpPost
(
url
);
// 创建请求内容
StringEntity
entity
=
new
StringEntity
(
json
,
ContentType
.
APPLICATION_JSON
);
httpPost
.
setEntity
(
entity
);
// 执行http请求
response
=
httpClient
.
execute
(
httpPost
);
resultString
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"utf-8"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
response
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
resultString
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment