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
d2575e0c
Commit
d2575e0c
authored
Oct 13, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
刷新次数以及主门店变更刷新企业微信好友
parent
69b362d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
33 deletions
+75
-33
ClerkMainStoreRelatedServiceImpl.java
...ervice/service/impl/ClerkMainStoreRelatedServiceImpl.java
+36
-9
test.java
haoban-manage3-service/src/test/java/test.java
+17
-9
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+20
-13
HaoBanErrCode.java
...java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
+2
-2
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/ClerkMainStoreRelatedServiceImpl.java
View file @
d2575e0c
...
@@ -5,10 +5,16 @@ import java.util.List;
...
@@ -5,10 +5,16 @@ import java.util.List;
import
java.util.Set
;
import
java.util.Set
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.enums.SyncTaskTypeEnum
;
import
com.gic.haoban.manage.api.service.DealSyncOperationApiService
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.CollectionUtils
;
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.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -16,8 +22,12 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMa
...
@@ -16,8 +22,12 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanClerkMainStoreRelatedMa
import
com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
@Service
@Service
public
class
ClerkMainStoreRelatedServiceImpl
implements
ClerkMainStoreRelatedService
{
public
class
ClerkMainStoreRelatedServiceImpl
implements
ClerkMainStoreRelatedService
{
private
static
final
Logger
logger
=
getLogger
(
ClerkMainStoreRelatedServiceImpl
.
class
);
@Autowired
@Autowired
private
TabHaobanClerkMainStoreRelatedMapper
mapper
;
private
TabHaobanClerkMainStoreRelatedMapper
mapper
;
...
@@ -28,6 +38,17 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
...
@@ -28,6 +38,17 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
@Autowired
@Autowired
private
ExternalClerkRelatedService
externalClerkRelatedService
;
private
ExternalClerkRelatedService
externalClerkRelatedService
;
@Autowired
private
DealSyncOperationApiService
dealSyncOperationApiService
;
@Autowired
private
StaffService
staffService
;
@Override
public
TabHaobanClerkMainStoreRelated
selectByWxEnterpriseIdAndStoreId
(
String
staffId
,
String
wxEnterpriseId
)
{
return
mapper
.
selectByWxEnterpriseIdAndStoreId
(
staffId
,
wxEnterpriseId
);
}
@Override
@Override
public
void
setMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
public
void
setMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
String
uuId
=
com
.
gic
.
haoban
.
common
.
utils
.
StringUtil
.
randomUUID
();
String
uuId
=
com
.
gic
.
haoban
.
common
.
utils
.
StringUtil
.
randomUUID
();
...
@@ -39,15 +60,21 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
...
@@ -39,15 +60,21 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
t
.
setCreateTime
(
now
);
t
.
setCreateTime
(
now
);
t
.
setUpdateTime
(
now
);
t
.
setUpdateTime
(
now
);
t
.
setStatusFlag
(
1
);
t
.
setStatusFlag
(
1
);
t
.
setFreshFriendFlag
(
0
);
t
.
setFreshFriendFlag
(
1
);
t
.
setClerkMainStoreRelatedId
(
uuId
);
t
.
setClerkMainStoreRelatedId
(
uuId
);
mapper
.
insert
(
t
);
mapper
.
insert
(
t
);
}
logger
.
info
(
"切换主门店-刷新企业微信好友:{},{}"
,
staffId
,
storeId
);
//主门店切换需要刷新企业微信好友
@Override
TabHaobanStaff
staff
=
staffService
.
selectById
(
staffId
);
public
TabHaobanClerkMainStoreRelated
selectByWxEnterpriseIdAndStoreId
(
String
staffId
,
String
wxEnterpriseId
)
{
String
taskName
=
"自动刷新企业微信好友("
+
staff
.
getStaffName
()
+
")"
;
return
mapper
.
selectByWxEnterpriseIdAndStoreId
(
staffId
,
wxEnterpriseId
);
String
taskId
=
dealSyncOperationApiService
.
createWxFriendTaskSingle
(
wxEnterpriseId
,
taskName
,
staffId
,
staff
.
getStaffName
(),
SyncTaskTypeEnum
.
FRIEND_SINGLE
.
getType
());
if
(
StringUtils
.
isBlank
(
taskId
))
{
logger
.
info
(
"刷新好友失败或正在刷新:{},{}"
,
staffId
,
storeId
);
return
;
}
dealSyncOperationApiService
.
dealWxFriendClerkSingle
(
taskId
,
staff
.
getWxUserId
(),
staffId
,
wxEnterpriseId
);
logger
.
info
(
"任务id:{}"
,
taskId
);
}
}
@Override
@Override
...
...
haoban-manage3-service/src/test/java/test.java
View file @
d2575e0c
...
@@ -4,26 +4,34 @@ import java.time.ZoneOffset;
...
@@ -4,26 +4,34 @@ import java.time.ZoneOffset;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanPreDealLog
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
public
class
test
{
public
class
test
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
DateTime
parse
=
DateUtil
.
parse
(
"2021-10-11"
);
int
i
=
DateUtil
.
weekOfYear
(
parse
);
System
.
out
.
println
(
i
);
// String key = "3.2.1";
// String key = "3.2.1";
// String[] split = key.split(".");
// String[] split = key.split(".");
//
//
// System.out.println(split[1]);
// System.out.println(split[1]);
Long
dimissionTime
=
1550838571L
;
//
Long dimissionTime = 1550838571L;
LocalDateTime
dateTime
=
LocalDateTime
.
ofEpochSecond
(
dimissionTime
,
0
,
ZoneOffset
.
ofHours
(
8
));
//
LocalDateTime dateTime = LocalDateTime.ofEpochSecond(dimissionTime, 0, ZoneOffset.ofHours(8));
Instant
instant
=
dateTime
.
toInstant
(
ZoneOffset
.
ofHours
(
8
));
//
Instant instant = dateTime.toInstant(ZoneOffset.ofHours(8));
Date
from
=
Date
.
from
(
instant
);
//
Date from = Date.from(instant);
System
.
out
.
println
(
from
);
//
System.out.println(from);
//
Integer
num
=
2
;
//
Integer num = 2;
int
i
=
2
&
4
;
//
int i = 2 & 4;
System
.
out
.
println
(
i
);
//
System.out.println(i);
//
//
// //插入不存在的我们pre表的企业微信数据
// //插入不存在的我们pre表的企业微信数据
// int pageSize = 500;
// int pageSize = 500;
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
d2575e0c
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.Page
;
...
@@ -29,6 +30,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
...
@@ -29,6 +30,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.haoban.manage.web.vo.*
;
import
com.gic.haoban.manage.web.vo.*
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -495,17 +497,22 @@ public class ClerkController extends WebBaseController{
...
@@ -495,17 +497,22 @@ public class ClerkController extends WebBaseController{
//设置主导购
//设置主导购
@HttpLimit
@HttpLimit
@RequestMapping
(
"/set-main-store"
)
@RequestMapping
(
"/set-main-store"
)
public
HaobanResponse
setMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
public
HaobanResponse
setMainStore
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
dateStr
)
{
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM"
);
Date
curDate
=
new
Date
(
);
if
(
staff
==
null
){
if
(
staff
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
}
String
key
=
"haoban_set_main_store_"
+
yyyyMM
+
staffId
;
//给测试使用
if
(
StringUtils
.
isNotBlank
(
dateStr
))
{
curDate
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
parse
(
dateStr
);
}
int
i
=
cn
.
hutool
.
core
.
date
.
DateUtil
.
weekOfYear
(
curDate
);
String
key
=
"haoban_set_main_store_"
+
i
+
":"
+
staffId
;
Object
hasSet
=
RedisUtil
.
getCache
(
key
);
Object
hasSet
=
RedisUtil
.
getCache
(
key
);
if
(
hasSet
==
null
){
if
(
hasSet
==
null
){
RedisUtil
.
setCache
(
key
,
true
,
31
*
24
*
60
*
60L
);
RedisUtil
.
setCache
(
key
,
true
,
7
*
24
*
60
*
60L
);
clerkMainStoreRelatedApiService
.
setMainStore
(
staffId
,
storeId
,
wxEnterpriseId
);
clerkMainStoreRelatedApiService
.
setMainStore
(
staffId
,
storeId
,
wxEnterpriseId
);
}
else
{
}
else
{
return
resultResponse
(
HaoBanErrCode
.
ERR_10031
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10031
);
}
}
...
@@ -517,13 +524,13 @@ public class ClerkController extends WebBaseController{
...
@@ -517,13 +524,13 @@ public class ClerkController extends WebBaseController{
public
HaobanResponse
freshWxFrend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
staffDepartmentRelatedId
,
String
wxUserId
public
HaobanResponse
freshWxFrend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
,
String
staffDepartmentRelatedId
,
String
wxUserId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
flushType
)
{
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
flushType
)
{
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM"
);
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM
dd
"
);
if
(
staff
==
null
){
if
(
staff
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10006
);
}
}
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
0
:
(
Integer
)
RedisUtil
.
getCache
(
key
);
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
0
:
(
Integer
)
RedisUtil
.
getCache
(
key
);
if
(
count
!=
null
&&
count
>=
4
)
{
if
(
count
!=
null
&&
count
>=
0
)
{
logger
.
info
(
"次数超出限制:{}"
,
staffId
);
logger
.
info
(
"次数超出限制:{}"
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10011
);
}
}
...
@@ -544,7 +551,7 @@ public class ClerkController extends WebBaseController{
...
@@ -544,7 +551,7 @@ public class ClerkController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_10022
);
return
resultResponse
(
HaoBanErrCode
.
ERR_10022
);
}
}
}
}
RedisUtil
.
setCache
(
key
,
count
+
1
,
31
*
24
*
60
*
60L
);
RedisUtil
.
setCache
(
key
,
1
,
31
*
24
*
60
*
60L
);
//刷新状态变更
//刷新状态变更
clerkMainStoreRelatedApiService
.
setFreshFriend
(
wxEnterpriseId
,
staffId
);
clerkMainStoreRelatedApiService
.
setFreshFriend
(
wxEnterpriseId
,
staffId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
...
@@ -576,12 +583,12 @@ public class ClerkController extends WebBaseController{
...
@@ -576,12 +583,12 @@ public class ClerkController extends WebBaseController{
@HttpLimit
@HttpLimit
@RequestMapping
(
"/fresh-friend-count"
)
@RequestMapping
(
"/fresh-friend-count"
)
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
public
HaobanResponse
checkFreshFriend
(
String
staffId
,
String
storeId
,
String
wxEnterpriseId
)
{
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM"
);
String
yyyyMM
=
DateUtil
.
dateToStr
(
new
Date
(),
"yyyyMM
dd
"
);
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
String
key
=
"haoban_fresh_wx_friend"
+
yyyyMM
+
staffId
;
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
0
:
(
Integer
)
RedisUtil
.
getCache
(
key
);
//1代表能刷新 0 不能刷新
int
ret
=
count
==
null
?
4
:
4
-
count
;
Integer
count
=
RedisUtil
.
getCache
(
key
)
==
null
?
1
:
0
;
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
re
t
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
coun
t
);
}
}
//获取门店详情
//获取门店详情
public
boolean
isEnterpriseOver
(
String
eid
)
{
public
boolean
isEnterpriseOver
(
String
eid
)
{
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/errCode/HaoBanErrCode.java
View file @
d2575e0c
...
@@ -194,11 +194,11 @@ public enum HaoBanErrCode {
...
@@ -194,11 +194,11 @@ public enum HaoBanErrCode {
ERR_10005
(
10005
,
"成员已存在"
),
ERR_10005
(
10005
,
"成员已存在"
),
ERR_10006
(
10006
,
"成员不存在"
),
ERR_10006
(
10006
,
"成员不存在"
),
ERR_10007
(
10007
,
"本月已经设置过主导购"
),
ERR_10007
(
10007
,
"本月已经设置过主导购"
),
ERR_10031
(
10031
,
"
本月已经设置过主门店
"
),
ERR_10031
(
10031
,
"
您本周已设置过主门店,请下周再试
"
),
ERR_10009
(
10009
,
"门店不存在"
),
ERR_10009
(
10009
,
"门店不存在"
),
ERR_10010
(
10010
,
"gic新增失败"
),
ERR_10010
(
10010
,
"gic新增失败"
),
ERR_10011
(
10011
,
"每月最多可刷新4次
"
),
ERR_10011
(
10011
,
"您今天刷新机会已用完,请明天再试
"
),
ERR_10012
(
10012
,
"手机号格式不正确"
),
ERR_10012
(
10012
,
"手机号格式不正确"
),
ERR_10013
(
10013
,
"code已经存在"
),
ERR_10013
(
10013
,
"code已经存在"
),
ERR_10014
(
10014
,
"请输入手机号"
),
ERR_10014
(
10014
,
"请输入手机号"
),
...
...
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