Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
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
haoban3.0
haoban-manage3.0
Commits
ee131705
Commit
ee131705
authored
Jul 05, 2022
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
链接
parent
01aacb41
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
97 additions
and
12 deletions
+97
-12
KeyDataApiService.java
.../com/gic/haoban/manage/api/service/KeyDataApiService.java
+5
-1
HmLinkApiService.java
...om/gic/haoban/manage/api/service/hm/HmLinkApiService.java
+10
-0
KeyDataServiceImpl.java
...aoban/manage/service/service/impl/KeyDataServiceImpl.java
+40
-1
KeyDataApiServiceImpl.java
...anage/service/service/out/impl/KeyDataApiServiceImpl.java
+28
-2
HmLinkApiServiceImpl.java
...age/service/service/out/impl/hm/HmLinkApiServiceImpl.java
+7
-0
HmLinkTest.java
haoban-manage3-service/src/test/java/HmLinkTest.java
+1
-3
HmLinkController.java
...gic/haoban/manage/web/controller/hm/HmLinkController.java
+6
-5
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/KeyDataApiService.java
View file @
ee131705
...
...
@@ -6,8 +6,12 @@ import com.gic.haoban.manage.api.enums.KeyDataEnum;
public
interface
KeyDataApiService
{
public
ServiceResponse
<
KeyDataDTO
>
saveData
(
String
data
,
KeyDataEnum
dataEnum
);
public
ServiceResponse
<
String
>
saveMobileData
(
Long
linkId
,
String
mobile
);
public
ServiceResponse
<
KeyDataDTO
>
saveHmData
(
String
unionid
,
Long
linkId
,
Long
hmId
);
public
ServiceResponse
<
String
>
getDataByKey
(
String
key
,
KeyDataEnum
dataEnum
);
public
ServiceResponse
<
String
>
getMobile
(
Long
linkId
,
String
key
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/hm/HmLinkApiService.java
View file @
ee131705
...
...
@@ -36,4 +36,14 @@ public interface HmLinkApiService {
public
ServiceResponse
<
Page
<
HmLinkDTO
>>
listPage
(
HmLinkSearchQDTO
qdto
,
BasePageInfo
basePageInfo
);
public
ServiceResponse
<
HmLinkDTO
>
save
(
HmLinkDTO
dto
);
/**
*
* @Title: getLinkHm
* @Description: 小程序获取展示活码
* @author xugh
* @return
* @throws
*/
public
ServiceResponse
<
HmLinkDTO
>
getLinkHmFromWxa
(
String
enterpriseId
,
String
wxaLinkId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/KeyDataServiceImpl.java
View file @
ee131705
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.Date
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.commons.util.UniqueIdUtils
;
...
...
@@ -17,13 +20,18 @@ import com.gic.haoban.manage.service.service.KeyDataService;
@Service
(
"keyDataService"
)
public
class
KeyDataServiceImpl
implements
KeyDataService
{
public
static
String
[]
PADDING
=
new
String
[]
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"A"
,
"B"
,
"C"
,
"D"
,
"E"
,
"F"
,
"G"
,
"H"
,
"I"
,
"J"
,
"K"
,
"L"
,
"M"
,
"N"
,
"O"
,
"P"
,
"Q"
,
"R"
,
"S"
,
"T"
,
"U"
,
"V"
,
"W"
,
"X"
,
"Y"
,
"Z"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
,
"g"
,
"h"
,
"i"
,
"j"
,
"k"
,
"l"
,
"m"
,
"n"
,
"o"
,
"p"
,
"q"
,
"r"
,
"s"
,
"t"
,
"u"
,
"v"
,
"w"
,
"x"
,
"y"
,
"z"
};
@Autowired
private
TabKeyDataMapper
tabKeyDataMapper
;
@Override
public
KeyDataDTO
saveData
(
String
data
,
KeyDataEnum
dataEnum
)
{
KeyDataDTO
dto
=
new
KeyDataDTO
();
dto
.
setDataKey
(
ToolUtil
.
randomUUID
(
));
dto
.
setDataKey
(
generateKey
(
dataEnum
,
data
));
dto
.
setCreateTime
(
new
Date
());
dto
.
setId
(
UniqueIdUtils
.
uniqueLong
());
dto
.
setData
(
data
);
...
...
@@ -42,4 +50,35 @@ public class KeyDataServiceImpl implements KeyDataService {
return
null
;
}
public
static
String
generateKey
(
KeyDataEnum
dataEnum
,
String
data
)
{
if
(
dataEnum
.
equals
(
KeyDataEnum
.
MOBILE
))
{
StringBuilder
sb
=
new
StringBuilder
();
String
uuid
=
ToolUtil
.
randomUUID
();
int
length
=
6
;
int
interval
=
(
int
)
(
uuid
.
length
()
/
length
);
String
str
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
if
(
i
==
length
-
1
)
{
str
=
uuid
.
substring
(
length
*
interval
);
}
else
{
str
=
uuid
.
substring
(
i
*
interval
,
i
*
interval
+
interval
);
}
int
x
=
Integer
.
parseInt
(
str
,
16
);
sb
.
append
(
PADDING
[
x
%
62
]);
}
sb
.
append
(
PADDING
[(
int
)
(
Math
.
random
()
*
62
)]);
return
JSON
.
parseObject
(
data
).
getString
(
"ljid"
)
+
"_"
+
sb
.
toString
();
}
return
UniqueIdUtils
.
uniqueLongHex
();
}
public
static
void
main
(
String
[]
args
)
{
Set
<
String
>
set
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
1000000
;
i
++)
{
String
s
=
generateKey
(
KeyDataEnum
.
MOBILE
,
"xxx"
);
set
.
add
(
s
);
}
System
.
out
.
println
(
set
.
size
());
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/KeyDataApiServiceImpl.java
View file @
ee131705
...
...
@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.out.impl;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.KeyDataDTO
;
import
com.gic.haoban.manage.api.enums.KeyDataEnum
;
...
...
@@ -17,8 +19,21 @@ public class KeyDataApiServiceImpl implements KeyDataApiService {
private
KeyDataService
keyDataService
;
@Override
public
ServiceResponse
<
KeyDataDTO
>
saveData
(
String
data
,
KeyDataEnum
dataEnum
)
{
return
ServiceResponse
.
success
(
this
.
keyDataService
.
saveData
(
data
,
dataEnum
));
public
ServiceResponse
<
KeyDataDTO
>
saveHmData
(
String
unionid
,
Long
linkId
,
Long
hmId
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"unid"
,
unionid
);
json
.
put
(
"ljid"
,
linkId
);
json
.
put
(
"hmid"
,
hmId
);
return
ServiceResponse
.
success
(
this
.
keyDataService
.
saveData
(
json
.
toString
(),
KeyDataEnum
.
DYNAMIC_HM
));
}
@Override
public
ServiceResponse
<
String
>
saveMobileData
(
Long
linkId
,
String
mobile
)
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"ph"
,
mobile
);
json
.
put
(
"ljid"
,
linkId
);
KeyDataDTO
keyData
=
this
.
keyDataService
.
saveData
(
json
.
toString
(),
KeyDataEnum
.
MOBILE
)
;
return
ServiceResponse
.
success
(
keyData
.
getDataKey
().
split
(
"_"
)[
1
]);
}
@Override
...
...
@@ -30,4 +45,15 @@ public class KeyDataApiServiceImpl implements KeyDataApiService {
return
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_OTHER
.
getCode
(),
"数据不存在"
);
}
@Override
public
ServiceResponse
<
String
>
getMobile
(
Long
linkId
,
String
key
)
{
key
=
linkId
+
"_"
+
key
;
KeyDataDTO
data
=
this
.
keyDataService
.
getDataByKey
(
key
,
KeyDataEnum
.
MOBILE
);
if
(
null
!=
data
)
{
JSONObject
json
=
JSON
.
parseObject
(
data
.
getData
());
return
ServiceResponse
.
success
(
json
.
getString
(
"ph"
));
}
return
null
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/hm/HmLinkApiServiceImpl.java
View file @
ee131705
...
...
@@ -54,4 +54,11 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
return
ServiceResponse
.
success
(
this
.
hmLinkService
.
listPage
(
qdto
,
basePageInfo
));
}
@Override
public
ServiceResponse
<
HmLinkDTO
>
getLinkHmFromWxa
(
String
enterpriseId
,
String
wxaLinkId
)
{
// hm_hmlinkid_xxx
wxaLinkId
.
split
(
"_"
)
;
return
null
;
}
}
haoban-manage3-service/src/test/java/HmLinkTest.java
View file @
ee131705
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.junit.Test
;
...
...
@@ -111,10 +110,9 @@ public class HmLinkTest {
@Test
public
void
test3
()
{
this
.
keyDataApiService
.
save
Data
(
"15990160154"
,
KeyDataEnum
.
MOBILE
)
;
this
.
keyDataApiService
.
save
MobileData
(
10000L
,
"15999"
)
;
System
.
out
.
println
(
this
.
keyDataApiService
.
getDataByKey
(
"679f17d8c2e940a28dc484689c0339db"
,
KeyDataEnum
.
MOBILE
));
;
}
@Test
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/hm/HmLinkController.java
View file @
ee131705
...
...
@@ -5,6 +5,7 @@ import java.util.Map;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -42,7 +43,7 @@ public class HmLinkController extends WebBaseController {
private
WelcomeApiService
welcomeApiService
;
@RequestMapping
(
"add"
)
public
HaobanResponse
save
(
HmLinkDTO
dto
)
{
public
HaobanResponse
save
(
@RequestBody
HmLinkDTO
dto
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
dto
.
setCreatorId
(
loginUser
.
getClerkId
());
dto
.
setCreatorName
(
loginUser
.
getClerkName
());
...
...
@@ -55,7 +56,7 @@ public class HmLinkController extends WebBaseController {
}
@RequestMapping
(
"update"
)
public
HaobanResponse
update
(
HmLinkDTO
dto
)
{
public
HaobanResponse
update
(
@RequestBody
HmLinkDTO
dto
)
{
WebLoginDTO
loginUser
=
AuthWebRequestUtil
.
getLoginUser
();
dto
.
setModifierId
(
loginUser
.
getClerkId
());
dto
.
setModifierName
(
loginUser
.
getClerkName
());
...
...
@@ -91,10 +92,10 @@ public class HmLinkController extends WebBaseController {
}
// 查询欢迎语
String
welcomeId
=
link
.
getWelcomeId
();
if
(
StringUtils
.
isNotBlank
(
welcomeId
))
{
if
(
StringUtils
.
isNotBlank
(
welcomeId
))
{
ServiceResponse
<
WelcomeDetailDTO
>
resp
=
this
.
welcomeApiService
.
getWelcome
(
welcomeId
,
enterpriseId
);
if
(
resp
.
isSuccess
()
&&
null
!=
resp
.
getResult
())
{
retMap
.
put
(
"welcome"
,
resp
.
getResult
())
;
if
(
resp
.
isSuccess
()
&&
null
!=
resp
.
getResult
())
{
retMap
.
put
(
"welcome"
,
resp
.
getResult
());
}
}
return
this
.
success
(
retMap
);
...
...
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