Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 3531ad47
authored
Oct 16, 2020
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
统一处理微信端接口错误
1 parent
4c8984ad
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
169 additions
and
155 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCorpAccountController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
linkwe-common/src/main/java/com/linkwechat/common/enums/WeExceptionTip.java
linkwe-common/src/main/java/com/linkwechat/common/exception/wecom/WeComException.java
linkwe-framework/src/main/java/com/linkwechat/framework/web/exception/GlobalExceptionHandler.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCorpAccount.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeExternalContactDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeAccessTokenInterceptor.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCorpAccountMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCorpAccountService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCorpAccountServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeEmpleCodeServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCorpAccountMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCorpAccountController.java
View file @
3531ad4
...
...
@@ -7,11 +7,11 @@ import com.linkwechat.common.core.page.TableDataInfo;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.domain.WeCorpAccount
;
import
com.linkwechat.wecom.service.IWeCorpAccountService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
...
...
@@ -20,7 +20,6 @@ import java.util.List;
* @author ruoyi
* @date 2020-08-24
*/
@Api
(
"企业id配置"
)
@RestController
@RequestMapping
(
"/wecom/corp"
)
public
class
WeCorpAccountController
extends
BaseController
...
...
@@ -33,7 +32,6 @@ public class WeCorpAccountController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:corp:list')"
)
@GetMapping
(
"/list"
)
@ApiOperation
(
"获取企业id列表"
)
public
TableDataInfo
list
(
WeCorpAccount
weCorpAccount
)
{
startPage
();
...
...
@@ -47,7 +45,6 @@ public class WeCorpAccountController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:corp:query')"
)
@GetMapping
(
value
=
"/{id}"
)
@ApiOperation
(
"获取企业id相关详情"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
weCorpAccountService
.
selectWeCorpAccountById
(
id
));
...
...
@@ -57,10 +54,9 @@ public class WeCorpAccountController extends BaseController
* 新增企业id相关配置
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:corp:add')"
)
@Log
(
title
=
"企业id相关配置"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"
新增
企业id相关配置"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@ApiOperation
(
"新增企业id"
)
public
AjaxResult
add
(
@RequestBody
WeCorpAccount
weCorpAccount
)
public
AjaxResult
add
(
@Validated
@RequestBody
WeCorpAccount
weCorpAccount
)
{
return
toAjax
(
weCorpAccountService
.
insertWeCorpAccount
(
weCorpAccount
));
}
...
...
@@ -69,24 +65,23 @@ public class WeCorpAccountController extends BaseController
* 修改企业id相关配置
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:corp:edit')"
)
@Log
(
title
=
"企业id相关配置"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"
修改
企业id相关配置"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@ApiOperation
(
"修改企业id"
)
public
AjaxResult
edit
(
@RequestBody
WeCorpAccount
weCorpAccount
)
public
AjaxResult
edit
(
@Validated
@RequestBody
WeCorpAccount
weCorpAccount
)
{
return
toAjax
(
weCorpAccountService
.
updateWeCorpAccount
(
weCorpAccount
));
}
//
/**
// * 删除企业id相关配置
//
*/
// @PreAuthorize("@ss.hasPermi('wechat:corp:remove
')")
// @Log(title = "企业id相关配置
", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids
}")
// @ApiOperation("根据id删除企业id"
)
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(weCorpAccountService.deleteWeCorpAccountByIds(ids));
// }
/**
* 启用有效企业微信账号
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:corp:startVailWeCorpAccount
')"
)
@Log
(
title
=
"启用有效企业微信账号
"
,
businessType
=
BusinessType
.
DELETE
)
@PutMapping
(
"/startVailWeCorpAccount/{corpId
}"
)
public
AjaxResult
startWeCorpAccount
(
@PathVariable
Long
corpId
)
{
return
toAjax
(
weCorpAccountService
.
startVailWeCorpAccount
(
corpId
));
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
View file @
3531ad4
...
...
@@ -89,7 +89,7 @@ public class WeMaterialController extends BaseController {
*/
@PreAuthorize
(
"@ss.hasPermi('wechat:material:upload')"
)
@Log
(
title
=
"上传素材信息"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
@PostMapping
(
"/upload"
)
@ApiOperation
(
"上传素材信息"
)
public
AjaxResult
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"type"
)
String
type
)
{
WeMaterialFileVO
weMaterialFileVO
=
materialService
.
uploadWeMaterialFile
(
file
,
type
);
...
...
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
View file @
3531ad4
...
...
@@ -130,4 +130,12 @@ public class Constants
/** 是否为系统默认(是) */
public
static
final
int
SERVICE_STATUS_ERROR
=
-
1
;
/** 启用状态 */
public
static
final
String
NORMAL_CODE
=
new
String
(
"0"
);
/** 删除状态 */
public
static
final
String
DELETE_CODE
=
new
String
(
"2"
);
}
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
View file @
3531ad4
...
...
@@ -95,4 +95,10 @@ public class WeConstans {
*/
public
static
final
Integer
QR_CODE_EMPLE_CODE_SCENE
=
2
;
/**
* 微信接口相应端错误字段
*/
public
static
final
String
WE_ERROR_FIELD
=
"errcode"
;
}
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
View file @
3531ad4
...
...
@@ -33,7 +33,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
private
Date
updateTime
=
new
Date
()
;
/** 备注 */
private
String
remark
;
...
...
linkwe-common/src/main/java/com/linkwechat/common/enums/WeExceptionTip.java
View file @
3531ad4
...
...
@@ -569,57 +569,52 @@ public enum WeExceptionTip {
WE_EXCEPTION_TIP_640029
(
640029
,
"只支持下载普通文件,不支持下载文件夹等其他非文件实体类型"
,
"检查fileid对应的文件是否为普通文件"
),
;
// CUSTOMER_SOURCE_WZLY(0,""),
// CUSTOMER_SOURCE_SMEWM(1,),
// CUSTOMER_SOURCE_SSSJH(2,),
// CUSTOMER_SOURCE_MPFX(3,),
// CUSTOMER_SOURCE_QL(4,),
// CUSTOMER_SOURCE_SJTXL(5,),
// CUSTOMER_SOURCE_WXLXR(6,),
// CUSTOMER_SOURCE_TJHYSQ(7,),
// CUSTOMER_SOURCE_DSFRJTJ(8,),
// CUSTOMER_SOURCE_YXSS(9,),
// CUSTOMER_SOURCE_NBCYGX(201,),
// CUSTOMER_SOURCE_GLRYFP(202,)
// ;
//
private
Integer
code
;
private
String
tipMsg
;
private
String
solveTipMsg
;
private
WeExceptionTip
(
Integer
code
,
String
tipMsg
,
String
solveTipMsg
)
{
WeExceptionTip
(
Integer
code
,
String
tipMsg
,
String
solveTipMsg
)
{
this
.
code
=
code
;
this
.
tipMsg
=
tipMsg
;
this
.
solveTipMsg
=
solveTipMsg
;
}
//
// public Integer getCode() {
// return code;
// }
//
// public OrderType setCode(Integer code) {
// this.code = code;
// return this;
// }
//
// public String getLabel() {
// return label;
// }
//
// public OrderType setLabel(String label) {
// this.label = label;
// return this;
// }
//
// public OrderType getOrderTypeByCode(Integer code){
// OrderType[] orderTypes = OrderType.values();
// for(OrderType orderType:orderTypes){
// if(orderType.getCode().equals(code)){
// return orderType;
// }
// }
// throw new RuntimeException("未知的订单类型");
// }
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getTipMsg
()
{
return
tipMsg
;
}
public
void
setTipMsg
(
String
tipMsg
)
{
this
.
tipMsg
=
tipMsg
;
}
public
String
getSolveTipMsg
()
{
return
solveTipMsg
;
}
public
void
setSolveTipMsg
(
String
solveTipMsg
)
{
this
.
solveTipMsg
=
solveTipMsg
;
}
public
static
String
getTipMsg
(
Integer
code
){
WeExceptionTip
[]
values
=
WeExceptionTip
.
values
();
for
(
WeExceptionTip
weExceptionTip:
values
){
if
(
weExceptionTip
.
getCode
().
equals
(
code
)){
return
weExceptionTip
.
getTipMsg
();
}
}
throw
new
RuntimeException
(
"企业微信端位置错误类型,请联系管理员工"
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/exception/wecom/WeComException.java
View file @
3531ad4
...
...
@@ -12,7 +12,7 @@ public class WeComException extends RuntimeException {
protected
String
message
;
private
Integer
code
;
public
WeComException
(
String
message
)
{
this
.
message
=
message
;
...
...
linkwe-framework/src/main/java/com/linkwechat/framework/web/exception/GlobalExceptionHandler.java
View file @
3531ad4
package
com
.
linkwechat
.
framework
.
web
.
exception
;
import
cn.hutool.json.JSONUtil
;
import
com.dtflys.forest.exceptions.ForestRuntimeException
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.enums.WeExceptionTip
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.security.access.AccessDeniedException
;
...
...
@@ -114,4 +119,27 @@ public class GlobalExceptionHandler
{
return
AjaxResult
.
error
(
"演示模式,不允许操作"
);
}
/**
* 企业微信异常统一处理
*/
@ExceptionHandler
(
ForestRuntimeException
.
class
)
public
AjaxResult
weComException
(
ForestRuntimeException
forestExcetion
)
{
String
errorMsg
=
forestExcetion
.
getMessage
();
if
(
StringUtils
.
isNotEmpty
(
errorMsg
)){
Integer
errCode
=
JSONUtil
.
parseObj
(
errorMsg
).
getInt
(
WeConstans
.
WE_ERROR_FIELD
);
return
AjaxResult
.
error
(
errCode
,
WeExceptionTip
.
getTipMsg
(
errCode
));
}
return
AjaxResult
.
error
(
"企业微信端未知异常,请联系管理员"
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCorpAccount.java
View file @
3531ad4
...
...
@@ -10,6 +10,8 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.validation.constraints.NotBlank
;
/**
* 企业id相关配置对象 wx_corp_account
*
...
...
@@ -30,14 +32,17 @@ public class WeCorpAccount extends BaseEntity
/** 企业名称 */
@ApiModelProperty
(
"企业名称"
)
@NotBlank
(
message
=
"企业名称不能为空"
)
private
String
companyName
;
/** 企业ID */
@ApiModelProperty
(
"企业ID"
)
@NotBlank
(
message
=
"企业ID不能为空"
)
private
String
corpId
;
/** 应用的密钥凭证 */
@ApiModelProperty
(
"应用的密钥凭证"
)
@NotBlank
(
message
=
"应用的密钥凭证不能为空"
)
private
String
corpSecret
;
/** 帐号状态(0正常 1停用) */
...
...
@@ -46,10 +51,11 @@ public class WeCorpAccount extends BaseEntity
/** 删除标志(0代表存在 2代表删除) */
@ApiModelProperty
(
"删除标志(0代表存在 2代表删除)"
)
private
String
delFlag
;
private
String
delFlag
=
new
String
(
"2"
)
;
@ApiModelProperty
(
"外部联系人密钥"
)
@NotBlank
(
message
=
"外部联系人密钥凭证不能为空"
)
private
String
contactSecret
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeExternalContactDto.java
View file @
3531ad4
...
...
@@ -41,7 +41,7 @@ public class WeExternalContactDto extends WeResultDto {
//企业自定义的state参数,用于区分不同的添加渠道,在调用“获取外部联系人详情”时会返回该参数值,不超过30个字符
// private String state
;
private
String
state
=
"teststate"
;
public
WeContactWay
()
{
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/interceptor/WeAccessTokenInterceptor.java
View file @
3531ad4
package
com
.
linkwechat
.
wecom
.
interceptor
;
import
cn.hutool.json.JSONUtil
;
import
com.dtflys.forest.exceptions.ForestRuntimeException
;
import
com.dtflys.forest.http.ForestHeader
;
import
com.dtflys.forest.http.ForestRequest
;
...
...
@@ -8,6 +9,9 @@ import com.dtflys.forest.interceptor.Interceptor;
import
com.dtflys.forest.utils.ForestDataType
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.config.WeComeConfig
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.framework.web.domain.server.Sys
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.service.IWeAccessTokenService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -74,11 +78,13 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Override
public
void
onError
(
ForestRuntimeException
e
,
ForestRequest
forestRequest
,
ForestResponse
forestResponse
)
{
System
.
out
.
println
(
"nihao"
);
}
/**
* 请求成功调用
* 请求成功调用
(微信端错误异常统一处理)
* @param o
* @param forestRequest
* @param forestResponse
...
...
@@ -86,5 +92,15 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Override
public
void
onSuccess
(
Object
o
,
ForestRequest
forestRequest
,
ForestResponse
forestResponse
)
{
WeResultDto
weResultDto
=
JSONUtil
.
toBean
(
forestResponse
.
getContent
(),
WeResultDto
.
class
);
if
(
null
!=
weResultDto
.
getErrcode
()
&&
weResultDto
.
getErrcode
()
!=
0
){
throw
new
ForestRuntimeException
(
forestResponse
.
getContent
());
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCorpAccountMapper.java
View file @
3531ad4
...
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.mapper;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeCorpAccount
;
import
org.apache.ibatis.annotations.Param
;
/**
* 企业id相关配置Mapper接口
...
...
@@ -43,26 +44,19 @@ public interface WeCorpAccountMapper
*/
public
int
updateWeCorpAccount
(
WeCorpAccount
wxCorpAccount
);
/**
* 删除企业id相关配置
*
* @param id 企业id相关配置ID
* @return 结果
*/
public
int
deleteWeCorpAccountById
(
Long
id
);
/**
* 批量删除企业id相关配置
*
* @param ids 需要删除的数据ID
* @return 结果
* 获取有效cropid
* @return
*/
public
int
deleteWeCorpAccountByIds
(
Long
[]
ids
);
public
WeCorpAccount
findValidWeCorpAccount
(
);
/**
* 获取有效cropid
* 启用有效的企业微信账号
* @param corpId
* @return
*/
public
WeCorpAccount
findValidWeCorpAccount
(
);
public
int
startVailWeCorpAccount
(
@Param
(
"corpId"
)
Long
corpId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCorpAccountService.java
View file @
3531ad4
...
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeCorpAccount
;
import
org.apache.ibatis.annotations.Param
;
/**
* 企业id相关配置Service接口
...
...
@@ -43,21 +44,6 @@ public interface IWeCorpAccountService
*/
public
int
updateWeCorpAccount
(
WeCorpAccount
wxCorpAccount
);
/**
* 批量删除企业id相关配置
*
* @param ids 需要删除的企业id相关配置ID
* @return 结果
*/
public
int
deleteWeCorpAccountByIds
(
Long
[]
ids
);
/**
* 删除企业id相关配置信息
*
* @param id 企业id相关配置ID
* @return 结果
*/
public
int
deleteWeCorpAccountById
(
Long
id
);
/**
...
...
@@ -67,4 +53,11 @@ public interface IWeCorpAccountService
*/
public
WeCorpAccount
findValidWeCorpAccount
();
/**
* 启用有效的企业微信账号
* @param corpId
*/
public
int
startVailWeCorpAccount
(
Long
corpId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCorpAccountServiceImpl.java
View file @
3531ad4
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
java.util.List
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.wecom.service.IWeCorpAccountService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.linkwechat.wecom.mapper.WeCorpAccountMapper
;
import
com.linkwechat.wecom.domain.WeCorpAccount
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 企业id相关配置Service业务层处理
...
...
@@ -53,7 +56,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override
public
int
insertWeCorpAccount
(
WeCorpAccount
wxCorpAccount
)
{
wxCorpAccount
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
weCorpAccountMapper
.
insertWeCorpAccount
(
wxCorpAccount
);
}
...
...
@@ -66,45 +69,33 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override
public
int
updateWeCorpAccount
(
WeCorpAccount
wxCorpAccount
)
{
wxCorpAccount
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
weCorpAccountMapper
.
updateWeCorpAccount
(
wxCorpAccount
);
}
/**
* 批量删除企业id相关配置
*
* @param ids 需要删除的企业id相关配置ID
* @return 结果
*/
@Override
public
int
deleteWeCorpAccountByIds
(
Long
[]
ids
)
{
return
weCorpAccountMapper
.
deleteWeCorpAccountByIds
(
ids
);
}
/**
* 删除企业id相关配置信息
*
* @param id 企业id相关配置ID
* 获取有效的企业id
*
* @return 结果
*/
@Override
public
int
deleteWeCorpAccountById
(
Long
id
)
{
return
weCorpAccountMapper
.
deleteWeCorpAccountById
(
id
);
public
WeCorpAccount
findValidWeCorpAccount
()
{
return
weCorpAccountMapper
.
findValidWeCorpAccount
();
}
/**
* 获取有效的企业id
*
* @return 结果
* 启用有效的企业微信账号
* @param corpId
*/
@Override
public
WeCorpAccount
findValidWeCorpAccount
(
)
{
return
weCorpAccountMapper
.
findValidWeCorpAccount
(
);
public
int
startVailWeCorpAccount
(
Long
corpId
)
{
return
weCorpAccountMapper
.
startVailWeCorpAccount
(
corpId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeEmpleCodeServiceImpl.java
View file @
3531ad4
...
...
@@ -113,7 +113,7 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
//
WeExternalContactDto
.
WeContactWay
weContactWay
=
new
WeExternalContactDto
.
WeContactWay
(
weEmpleCode
.
getCodeType
(),
WeConstans
.
QR_COD
E_EMPLE_CODE_SCENE
,
weEmpleCode
.
getIsJoinConfirmFriends
());
WeConstans
.
SMALL_ROUTIN
E_EMPLE_CODE_SCENE
,
weEmpleCode
.
getIsJoinConfirmFriends
());
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
View file @
3531ad4
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.domain.WeGroup
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserVo
;
import
com.linkwechat.wecom.mapper.WeUserMapper
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeFlowerCustomerRelService
;
import
com.linkwechat.wecom.service.IWeGroupService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -23,7 +17,6 @@ import org.springframework.transaction.annotation.Propagation;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* 通讯录相关客户Service业务层处理
...
...
@@ -88,14 +81,9 @@ public class WeUserServiceImpl implements IWeUserService
int
returnCode
=
weUserMapper
.
insertWeUser
(
weUser
);
if
(
returnCode
>
0
){
WeResultDto
weResultDto
=
weUserClient
.
createUser
(
weUserClient
.
createUser
(
weUser
.
transformWeUserDto
()
);
if
(!
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
weResultDto
.
getErrcode
())){
throw
new
WeComException
(
weResultDto
.
getErrcode
(),
weResultDto
.
getErrmsg
());
}
}
return
returnCode
;
...
...
@@ -114,13 +102,9 @@ public class WeUserServiceImpl implements IWeUserService
int
returnCode
=
weUserMapper
.
updateWeUser
(
weUser
);
if
(
returnCode
>
0
){
WeResultDto
weResultDto
=
weUserClient
.
updateUser
(
weUserClient
.
updateUser
(
weUser
.
transformWeUserDto
()
);
if
(!
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
weResultDto
.
getErrcode
())){
throw
new
WeComException
(
weResultDto
.
getErrcode
(),
weResultDto
.
getErrmsg
());
}
}
return
returnCode
;
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCorpAccountMapper.xml
View file @
3531ad4
...
...
@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"contact
_s
ecret != null "
>
contact_secret,
</if>
<if
test=
"contact
S
ecret != null "
>
contact_secret,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"companyName != null"
>
#{companyName},
</if>
...
...
@@ -82,16 +82,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete
id=
"deleteWeCorpAccountById"
parameterType=
"Long"
>
delete from we_corp_account where id = #{id}
</delete>
<delete
id=
"deleteWeCorpAccountByIds"
parameterType=
"String"
>
delete from we_corp_account where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"findValidWeCorpAccount"
resultMap=
"WeCorpAccountResult"
>
...
...
@@ -102,6 +92,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<update
id=
"startVailWeCorpAccount"
>
UPDATE we_corp_account
SET `status` = (CASE WHEN id = #{corpId} THEN 0 ELSE 1 END)
</update>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment