Commit 3531ad47 by 水库浪子

统一处理微信端接口错误

1 parent 4c8984ad
...@@ -7,11 +7,11 @@ import com.linkwechat.common.core.page.TableDataInfo; ...@@ -7,11 +7,11 @@ import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.wecom.domain.WeCorpAccount;
import com.linkwechat.wecom.service.IWeCorpAccountService; 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.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
/** /**
...@@ -20,7 +20,6 @@ import java.util.List; ...@@ -20,7 +20,6 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2020-08-24 * @date 2020-08-24
*/ */
@Api("企业id配置")
@RestController @RestController
@RequestMapping("/wecom/corp") @RequestMapping("/wecom/corp")
public class WeCorpAccountController extends BaseController public class WeCorpAccountController extends BaseController
...@@ -33,7 +32,6 @@ public class WeCorpAccountController extends BaseController ...@@ -33,7 +32,6 @@ public class WeCorpAccountController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('wechat:corp:list')") @PreAuthorize("@ss.hasPermi('wechat:corp:list')")
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获取企业id列表")
public TableDataInfo list(WeCorpAccount weCorpAccount) public TableDataInfo list(WeCorpAccount weCorpAccount)
{ {
startPage(); startPage();
...@@ -47,7 +45,6 @@ public class WeCorpAccountController extends BaseController ...@@ -47,7 +45,6 @@ public class WeCorpAccountController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('wechat:corp:query')") @PreAuthorize("@ss.hasPermi('wechat:corp:query')")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
@ApiOperation("获取企业id相关详情")
public AjaxResult getInfo(@PathVariable("id") Long id) public AjaxResult getInfo(@PathVariable("id") Long id)
{ {
return AjaxResult.success(weCorpAccountService.selectWeCorpAccountById(id)); return AjaxResult.success(weCorpAccountService.selectWeCorpAccountById(id));
...@@ -57,10 +54,9 @@ public class WeCorpAccountController extends BaseController ...@@ -57,10 +54,9 @@ public class WeCorpAccountController extends BaseController
* 新增企业id相关配置 * 新增企业id相关配置
*/ */
@PreAuthorize("@ss.hasPermi('wechat:corp:add')") @PreAuthorize("@ss.hasPermi('wechat:corp:add')")
@Log(title = "企业id相关配置", businessType = BusinessType.INSERT) @Log(title = "新增企业id相关配置", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
@ApiOperation("新增企业id") public AjaxResult add(@Validated @RequestBody WeCorpAccount weCorpAccount)
public AjaxResult add(@RequestBody WeCorpAccount weCorpAccount)
{ {
return toAjax(weCorpAccountService.insertWeCorpAccount(weCorpAccount)); return toAjax(weCorpAccountService.insertWeCorpAccount(weCorpAccount));
} }
...@@ -69,24 +65,23 @@ public class WeCorpAccountController extends BaseController ...@@ -69,24 +65,23 @@ public class WeCorpAccountController extends BaseController
* 修改企业id相关配置 * 修改企业id相关配置
*/ */
@PreAuthorize("@ss.hasPermi('wechat:corp:edit')") @PreAuthorize("@ss.hasPermi('wechat:corp:edit')")
@Log(title = "企业id相关配置", businessType = BusinessType.UPDATE) @Log(title = "修改企业id相关配置", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
@ApiOperation("修改企业id") public AjaxResult edit(@Validated @RequestBody WeCorpAccount weCorpAccount)
public AjaxResult edit(@RequestBody WeCorpAccount weCorpAccount)
{ {
return toAjax(weCorpAccountService.updateWeCorpAccount(weCorpAccount)); return toAjax(weCorpAccountService.updateWeCorpAccount(weCorpAccount));
} }
// /** /**
// * 删除企业id相关配置 * 启用有效企业微信账号
// */ */
// @PreAuthorize("@ss.hasPermi('wechat:corp:remove')") @PreAuthorize("@ss.hasPermi('wechat:corp:startVailWeCorpAccount')")
// @Log(title = "企业id相关配置", businessType = BusinessType.DELETE) @Log(title = "启用有效企业微信账号", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}") @PutMapping("/startVailWeCorpAccount/{corpId}")
// @ApiOperation("根据id删除企业id") public AjaxResult startWeCorpAccount(@PathVariable Long corpId)
// public AjaxResult remove(@PathVariable Long[] ids) {
// { return toAjax(weCorpAccountService.startVailWeCorpAccount(corpId));
// return toAjax(weCorpAccountService.deleteWeCorpAccountByIds(ids)); }
// }
} }
...@@ -89,7 +89,7 @@ public class WeMaterialController extends BaseController { ...@@ -89,7 +89,7 @@ public class WeMaterialController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('wechat:material:upload')") @PreAuthorize("@ss.hasPermi('wechat:material:upload')")
@Log(title = "上传素材信息", businessType = BusinessType.OTHER) @Log(title = "上传素材信息", businessType = BusinessType.OTHER)
@PostMapping @PostMapping("/upload")
@ApiOperation("上传素材信息") @ApiOperation("上传素材信息")
public AjaxResult upload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "type") String type) { public AjaxResult upload(@RequestParam(value = "file") MultipartFile file, @RequestParam(value = "type") String type) {
WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, type); WeMaterialFileVO weMaterialFileVO = materialService.uploadWeMaterialFile(file, type);
......
...@@ -130,4 +130,12 @@ public class Constants ...@@ -130,4 +130,12 @@ public class Constants
/** 是否为系统默认(是) */ /** 是否为系统默认(是) */
public static final int SERVICE_STATUS_ERROR = -1; 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");
} }
...@@ -95,4 +95,10 @@ public class WeConstans { ...@@ -95,4 +95,10 @@ public class WeConstans {
*/ */
public static final Integer QR_CODE_EMPLE_CODE_SCENE=2; public static final Integer QR_CODE_EMPLE_CODE_SCENE=2;
/**
* 微信接口相应端错误字段
*/
public static final String WE_ERROR_FIELD="errcode";
} }
...@@ -33,7 +33,7 @@ public class BaseEntity implements Serializable ...@@ -33,7 +33,7 @@ public class BaseEntity implements Serializable
/** 更新时间 */ /** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime; private Date updateTime=new Date();
/** 备注 */ /** 备注 */
private String remark; private String remark;
......
...@@ -569,57 +569,52 @@ public enum WeExceptionTip { ...@@ -569,57 +569,52 @@ public enum WeExceptionTip {
WE_EXCEPTION_TIP_640029(640029, "只支持下载普通文件,不支持下载文件夹等其他非文件实体类型", "检查fileid对应的文件是否为普通文件"), 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 Integer code;
private String tipMsg; private String tipMsg;
private String solveTipMsg; private String solveTipMsg;
private WeExceptionTip(Integer code, String tipMsg, String solveTipMsg) { WeExceptionTip(Integer code, String tipMsg, String solveTipMsg) {
this.code = code; this.code = code;
this.tipMsg = tipMsg; this.tipMsg = tipMsg;
this.solveTipMsg = solveTipMsg; this.solveTipMsg = solveTipMsg;
} }
//
// public Integer getCode() { public Integer getCode() {
// return code; return code;
// } }
//
// public OrderType setCode(Integer code) { public void setCode(Integer code) {
// this.code = code; this.code = code;
// return this; }
// }
// public String getTipMsg() {
// public String getLabel() { return tipMsg;
// return label; }
// }
// public void setTipMsg(String tipMsg) {
// public OrderType setLabel(String label) { this.tipMsg = tipMsg;
// this.label = label; }
// return this;
// } public String getSolveTipMsg() {
// return solveTipMsg;
// public OrderType getOrderTypeByCode(Integer code){ }
// OrderType[] orderTypes = OrderType.values();
// for(OrderType orderType:orderTypes){ public void setSolveTipMsg(String solveTipMsg) {
// if(orderType.getCode().equals(code)){ this.solveTipMsg = solveTipMsg;
// return orderType; }
// }
// }
// throw new RuntimeException("未知的订单类型");
// } 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("企业微信端位置错误类型,请联系管理员工");
}
} }
package com.linkwechat.framework.web.exception; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AccessDeniedException;
...@@ -114,4 +119,27 @@ public class GlobalExceptionHandler ...@@ -114,4 +119,27 @@ public class GlobalExceptionHandler
{ {
return AjaxResult.error("演示模式,不允许操作"); 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("企业微信端未知异常,请联系管理员");
}
} }
...@@ -10,6 +10,8 @@ import lombok.Data; ...@@ -10,6 +10,8 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.validation.constraints.NotBlank;
/** /**
* 企业id相关配置对象 wx_corp_account * 企业id相关配置对象 wx_corp_account
* *
...@@ -30,14 +32,17 @@ public class WeCorpAccount extends BaseEntity ...@@ -30,14 +32,17 @@ public class WeCorpAccount extends BaseEntity
/** 企业名称 */ /** 企业名称 */
@ApiModelProperty("企业名称") @ApiModelProperty("企业名称")
@NotBlank(message = "企业名称不能为空")
private String companyName; private String companyName;
/** 企业ID */ /** 企业ID */
@ApiModelProperty("企业ID") @ApiModelProperty("企业ID")
@NotBlank(message = "企业ID不能为空")
private String corpId; private String corpId;
/** 应用的密钥凭证 */ /** 应用的密钥凭证 */
@ApiModelProperty("应用的密钥凭证") @ApiModelProperty("应用的密钥凭证")
@NotBlank(message = "应用的密钥凭证不能为空")
private String corpSecret; private String corpSecret;
/** 帐号状态(0正常 1停用) */ /** 帐号状态(0正常 1停用) */
...@@ -46,10 +51,11 @@ public class WeCorpAccount extends BaseEntity ...@@ -46,10 +51,11 @@ public class WeCorpAccount extends BaseEntity
/** 删除标志(0代表存在 2代表删除) */ /** 删除标志(0代表存在 2代表删除) */
@ApiModelProperty("删除标志(0代表存在 2代表删除)") @ApiModelProperty("删除标志(0代表存在 2代表删除)")
private String delFlag; private String delFlag=new String("2");
@ApiModelProperty("外部联系人密钥") @ApiModelProperty("外部联系人密钥")
@NotBlank(message = "外部联系人密钥凭证不能为空")
private String contactSecret; private String contactSecret;
......
...@@ -41,7 +41,7 @@ public class WeExternalContactDto extends WeResultDto { ...@@ -41,7 +41,7 @@ public class WeExternalContactDto extends WeResultDto {
//企业自定义的state参数,用于区分不同的添加渠道,在调用“获取外部联系人详情”时会返回该参数值,不超过30个字符 //企业自定义的state参数,用于区分不同的添加渠道,在调用“获取外部联系人详情”时会返回该参数值,不超过30个字符
// private String state; private String state="teststate";
public WeContactWay() { public WeContactWay() {
} }
......
package com.linkwechat.wecom.interceptor; package com.linkwechat.wecom.interceptor;
import cn.hutool.json.JSONUtil;
import com.dtflys.forest.exceptions.ForestRuntimeException; import com.dtflys.forest.exceptions.ForestRuntimeException;
import com.dtflys.forest.http.ForestHeader; import com.dtflys.forest.http.ForestHeader;
import com.dtflys.forest.http.ForestRequest; import com.dtflys.forest.http.ForestRequest;
...@@ -8,6 +9,9 @@ import com.dtflys.forest.interceptor.Interceptor; ...@@ -8,6 +9,9 @@ import com.dtflys.forest.interceptor.Interceptor;
import com.dtflys.forest.utils.ForestDataType; import com.dtflys.forest.utils.ForestDataType;
import com.linkwechat.common.annotation.Log; import com.linkwechat.common.annotation.Log;
import com.linkwechat.common.config.WeComeConfig; 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 com.linkwechat.wecom.service.IWeAccessTokenService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -74,11 +78,13 @@ public class WeAccessTokenInterceptor implements Interceptor{ ...@@ -74,11 +78,13 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Override @Override
public void onError(ForestRuntimeException e, ForestRequest forestRequest, ForestResponse forestResponse) { public void onError(ForestRuntimeException e, ForestRequest forestRequest, ForestResponse forestResponse) {
System.out.println("nihao");
} }
/** /**
* 请求成功调用 * 请求成功调用(微信端错误异常统一处理)
* @param o * @param o
* @param forestRequest * @param forestRequest
* @param forestResponse * @param forestResponse
...@@ -86,5 +92,15 @@ public class WeAccessTokenInterceptor implements Interceptor{ ...@@ -86,5 +92,15 @@ public class WeAccessTokenInterceptor implements Interceptor{
@Override @Override
public void onSuccess(Object o, ForestRequest forestRequest, ForestResponse forestResponse) { 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());
} }
}
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.mapper; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.mapper;
import java.util.List; import java.util.List;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.wecom.domain.WeCorpAccount;
import org.apache.ibatis.annotations.Param;
/** /**
* 企业id相关配置Mapper接口 * 企业id相关配置Mapper接口
...@@ -43,26 +44,19 @@ public interface WeCorpAccountMapper ...@@ -43,26 +44,19 @@ public interface WeCorpAccountMapper
*/ */
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount); public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 删除企业id相关配置
*
* @param id 企业id相关配置ID
* @return 结果
*/
public int deleteWeCorpAccountById(Long id);
/** /**
* 批量删除企业id相关配置 * 获取有效cropid
* * @return
* @param ids 需要删除的数据ID
* @return 结果
*/ */
public int deleteWeCorpAccountByIds(Long[] ids); public WeCorpAccount findValidWeCorpAccount();
/** /**
* 获取有效cropid * 启用有效的企业微信账号
* @param corpId
* @return * @return
*/ */
public WeCorpAccount findValidWeCorpAccount(); public int startVailWeCorpAccount(@Param("corpId") Long corpId);
} }
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import java.util.List; import java.util.List;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.wecom.domain.WeCorpAccount;
import org.apache.ibatis.annotations.Param;
/** /**
* 企业id相关配置Service接口 * 企业id相关配置Service接口
...@@ -43,28 +44,20 @@ public interface IWeCorpAccountService ...@@ -43,28 +44,20 @@ public interface IWeCorpAccountService
*/ */
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount); public int updateWeCorpAccount(WeCorpAccount wxCorpAccount);
/**
* 批量删除企业id相关配置
*
* @param ids 需要删除的企业id相关配置ID
* @return 结果
*/
public int deleteWeCorpAccountByIds(Long[] ids);
/** /**
* 删除企业id相关配置信息 * 获取有效的企业id
* *
* @param id 企业id相关配置ID
* @return 结果 * @return 结果
*/ */
public int deleteWeCorpAccountById(Long id); public WeCorpAccount findValidWeCorpAccount();
/** /**
* 获取有效的企业id * 启用有效的企业微信账号
* * @param corpId
* @return 结果
*/ */
public WeCorpAccount findValidWeCorpAccount(); public int startVailWeCorpAccount(Long corpId);
} }
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeCorpAccountMapper; import com.linkwechat.wecom.mapper.WeCorpAccountMapper;
import com.linkwechat.wecom.domain.WeCorpAccount; import com.linkwechat.wecom.domain.WeCorpAccount;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 企业id相关配置Service业务层处理 * 企业id相关配置Service业务层处理
...@@ -53,7 +56,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -53,7 +56,7 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override @Override
public int insertWeCorpAccount(WeCorpAccount wxCorpAccount) public int insertWeCorpAccount(WeCorpAccount wxCorpAccount)
{ {
wxCorpAccount.setCreateTime(DateUtils.getNowDate());
return weCorpAccountMapper.insertWeCorpAccount(wxCorpAccount); return weCorpAccountMapper.insertWeCorpAccount(wxCorpAccount);
} }
...@@ -66,45 +69,33 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService { ...@@ -66,45 +69,33 @@ public class WeCorpAccountServiceImpl implements IWeCorpAccountService {
@Override @Override
public int updateWeCorpAccount(WeCorpAccount wxCorpAccount) public int updateWeCorpAccount(WeCorpAccount wxCorpAccount)
{ {
wxCorpAccount.setUpdateTime(DateUtils.getNowDate());
return weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount); return weCorpAccountMapper.updateWeCorpAccount(wxCorpAccount);
} }
/**
* 批量删除企业id相关配置
*
* @param ids 需要删除的企业id相关配置ID
* @return 结果
*/
@Override
public int deleteWeCorpAccountByIds(Long[] ids)
{
return weCorpAccountMapper.deleteWeCorpAccountByIds(ids);
}
/** /**
* 删除企业id相关配置信息 * 获取有效的企业id
* *
* @param id 企业id相关配置ID
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteWeCorpAccountById(Long id) public WeCorpAccount findValidWeCorpAccount() {
{ return weCorpAccountMapper.findValidWeCorpAccount();
return weCorpAccountMapper.deleteWeCorpAccountById(id);
} }
/** /**
* 获取有效的企业id * 启用有效的企业微信账号
* * @param corpId
* @return 结果
*/ */
@Override @Override
public WeCorpAccount findValidWeCorpAccount() { public int startVailWeCorpAccount(Long corpId) {
return weCorpAccountMapper.findValidWeCorpAccount(); return weCorpAccountMapper.startVailWeCorpAccount(corpId);
} }
} }
...@@ -113,7 +113,7 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService ...@@ -113,7 +113,7 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
// //
WeExternalContactDto.WeContactWay weContactWay = new WeExternalContactDto.WeContactWay( weEmpleCode.getCodeType(), WeExternalContactDto.WeContactWay weContactWay = new WeExternalContactDto.WeContactWay( weEmpleCode.getCodeType(),
WeConstans.QR_CODE_EMPLE_CODE_SCENE,weEmpleCode.getIsJoinConfirmFriends()); WeConstans.SMALL_ROUTINE_EMPLE_CODE_SCENE,weEmpleCode.getIsJoinConfirmFriends());
......
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.wecom.client.WeUserClient; 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.WeUser;
import com.linkwechat.wecom.domain.dto.WeResultDto;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserVo;
import com.linkwechat.wecom.mapper.WeUserMapper; import com.linkwechat.wecom.mapper.WeUserMapper;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeFlowerCustomerRelService;
import com.linkwechat.wecom.service.IWeGroupService; import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -23,7 +17,6 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -23,7 +17,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 通讯录相关客户Service业务层处理 * 通讯录相关客户Service业务层处理
...@@ -88,14 +81,9 @@ public class WeUserServiceImpl implements IWeUserService ...@@ -88,14 +81,9 @@ public class WeUserServiceImpl implements IWeUserService
int returnCode = weUserMapper.insertWeUser(weUser); int returnCode = weUserMapper.insertWeUser(weUser);
if(returnCode>0){ if(returnCode>0){
weUserClient.createUser(
WeResultDto weResultDto = weUserClient.createUser(
weUser.transformWeUserDto() weUser.transformWeUserDto()
); );
if(!WeConstans.WE_SUCCESS_CODE.equals(weResultDto.getErrcode())){
throw new WeComException(weResultDto.getErrcode(),weResultDto.getErrmsg());
}
} }
return returnCode; return returnCode;
...@@ -114,13 +102,9 @@ public class WeUserServiceImpl implements IWeUserService ...@@ -114,13 +102,9 @@ public class WeUserServiceImpl implements IWeUserService
int returnCode = weUserMapper.updateWeUser(weUser); int returnCode = weUserMapper.updateWeUser(weUser);
if(returnCode >0){ if(returnCode >0){
WeResultDto weResultDto = weUserClient.updateUser( weUserClient.updateUser(
weUser.transformWeUserDto() weUser.transformWeUserDto()
); );
if(!WeConstans.WE_SUCCESS_CODE.equals(weResultDto.getErrcode())){
throw new WeComException(weResultDto.getErrcode(),weResultDto.getErrmsg());
}
} }
return returnCode; return returnCode;
......
...@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="contact_secret != null ">contact_secret,</if> <if test="contactSecret != null ">contact_secret,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if> <if test="companyName != null">#{companyName},</if>
...@@ -82,16 +82,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -82,16 +82,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </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"> <select id="findValidWeCorpAccount" resultMap="WeCorpAccountResult">
...@@ -102,6 +92,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -102,6 +92,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<update id="startVailWeCorpAccount">
UPDATE we_corp_account
SET `status` = (CASE WHEN id = #{corpId} THEN 0 ELSE 1 END)
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!