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
QianQiXiang
haoban-manage3.0
Commits
6bbfd528
Commit
6bbfd528
authored
Jun 21, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试数据导入
parent
77592261
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
285 additions
and
0 deletions
+285
-0
pom.xml
haoban-manage3-operation-web/pom.xml
+6
-0
TestDataImportController.java
.../manage/web/controller/test/TestDataImportController.java
+153
-0
ImportMemberQo.java
...ain/java/com/gic/haoban/manage/web/qo/ImportMemberQo.java
+106
-0
dubbo-haoban-manage3-operation-web.xml
...ain/webapp/WEB-INF/dubbo-haoban-manage3-operation-web.xml
+7
-0
HandoverTest.java
haoban-manage3-service/src/test/java/HandoverTest.java
+13
-0
No files found.
haoban-manage3-operation-web/pom.xml
View file @
6bbfd528
...
...
@@ -214,6 +214,12 @@
<artifactId>
gic-quartz-api
</artifactId>
<version>
${gic-quartz-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
haoban-task-manage-api
</artifactId>
<version>
${haoban-task-manage-api}
</version>
</dependency>
</dependencies>
<build>
...
...
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/controller/test/TestDataImportController.java
0 → 100644
View file @
6bbfd528
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
.
test
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.RandomUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.ExternalUserDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffDTO
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService
;
import
com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService
;
import
com.gic.haoban.manage.api.service.StaffApiService
;
import
com.gic.haoban.manage.api.service.StaffClerkRelationApiService
;
import
com.gic.haoban.manage.web.controller.WebBaseController
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.ImportMemberQo
;
import
com.gic.haoban.task.manage.api.dto.MarketClueTaskDTO
;
import
com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService
;
import
com.gic.haoban.task.manage.api.service.IMarketTaskMemberApiService
;
import
net.sf.json.JSON
;
import
net.sf.json.JSONObject
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Random
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Created 2021/6/21.
*
* @author hua
*/
@RestController
@RequestMapping
(
"/test-data"
)
public
class
TestDataImportController
extends
WebBaseController
{
private
static
final
Logger
logger
=
getLogger
(
TestDataImportController
.
class
);
@Autowired
private
StaffApiService
staffApiService
;
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
private
MemberUnionidRelatedApiService
memberUnionidRelatedApiService
;
@Autowired
private
IMarketClueTaskApiService
iMarketClueTaskApiService
;
@Autowired
private
IMarketTaskMemberApiService
iMarketTaskMemberApiService
;
/**
* 导入会员好友
*
* @param qo
* @return
*/
@RequestMapping
(
"/friend-import"
)
public
HaobanResponse
importFriend
(
ImportMemberQo
qo
)
{
if
(
StringUtils
.
isAnyBlank
(
qo
.
getClerkCode
(),
qo
.
getClerkId
(),
qo
.
getDepartmentId
(),
qo
.
getEnterpriseId
(),
qo
.
getMemberId
()
,
qo
.
getPhoneNumber
(),
qo
.
getStoreId
(),
qo
.
getUnionid
(),
qo
.
getWxEnterpriseId
()))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
StaffDTO
staffDTO
=
staffApiService
.
selectByUserIdAndEnterpriseId
(
qo
.
getWxUserId
(),
qo
.
getWxEnterpriseId
());
if
(
null
==
staffDTO
)
{
StaffDTO
staff
=
new
StaffDTO
();
staff
.
setPhoneNumber
(
qo
.
getPhoneNumber
());
staff
.
setWxUserId
(
qo
.
getWxUserId
());
staff
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
staff
.
setStaffName
(
qo
.
getClerkCode
());
staff
.
setSex
(
1
);
staff
.
setNationCode
(
"86"
);
staff
.
setActiveFlag
(
1
);
ServiceResponse
add
=
staffApiService
.
add
(
staff
,
qo
.
getDepartmentId
());
if
(
add
.
getCode
()
==
1
)
{
staffDTO
=
staffApiService
.
selectById
(
add
.
getResult
().
toString
());
}
}
StaffClerkRelationDTO
clerkRelationDTO
=
staffClerkRelationApiService
.
getOneByStoreIdAndStaffId
(
qo
.
getStoreId
(),
staffDTO
.
getStaffId
());
if
(
clerkRelationDTO
==
null
)
{
StaffClerkRelationDTO
staffClerkRelationDTO
=
new
StaffClerkRelationDTO
();
staffClerkRelationDTO
.
setStoreId
(
qo
.
getStoreId
());
staffClerkRelationDTO
.
setClerkId
(
qo
.
getClerkId
());
staffClerkRelationDTO
.
setClerkCode
(
qo
.
getClerkCode
());
staffClerkRelationDTO
.
setWxUserId
(
staffDTO
.
getWxUserId
());
staffClerkRelationDTO
.
setStaffId
(
staffDTO
.
getStaffId
());
staffClerkRelationDTO
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
staffClerkRelationDTO
.
setEnterpriseId
(
qo
.
getEnterpriseId
());
ServiceResponse
response
=
staffClerkRelationApiService
.
bindStaffClerk
(
staffClerkRelationDTO
,
"-1"
,
ChannelCodeEnum
.
ADMIN_BIND
.
getCode
());
}
//新增好友
ExternalUserDTO
dto
=
new
ExternalUserDTO
();
dto
.
setUnionId
(
qo
.
getUnionid
());
dto
.
setWxUserId
(
qo
.
getWxUserId
());
dto
.
setWxEnterpriseId
(
qo
.
getWxEnterpriseId
());
dto
.
setMemberId
(
qo
.
getMemberId
());
dto
.
setExternalUserId
(
qo
.
getMemberId
());
dto
.
setClerkId
(
qo
.
getClerkId
());
dto
.
setStoreId
(
qo
.
getStoreId
());
dto
.
setEnterpriseId
(
qo
.
getEnterpriseId
());
dto
.
setName
(
"测试会员"
+
RandomUtil
.
getRandomString
(
5
));
dto
.
setStaffId
(
staffDTO
.
getStaffId
());
dto
.
setAddCreateTime
(
Long
.
valueOf
(
System
.
currentTimeMillis
()
/
1000
).
toString
());
memberUnionidRelatedApiService
.
addExternal
(
dto
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 处理任务
*
* @param ecmId 计划id
* @param enterpriseId 企业id
* @param touchFinishType 完成类型 任务完成触达方式, 1 : 企业微信, 2 : 企业电话, 3 : 私人电话, 4 : 私人短信',
* @param rate 0-100 完成百分比
* @return
*/
@RequestMapping
(
"/deal-task"
)
public
HaobanResponse
dealTask
(
String
ecmId
,
String
enterpriseId
,
String
touchFinishType
,
int
rate
)
{
if
(
StringUtils
.
isAnyBlank
(
ecmId
,
enterpriseId
,
touchFinishType
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
if
(
rate
<=
0
)
{
logger
.
info
(
"rate大于0需要"
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
BasePageInfo
basePageInfo
=
new
BasePageInfo
();
basePageInfo
.
setPageSize
(
2000
);
Page
<
MarketClueTaskDTO
>
page
=
iMarketClueTaskApiService
.
pageMarketClueTaskDTO
(
ecmId
,
enterpriseId
,
basePageInfo
);
while
(
CollectionUtils
.
isNotEmpty
(
page
.
getResult
()))
{
page
.
getResult
().
forEach
(
dto
->
{
Random
random
=
new
Random
(
100
);
int
i
=
random
.
nextInt
();
if
(
i
<=
rate
)
{
logger
.
info
(
"处理:{}"
,
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
dto
));
iMarketTaskMemberApiService
.
detailsRefresh
(
enterpriseId
,
dto
.
getTaskId
(),
true
);
}
});
page
=
iMarketClueTaskApiService
.
pageMarketClueTaskDTO
(
ecmId
,
enterpriseId
,
basePageInfo
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
haoban-manage3-operation-web/src/main/java/com/gic/haoban/manage/web/qo/ImportMemberQo.java
0 → 100644
View file @
6bbfd528
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
;
import
org.apache.commons.lang3.StringUtils
;
import
java.io.Serializable
;
/**
* Created 2021/6/21.
*
* @author hua
*/
public
class
ImportMemberQo
implements
Serializable
{
private
String
wxEnterpriseId
;
private
String
enterpriseId
;
private
String
memberId
;
private
String
unionid
;
private
String
clerkId
;
private
String
clerkCode
;
private
String
storeId
;
private
String
wxUserId
;
private
String
phoneNumber
;
private
String
departmentId
;
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getDepartmentId
()
{
return
departmentId
;
}
public
void
setDepartmentId
(
String
departmentId
)
{
this
.
departmentId
=
departmentId
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getWxEnterpriseId
()
{
return
wxEnterpriseId
;
}
public
void
setWxEnterpriseId
(
String
wxEnterpriseId
)
{
this
.
wxEnterpriseId
=
wxEnterpriseId
;
}
public
String
getMemberId
()
{
return
memberId
;
}
public
void
setMemberId
(
String
memberId
)
{
this
.
memberId
=
memberId
;
}
public
String
getUnionid
()
{
return
unionid
;
}
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
;
}
public
String
getClerkId
()
{
return
clerkId
;
}
public
void
setClerkId
(
String
clerkId
)
{
this
.
clerkId
=
clerkId
;
}
public
String
getClerkCode
()
{
return
clerkCode
;
}
public
void
setClerkCode
(
String
clerkCode
)
{
this
.
clerkCode
=
clerkCode
;
}
public
String
getStoreId
()
{
return
storeId
;
}
public
void
setStoreId
(
String
storeId
)
{
this
.
storeId
=
storeId
;
}
public
String
getWxUserId
()
{
if
(
StringUtils
.
isBlank
(
wxUserId
))
{
return
clerkCode
;
}
return
wxUserId
;
}
public
void
setWxUserId
(
String
wxUserId
)
{
this
.
wxUserId
=
wxUserId
;
}
}
haoban-manage3-operation-web/src/main/webapp/WEB-INF/dubbo-haoban-manage3-operation-web.xml
View file @
6bbfd528
...
...
@@ -35,6 +35,13 @@
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.DictApiService"
id=
"dictApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.HelpApiService"
id=
"helpApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.MaidianDictApiService"
id=
"maidianDictApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService"
id=
"memberUnionidRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService"
id=
"iMarketClueTaskApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.manage.api.service.IMarketTaskMemberApiService"
id=
"iMarketTaskMemberApiService"
/>
<dubbo:reference
id=
"applicationTemplateApiService"
interface=
"com.gic.haoban.manage.api.service.ApplicationTemplateApiService"
timeout=
"10000"
/>
...
...
haoban-manage3-service/src/test/java/HandoverTest.java
View file @
6bbfd528
...
...
@@ -3,11 +3,13 @@ import cn.hutool.core.thread.ThreadUtil;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.manage.api.dto.HandoverExternalDTO
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.TestService
;
import
com.gic.mq.sdk.GicMQClient
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.junit.Test
;
...
...
@@ -52,4 +54,15 @@ public class HandoverTest {
System
.
out
.
println
(
JSONObject
.
toJSONString
(
handoverExternalDTOPage
));
}
@Test
public
void
test3
()
{
String
wxEnterpriseId
=
"ca66a01b79474c40b3e7c7f93daf1a3b"
;
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
try
{
clientInstance
.
sendMessage
(
"haobanEcmTaskDataCallback"
,
"11111"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
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