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
375a592a
Commit
375a592a
authored
Aug 22, 2023
by
jinxin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature/八月迭代'
parents
c78f4949
a67953f7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
244 additions
and
9 deletions
+244
-9
StaffActiveAllocationDTO.java
...m/gic/haoban/manage/api/dto/StaffActiveAllocationDTO.java
+37
-0
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+2
-0
TabHaobanQywxFeeOrderAccountMapper.java
...ce/dao/mapper/fee/TabHaobanQywxFeeOrderAccountMapper.java
+5
-4
HaobanQywxFeeOrderAccountService.java
...service/service/fee/HaobanQywxFeeOrderAccountService.java
+6
-2
HaobanQywxFeeOrderService.java
...manage/service/service/fee/HaobanQywxFeeOrderService.java
+2
-0
HaobanQywxFeeOrderAccountServiceImpl.java
...ervice/fee/impl/HaobanQywxFeeOrderAccountServiceImpl.java
+12
-3
HaobanQywxFeeOrderServiceImpl.java
...rvice/service/fee/impl/HaobanQywxFeeOrderServiceImpl.java
+5
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+105
-0
TabHaobanQywxFeeOrderAccountMapper.xml
...sources/mapper/fee/TabHaobanQywxFeeOrderAccountMapper.xml
+14
-0
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+19
-0
StaffActiveAllocationVO.java
...com/gic/haoban/manage/web/vo/StaffActiveAllocationVO.java
+37
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/StaffActiveAllocationDTO.java
0 → 100644
View file @
375a592a
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
;
import
java.io.Serializable
;
/**
* @description:
* @Author: wenhua
* @Date: 2023/8/16 10:08
*/
public
class
StaffActiveAllocationDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 失败个数
*/
private
Integer
nums
;
/**
* 失败原因
*/
private
String
errMessage
;
public
Integer
getNums
()
{
return
nums
;
}
public
void
setNums
(
Integer
nums
)
{
this
.
nums
=
nums
;
}
public
String
getErrMessage
()
{
return
errMessage
;
}
public
void
setErrMessage
(
String
errMessage
)
{
this
.
errMessage
=
errMessage
;
}
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
375a592a
...
...
@@ -356,4 +356,6 @@ public interface StaffApiService {
*/
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
Boolean
>
syncQywxStaffList
(
String
params
)
;
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
StaffActiveAllocationDTO
>
staffActiveAllocation
(
String
wxEnterpriseId
,
String
staffIds
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/fee/TabHaobanQywxFeeOrderAccountMapper.java
View file @
375a592a
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
.
fee
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
import
com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -53,5 +50,9 @@ public interface TabHaobanQywxFeeOrderAccountMapper {
int
countOrderAccountStatus
(
@Param
(
"status"
)
Integer
status
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
HashMap
<
String
,
Integer
>>
countStatusByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanQywxFeeOrderAccount
>
selectByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
void
updateByActiveCode
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"activeCode"
)
String
activeCode
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/fee/HaobanQywxFeeOrderAccountService.java
View file @
375a592a
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
fee
;
import
java.util.List
;
import
com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount
;
import
java.util.List
;
/**
* 企业微信收费订单账号(激活码)(TabHaobanQywxFeeOrderAccount)表服务接口
*
...
...
@@ -31,4 +31,8 @@ public interface HaobanQywxFeeOrderAccountService {
*/
int
countOrderAccountStatus
(
Integer
status
,
String
wxEnterpriseId
);
List
<
TabHaobanQywxFeeOrderAccount
>
selectByWxEnterpriseId
(
String
wxEnterpriseId
);
void
updateByActiveCode
(
String
wxEnterpriseId
,
String
activeCode
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/fee/HaobanQywxFeeOrderService.java
View file @
375a592a
...
...
@@ -42,4 +42,6 @@ public interface HaobanQywxFeeOrderService {
*/
List
<
TabHaobanQywxFeeOrder
>
listOrder
(
String
wxEnterpriseId
)
;
TabHaobanQywxFeeOrder
selectByOrderId
(
String
wxEnterpriseId
,
String
orderId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/fee/impl/HaobanQywxFeeOrderAccountServiceImpl.java
View file @
375a592a
...
...
@@ -4,12 +4,11 @@ import com.gic.commons.util.UniqueIdUtils;
import
com.gic.haoban.manage.service.dao.mapper.fee.TabHaobanQywxFeeOrderAccountMapper
;
import
com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount
;
import
com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* 企业微信收费订单账号(激活码)(TabHaobanQywxFeeOrderAccount)表服务实现类
*
...
...
@@ -48,4 +47,14 @@ public class HaobanQywxFeeOrderAccountServiceImpl implements HaobanQywxFeeOrderA
return
tabHaobanQywxFeeOrderAccountMapper
.
countOrderAccountStatus
(
status
,
wxEnterpriseId
);
}
@Override
public
List
<
TabHaobanQywxFeeOrderAccount
>
selectByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
tabHaobanQywxFeeOrderAccountMapper
.
selectByWxEnterpriseId
(
wxEnterpriseId
);
}
@Override
public
void
updateByActiveCode
(
String
wxEnterpriseId
,
String
activeCode
)
{
tabHaobanQywxFeeOrderAccountMapper
.
updateByActiveCode
(
wxEnterpriseId
,
activeCode
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/fee/impl/HaobanQywxFeeOrderServiceImpl.java
View file @
375a592a
...
...
@@ -55,4 +55,9 @@ public class HaobanQywxFeeOrderServiceImpl implements HaobanQywxFeeOrderService
public
List
<
TabHaobanQywxFeeOrder
>
listOrder
(
String
wxEnterpriseId
)
{
return
this
.
tabHaobanQywxFeeOrderMapper
.
listOrder
(
wxEnterpriseId
);
}
@Override
public
TabHaobanQywxFeeOrder
selectByOrderId
(
String
wxEnterpriseId
,
String
orderId
)
{
return
this
.
tabHaobanQywxFeeOrderMapper
.
selectByOrderId
(
wxEnterpriseId
,
orderId
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
375a592a
...
...
@@ -37,10 +37,14 @@ import com.gic.haoban.manage.service.config.Config;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.entity.*
;
import
com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrder
;
import
com.gic.haoban.manage.service.entity.fee.TabHaobanQywxFeeOrderAccount
;
import
com.gic.haoban.manage.service.errorcode.QywxErrCode
;
import
com.gic.haoban.manage.service.pojo.bo.StaffListBO
;
import
com.gic.haoban.manage.service.service.*
;
import
com.gic.haoban.manage.service.service.chat.GroupChatService
;
import
com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService
;
import
com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.thirdparty.cloudfile.CloudFileUtil
;
...
...
@@ -50,6 +54,8 @@ import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import
com.gic.wechat.api.dto.qywx.QywxNewUseridDTO
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
import
com.gic.wechat.api.dto.qywx.fee.AccountTransferUserDTO
;
import
com.gic.wechat.api.dto.qywx.fee.FeeOrderDeatilResponseDTO
;
import
com.gic.wechat.api.dto.qywx.response.QywxResponseDTO
;
import
com.gic.wechat.api.service.qywx.QywxOrderApiService
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -121,6 +127,10 @@ public class StaffApiServiceImpl implements StaffApiService {
private
ExternalClerkRelatedService
externalClerkRelatedService
;
@Autowired
private
WxEnterpriseActiveDataService
wxEnterpriseActiveDataService
;
@Autowired
private
HaobanQywxFeeOrderAccountService
haobanQywxFeeOrderAccountService
;
@Autowired
private
HaobanQywxFeeOrderService
haobanQywxFeeOrderService
;
@Override
public
StaffDTO
selectById
(
String
staffId
)
{
...
...
@@ -1183,6 +1193,7 @@ public class StaffApiServiceImpl implements StaffApiService {
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"成员userid不存在!"
);
}
String
staffId
=
staff
.
getStaffId
();
StaffActiveDataDTO
activeDataDTO
=
wxEnterpriseActiveDataService
.
getWxEnterpriseActiveDataByWxEnterpriseId
(
wxEnterprise
.
getWxEnterpriseId
());
if
(
null
==
activeDataDTO
){
logger
.
info
(
"查询不到企业微信id->{}的许可账号统计信息!"
,
wxEnterprise
.
getWxEnterpriseId
());
...
...
@@ -1215,6 +1226,9 @@ public class StaffApiServiceImpl implements StaffApiService {
}
staffMapper
.
updateActiveStatusById
(
staffId
,
timeStampDate
,
expireTimeDate
,
activeCode
);
groupChatService
.
initStaffGroupChat
(
staffId
);
//更新好办激活码许可表
haobanQywxFeeOrderAccountService
.
updateByActiveCode
(
wxEnterprise
.
getWxEnterpriseId
(),
activeCode
);
}
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
success
(
true
);
}
...
...
@@ -1283,4 +1297,95 @@ public class StaffApiServiceImpl implements StaffApiService {
}
return
null
;
}
@Override
public
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
StaffActiveAllocationDTO
>
staffActiveAllocation
(
String
wxEnterpriseId
,
String
staffIds
)
{
StaffActiveAllocationDTO
result
=
new
StaffActiveAllocationDTO
();
if
(
StrUtil
.
isBlank
(
staffIds
)){
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"参数不能为空"
);
}
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
if
(
wxEnterpriseDTO
==
null
)
{
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"企业微信不存在!!"
);
}
String
openCorpid
=
wxEnterpriseDTO
.
getOpenCorpid
();
String
serviceCorpid
=
config
.
getCorpid
();
List
<
String
>
staffIdList
=
Arrays
.
asList
(
staffIds
.
split
(
","
));
List
<
TabHaobanStaff
>
haobanStaffs
=
staffMapper
.
listByIds
(
staffIdList
);
List
<
TabHaobanQywxFeeOrderAccount
>
accounts
=
haobanQywxFeeOrderAccountService
.
selectByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollUtil
.
isEmpty
(
accounts
)
||
accounts
.
size
()
<
haobanStaffs
.
size
()){
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"剩余可用许可数量小于激活成员数量"
);
}
if
(
CollUtil
.
isNotEmpty
(
haobanStaffs
)){
int
num
=
0
;
String
errMessage
=
null
;
for
(
int
i
=
0
;
i
<
haobanStaffs
.
size
();
i
++){
String
activeCode
=
accounts
.
get
(
i
).
getActiveCode
();
String
orderId
=
accounts
.
get
(
i
).
getOrderId
();
String
staffId
=
haobanStaffs
.
get
(
i
).
getStaffId
();
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"active_code"
,
accounts
.
get
(
i
).
getActiveCode
());
object
.
put
(
"corpid"
,
openCorpid
);
String
wxUserId
=
haobanStaffs
.
get
(
i
).
getWxUserId
();
if
(
StrUtil
.
isBlank
(
wxUserId
)){
wxUserId
=
haobanStaffs
.
get
(
i
).
getWxOpenUseId
();
}
object
.
put
(
"userid"
,
wxUserId
);
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
<
QywxResponseDTO
>
response
=
qywxOrderApiService
.
activeAccount
(
serviceCorpid
,
JSON
.
toJSONString
(
object
));
if
(!
response
.
isSuccess
()){
num
++;
errMessage
=
"许可账号分配失败,复制链接查看失败原因:https://developer.work.weixin.qq.com/devtool/query?e="
+
response
.
getCode
();
}
else
{
//手动分配成功需要实时更新许可激活码状态
StaffActiveDataDTO
activeDataDTO
=
wxEnterpriseActiveDataService
.
getWxEnterpriseActiveDataByWxEnterpriseId
(
wxEnterpriseId
);
if
(
null
==
activeDataDTO
){
logger
.
info
(
"查询不到企业微信id->{}的许可账号统计信息!"
,
wxEnterpriseId
);
}
else
{
//需要区分激活码,待转移状态的激活码不需要处理
TabHaobanStaff
haobanStaff
=
staffMapper
.
getNumByActiveCode
(
wxEnterpriseId
,
activeCode
);
if
(
null
==
haobanStaff
){
//已使用的加1,已激活的加1,未激活的减1
Integer
used
=
activeDataDTO
.
getUsed
();
Integer
inactive
=
activeDataDTO
.
getInactive
();
Integer
activated
=
activeDataDTO
.
getActivated
();
used
++;
activated
++;
if
(
null
!=
inactive
&&
inactive
>
0
){
inactive
--;
}
activeDataDTO
.
setUsed
(
used
);
activeDataDTO
.
setInactive
(
inactive
);
activeDataDTO
.
setActivated
(
activated
);
wxEnterpriseActiveDataService
.
updateByStaffActiveDataDTO
(
activeDataDTO
);
}
else
{
//判断是否是其它占用的许可被当天激活
Date
delTime
=
haobanStaff
.
getDelTime
();
Date
now
=
new
Date
();
int
days
=
DateUtil
.
daysBetween
(
delTime
,
now
);
if
(
days
==
0
){
staffMapper
.
updateOccupyFlagByStaffId
(
haobanStaff
.
getStaffId
());
}
}
}
//根据订单id,查询订单详情,获取购买的时长,当前激活时间加上时长为过期时间
TabHaobanQywxFeeOrder
tabHaobanQywxFeeOrder
=
haobanQywxFeeOrderService
.
selectByOrderId
(
wxEnterpriseId
,
orderId
);
Integer
months
=
tabHaobanQywxFeeOrder
.
getMonths
();
Date
expireTime
=
null
;
if
(
null
!=
months
){
//转换成天数
months
=
months
*
31
;
expireTime
=
DateUtil
.
addDay
(
new
Date
(),
months
);
}
staffMapper
.
updateActiveStatusById
(
staffId
,
new
Date
(),
expireTime
,
activeCode
);
//更新好办激活码许可表
haobanQywxFeeOrderAccountService
.
updateByActiveCode
(
wxEnterpriseId
,
activeCode
);
}
}
result
.
setNums
(
num
);
result
.
setErrMessage
(
errMessage
);
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
success
(
result
);
}
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"-9999"
,
"成员不存在"
);
}
}
haoban-manage3-service/src/main/resources/mapper/fee/TabHaobanQywxFeeOrderAccountMapper.xml
View file @
375a592a
...
...
@@ -87,5 +87,19 @@
where wx_enterprise_id = #{wxEnterpriseId} GROUP BY STATUS
</select>
<select
id=
"selectByWxEnterpriseId"
resultMap=
"TabHaobanQywxFeeOrderAccountMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_qywx_fee_order_account
where wx_enterprise_id = #{wxEnterpriseId}
and status in (1,4)
</select>
<update
id=
"updateByActiveCode"
>
update tab_haoban_qywx_fee_order_account
set status = 2,update_time = NOW()
where wx_enterprise_id = #{wxEnterpriseId} and active_code = #{activeCode}
</update>
</mapper>
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
375a592a
...
...
@@ -10,6 +10,7 @@ import cn.hutool.core.collection.CollUtil;
import
com.alibaba.fastjson.JSONArray
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO
;
import
com.gic.haoban.manage.api.dto.qdto.licence.LicenceOrderPageQDTO
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.log.LogRecordUserServiceImpl
;
import
com.gic.haoban.manage.web.qo.StaffListQO
;
...
...
@@ -695,4 +696,22 @@ public class StaffController extends WebBaseController {
return
RestResponse
.
successResult
(
vo
);
}
/**
* 批量分配成员许可码
* @param staffIds
* @return
*/
@RequestMapping
(
"staff-active-allocation"
)
public
RestResponse
<
StaffActiveAllocationVO
>
staffActiveAllocation
(
String
staffIds
)
{
WebLoginDTO
login
=
AuthWebRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
ServiceResponse
<
StaffActiveAllocationDTO
>
response
=
staffApiService
.
staffActiveAllocation
(
wxEnterpriseId
,
staffIds
);
if
(
response
.
isSuccess
()){
StaffActiveAllocationDTO
dto
=
response
.
getResult
();
StaffActiveAllocationVO
result
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
dto
),
StaffActiveAllocationVO
.
class
);
return
RestResponse
.
successResult
(
result
);
}
return
RestResponse
.
failure
(
response
.
getCode
(),
response
.
getMessage
());
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/StaffActiveAllocationVO.java
0 → 100644
View file @
375a592a
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
;
import
java.io.Serializable
;
/**
* @description:
* @Author: wenhua
* @Date: 2023/8/16 10:08
*/
public
class
StaffActiveAllocationVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 失败个数
*/
private
Integer
nums
;
/**
* 失败原因
*/
private
String
errMessage
;
public
Integer
getNums
()
{
return
nums
;
}
public
void
setNums
(
Integer
nums
)
{
this
.
nums
=
nums
;
}
public
String
getErrMessage
()
{
return
errMessage
;
}
public
void
setErrMessage
(
String
errMessage
)
{
this
.
errMessage
=
errMessage
;
}
}
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