Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-platform
Commits
a107b998
Commit
a107b998
authored
Aug 13, 2021
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增电商购物流程方法
parent
03e9ccd0
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
387 additions
and
38 deletions
+387
-38
KdspController.java
...cn/qg/qaplatform/controller/zdata/yxm/KdspController.java
+25
-0
RSA.java
src/main/java/cn/qg/qaplatform/encrypt/kdsp/RSA.java
+1
-1
DESUtils.java
src/main/java/cn/qg/qaplatform/encrypt/yxm/DESUtils.java
+107
-0
KdspMapper.java
src/main/java/cn/qg/qaplatform/mapper/zdata/KdspMapper.java
+9
-0
Purchase.java
src/main/java/cn/qg/qaplatform/process/Purchase.java
+198
-37
PurchaseService.java
...a/cn/qg/qaplatform/service/zdata/yxm/PurchaseService.java
+6
-0
PurchaseServiceImpl.java
...aplatform/service/zdata/yxm/impl/PurchaseServiceImpl.java
+23
-0
KdspMapper.xml
src/main/resources/mapper/zdata/KdspMapper.xml
+18
-0
No files found.
src/main/java/cn/qg/qaplatform/controller/zdata/yxm/KdspController.java
0 → 100644
View file @
a107b998
package
cn
.
qg
.
qaplatform
.
controller
.
zdata
.
yxm
;
import
cn.qg.qaplatform.config.SwitchDataSource
;
import
cn.qg.qaplatform.mapper.zdata.KdspMapper
;
import
cn.qg.qaplatform.utils.JsonResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@CrossOrigin
@RestController
@RequestMapping
(
"/kdsp"
)
public
class
KdspController
{
@Autowired
KdspMapper
kdspMapper
;
@GetMapping
(
"/sku/list"
)
public
JsonResult
getSkuList
(
String
namespace
,
Integer
skuSource
,
Double
salePriceLimit
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"kdsp"
);
return
JsonResult
.
success
(
kdspMapper
.
getSelfSupportSkuNoList
(
skuSource
,
salePriceLimit
));
}
}
src/main/java/cn/qg/qaplatform/encrypt/kdsp/RSA.java
View file @
a107b998
...
@@ -158,4 +158,4 @@ public class RSA {
...
@@ -158,4 +158,4 @@ public class RSA {
System
.
out
.
println
(
publicKey
);
System
.
out
.
println
(
publicKey
);
}
}
}
}
\ No newline at end of file
src/main/java/cn/qg/qaplatform/encrypt/yxm/DESUtils.java
0 → 100644
View file @
a107b998
package
cn
.
qg
.
qaplatform
.
encrypt
.
yxm
;
import
java.security.SecureRandom
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.DESKeySpec
;
public
class
DESUtils
{
private
static
final
String
DES
=
"DES"
;
private
static
final
String
PADDING
=
"DES/ECB/PKCS5Padding"
;
private
static
byte
[]
encrypt
(
byte
[]
src
,
byte
[]
key
)
throws
Exception
{
SecureRandom
sr
=
new
SecureRandom
();
DESKeySpec
dks
=
new
DESKeySpec
(
key
);
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
DES
);
SecretKey
secretKey
=
keyFactory
.
generateSecret
(
dks
);
Cipher
cipher
=
Cipher
.
getInstance
(
PADDING
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
,
sr
);
return
cipher
.
doFinal
(
src
);
}
private
static
byte
[]
decrypt
(
byte
[]
src
,
byte
[]
key
)
throws
Exception
{
SecureRandom
sr
=
new
SecureRandom
();
DESKeySpec
dks
=
new
DESKeySpec
(
key
);
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
DES
);
SecretKey
secretKey
=
keyFactory
.
generateSecret
(
dks
);
Cipher
cipher
=
Cipher
.
getInstance
(
PADDING
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
secretKey
,
sr
);
return
cipher
.
doFinal
(
src
);
}
private
static
String
byte2hex
(
byte
[]
b
)
{
String
hs
=
""
;
String
temp
=
""
;
for
(
int
n
=
0
;
n
<
b
.
length
;
n
++)
{
temp
=
(
Integer
.
toHexString
(
b
[
n
]
&
0XFF
));
if
(
temp
.
length
()
==
1
)
{
hs
=
hs
+
"0"
+
temp
;
}
else
{
hs
=
hs
+
temp
;
}
}
return
hs
.
toUpperCase
();
}
private
static
byte
[]
hex2byte
(
byte
[]
b
)
{
if
((
b
.
length
%
2
)
!=
0
)
{
throw
new
IllegalArgumentException
(
"length not even"
);
}
byte
[]
b2
=
new
byte
[
b
.
length
/
2
];
for
(
int
n
=
0
;
n
<
b
.
length
;
n
+=
2
)
{
String
item
=
new
String
(
b
,
n
,
2
);
b2
[
n
/
2
]
=
(
byte
)
Integer
.
parseInt
(
item
,
16
);
}
return
b2
;
}
/**
* 解密
* @param src
* @param key
* @return
*/
public
static
String
decrypt
(
String
src
,
String
key
)
{
String
decryptStr
=
""
;
try
{
byte
[]
decrypt
=
decrypt
(
hex2byte
(
src
.
getBytes
()),
key
.
getBytes
());
decryptStr
=
new
String
(
decrypt
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
decryptStr
;
}
/**
* 加密
* @param src
* @param key
* @return
*/
public
static
String
encrypt
(
String
src
,
String
key
)
{
byte
[]
bytes
=
null
;
String
encryptStr
=
""
;
try
{
bytes
=
encrypt
(
src
.
getBytes
(),
key
.
getBytes
());
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
if
(
bytes
!=
null
)
{
encryptStr
=
byte2hex
(
bytes
);
}
return
encryptStr
;
}
// public static void main(String[] args) {
// String pwd = "123123123";
// String str = encrypt(pwd, "VCC_DFDO&WEK1E0I2S3");
// String str1 = decrypt(str, "VCC_DFDO&WEK1E0I2S3");
// System.out.println(str + "_" + str1);
// }
}
src/main/java/cn/qg/qaplatform/mapper/zdata/KdspMapper.java
0 → 100644
View file @
a107b998
package
cn
.
qg
.
qaplatform
.
mapper
.
zdata
;
import
java.util.List
;
import
java.util.Map
;
public
interface
KdspMapper
{
List
<
Map
>
getSelfSupportSkuNoList
(
Integer
skuSource
,
Double
salePriceLimit
);
}
src/main/java/cn/qg/qaplatform/process/Purchase.java
View file @
a107b998
This diff is collapsed.
Click to expand it.
src/main/java/cn/qg/qaplatform/service/zdata/yxm/PurchaseService.java
0 → 100644
View file @
a107b998
package
cn
.
qg
.
qaplatform
.
service
.
zdata
.
yxm
;
public
interface
PurchaseService
{
boolean
quotaPurchase
(
String
namespace
,
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/service/zdata/yxm/impl/PurchaseServiceImpl.java
0 → 100644
View file @
a107b998
package
cn
.
qg
.
qaplatform
.
service
.
zdata
.
yxm
.
impl
;
import
cn.qg.qaplatform.service.zdata.yxm.PurchaseService
;
import
org.springframework.stereotype.Service
;
/**
* @author libo
* 2021-08-04
*/
@Service
public
class
PurchaseServiceImpl
implements
PurchaseService
{
/**
* 电商额度购买全流程
* @param namespace 环境
* @param phoneNo 手机号
* @return
*/
@Override
public
boolean
quotaPurchase
(
String
namespace
,
String
phoneNo
)
{
return
false
;
}
}
src/main/resources/mapper/zdata/KdspMapper.xml
0 → 100644
View file @
a107b998
<?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=
"cn.qg.qaplatform.mapper.zdata.KdspMapper"
>
<select
id=
"getSelfSupportSkuNoList"
resultType=
"java.util.Map"
>
SELECT
*
FROM t_sku_info
<where>
stock > 0
<if
test=
"skuSource != null and skuSource != ''"
>
AND `sku_source` = #{skuSource}
</if>
<if
test=
"salePriceLimit != null and salePriceLimit != ''"
>
AND `sale_price`
<
= #{salePriceLimit}
</if>
</where>
</select>
</mapper>
\ 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