Commit b7c2396a by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents cff42d20 7d220d92
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 好友状态
* @author mozhu
* @date 2022/4/15 16:49
*/
public class FriendMemberStatusDTO implements Serializable {
private static final long serialVersionUID = 346623115969695352L;
/**
* 最近加好友时间
*/
private Date lastCreateTime;
/**
* 最近好友全部取消时间
*/
private Date lastCancelCreateTime;
/**
* 状态 0 无好友 1存在好友 2好友全部取消
*/
private Integer statusFlag;
public Date getLastCreateTime() {
return lastCreateTime;
}
public void setLastCreateTime(Date lastCreateTime) {
this.lastCreateTime = lastCreateTime;
}
public Date getLastCancelCreateTime() {
return lastCancelCreateTime;
}
public void setLastCancelCreateTime(Date lastCancelCreateTime) {
this.lastCancelCreateTime = lastCancelCreateTime;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* 企微报错日志(TabQywxErrorLog)实体类
*
* @author mozhu
* @since 2022-04-18 15:28:12
*/
public class QywxErrorLogDTO implements Serializable {
private static final long serialVersionUID = -2297821152064066567L;
private Long id;
private String scenario;
private String errorContent;
private String weworkErrorUrl;
private String traceId;
private Integer qywxErrorType;
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public String getErrorContent() {
return errorContent;
}
public void setErrorContent(String errorContent) {
this.errorContent = errorContent;
}
public String getWeworkErrorUrl() {
return weworkErrorUrl;
}
public void setWeworkErrorUrl(String weworkErrorUrl) {
this.weworkErrorUrl = weworkErrorUrl;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public Integer getQywxErrorType() {
return qywxErrorType;
}
public void setQywxErrorType(Integer qywxErrorType) {
this.qywxErrorType = qywxErrorType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -76,6 +76,11 @@ public class StaffPrivacyUseLogDTO implements Serializable {
*/
private Date updateTime;
private String wxUserId;
/**
* 第三方用户id
*/
private String wxOpenUseId;
public Long getId() {
return id;
}
......@@ -179,4 +184,20 @@ public class StaffPrivacyUseLogDTO implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
}
package com.gic.haoban.manage.api.dto.qdto;
import com.gic.haoban.base.api.common.BasePageInfo;
import java.io.Serializable;
/**
* @author mozhu
* @date 2022/4/18 16:49
*/
public class QywxErrorLogListQDTO extends BasePageInfo implements Serializable {
private static final long serialVersionUID = 6652319673885815810L;
/**
* 场景
*/
private String scenario;
/**
* 1:好办后台;2:好办小程序;3:会员小程序
*/
private Integer qywxErrorType;
private String startDate;
private String endDate;
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public Integer getQywxErrorType() {
return qywxErrorType;
}
public void setQywxErrorType(Integer qywxErrorType) {
this.qywxErrorType = qywxErrorType;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
@Override
public String toString() {
return "QywxErrorLogListQDTO{" +
"scenario='" + scenario + '\'' +
", qywxErrorType=" + qywxErrorType +
", startDate='" + startDate + '\'' +
", endDate='" + endDate + '\'' +
'}';
}
}
package com.gic.haoban.manage.api.dto.qdto;
import java.io.Serializable;
import java.util.Date;
/**
* @author mozhu
* @date 2022/4/18 16:04
*/
public class QywxErrorLogQDTO implements Serializable {
private static final long serialVersionUID = 3149075149054963526L;
private Long id;
private String scenario;
private String errorContent;
private String weworkErrorUrl;
private String traceId;
private Integer qywxErrorType;
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public String getErrorContent() {
return errorContent;
}
public void setErrorContent(String errorContent) {
this.errorContent = errorContent;
}
public String getWeworkErrorUrl() {
return weworkErrorUrl;
}
public void setWeworkErrorUrl(String weworkErrorUrl) {
this.weworkErrorUrl = weworkErrorUrl;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public Integer getQywxErrorType() {
return qywxErrorType;
}
public void setQywxErrorType(Integer qywxErrorType) {
this.qywxErrorType = qywxErrorType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -6,6 +6,7 @@ import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.ClerkStaffWxUserDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedShortInfoDTO;
import com.gic.haoban.manage.api.dto.FriendMemberStatusDTO;
import java.util.Date;
import java.util.List;
......@@ -259,4 +260,15 @@ public interface ExternalClerkRelatedApiService {
*/
ExternalClerkRelatedDTO getByWxEnterpriseIdAndUnionId(String wxEnterpriseId, String wxUserId, String unionid);
/**
* 得到好友状态
*
* @param memberId 成员身份
* @param enterpriseId 企业标识
* @return {@link FriendMemberStatusDTO }
* @author mozhu
* @date 2022-04-15 16:57:30
*/
FriendMemberStatusDTO getFriendMemberStatus(String memberId,String enterpriseId);
}
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.QywxErrorLogDTO;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
/**
* 企微报错日志(TabQywxErrorLog)表服务接口
*
* @author mozhu
* @date 2022-04-18 15:28:02
*/
public interface TabQywxErrorLogApiService {
/**
* 新增数据
* "routerName": "qywxErrorLogMq",
* @param param 参数
* @return {@link QywxErrorLogDTO }
* @author mozhu
* @date 2022-04-18 17:02:40
*/
void insertQywxErrorLog(String param);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
QywxErrorLogDTO queryById(Long id);
/**
* 查询分页列表
*
* @param qywxErrorLogListQDTO qdto qywx错误日志列表
* @return {@link Page }<{@link QywxErrorLogDTO }>
* @author mozhu
* @date 2022-04-18 17:01:14
*/
Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO);
}
......@@ -203,11 +203,12 @@ public interface WxEnterpriseApiService {
void agreeExternalUseridFlag(String wxEnterpriseId, Integer openFlag);
/**
* 好办登录
* 好办登录-插入隐私协议
*
* @param staffLoginDTO 员工登录dto
* @param staffPrivacyUseLogDTO 员工隐私使用日志dto
* @author mozhu
* @date 2021-12-15 11:02:52
* @date 2022-04-15 15:03:14
*/
void wellDoneLogin(StaffLoginDTO staffLoginDTO);
void wellDoneLoginAddPrivacy(StaffPrivacyUseLogDTO staffPrivacyUseLogDTO);
}
......@@ -325,4 +325,19 @@ public interface TabHaobanExternalClerkRelatedMapper {
TabHaobanExternalClerkRelated getByWxEnterpriseIdAndUnionId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxUserId") String wxUserId,
@Param("unionid") String unionid);
/**
* 查询最新的会员好友
*
* @param enterpriseId 企业标识
* @param memberId 成员身份
* @param statusFlag 状态标志
* @return {@link TabHaobanExternalClerkRelated }
* @author mozhu
* @date 2022-04-15 17:12:38
*/
TabHaobanExternalClerkRelated getByEnterpriseIdAndMemberId(@Param("enterpriseId") String enterpriseId,
@Param("memberId") String memberId,
@Param("statusFlag") Integer statusFlag);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.entity.TabQywxErrorLog;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 企微报错日志(TabQywxErrorLog)表数据库访问层
*
* @author mozhu
* @date 2022-04-18 15:28:11
*/
@Repository
public interface TabQywxErrorLogMapper {
/**
* 新增数据
*
* @param tabQywxErrorLog 选项卡qywx错误日志
* @return int
* @author mozhu
* @date 2022-04-18 16:18:25
*/
int insert(TabQywxErrorLog tabQywxErrorLog);
/**
* 修改数据
*
* @param tabQywxErrorLog 选项卡qywx错误日志
* @return int
* @author mozhu
* @date 2022-04-18 16:18:28
*/
int update(TabQywxErrorLog tabQywxErrorLog);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Long id);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabQywxErrorLog queryById(Long id);
/**
* 分页列表
*
* @param qywxErrorLogListQDTO qdto qywx错误日志列表
* @return {@link List }<{@link TabQywxErrorLog }>
* @author mozhu
* @date 2022-04-18 16:55:23
*/
List<TabQywxErrorLog> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO);
}
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* 选项卡qywx错误日志
* 企微报错日志(TabQywxErrorLog)实体类
*
* @author mozhu
* @date 2022-04-18 15:28:10
*/
public class TabQywxErrorLog implements Serializable {
private static final long serialVersionUID = -2508513770725265072L;
private Long id;
/**
* 场景
*/
private String scenario;
/**
* 报错内容
*/
private String errorContent;
/**
* 企微报错url
*/
private String weworkErrorUrl;
/**
* 链路id
*/
private String traceId;
/**
* 1:好办后台;2:好办小程序;3:会员小程序
*/
private Integer qywxErrorType;
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public String getErrorContent() {
return errorContent;
}
public void setErrorContent(String errorContent) {
this.errorContent = errorContent;
}
public String getWeworkErrorUrl() {
return weworkErrorUrl;
}
public void setWeworkErrorUrl(String weworkErrorUrl) {
this.weworkErrorUrl = weworkErrorUrl;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public Integer getQywxErrorType() {
return qywxErrorType;
}
public void setQywxErrorType(Integer qywxErrorType) {
this.qywxErrorType = qywxErrorType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -75,6 +75,7 @@ public class TabStaffPrivacyUseLog implements Serializable {
* update_time
*/
private Date updateTime;
private String wxOpenUseId;
public Long getId() {
return id;
......@@ -179,4 +180,12 @@ public class TabStaffPrivacyUseLog implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
}
......@@ -75,6 +75,8 @@ public class StaffPrivacyUseLogBO implements Serializable {
*/
private Date updateTime;
private String wxOpenUseId;
public Long getId() {
return id;
}
......@@ -178,4 +180,12 @@ public class StaffPrivacyUseLogBO implements Serializable {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
}
package com.gic.haoban.manage.service.pojo.bo;
import java.io.Serializable;
import java.util.Date;
/**
* 企微报错日志(TabQywxErrorLog)实体类
*
* @author mozhu
* @since 2022-04-18 15:28:12
*/
public class TabQywxErrorLogBO implements Serializable {
private static final long serialVersionUID = -2297821152064066567L;
private Long id;
private String scenario;
private String errorContent;
private String weworkErrorUrl;
private String traceId;
private Integer qywxErrorType;
private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getScenario() {
return scenario;
}
public void setScenario(String scenario) {
this.scenario = scenario;
}
public String getErrorContent() {
return errorContent;
}
public void setErrorContent(String errorContent) {
this.errorContent = errorContent;
}
public String getWeworkErrorUrl() {
return weworkErrorUrl;
}
public void setWeworkErrorUrl(String weworkErrorUrl) {
this.weworkErrorUrl = weworkErrorUrl;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public Integer getQywxErrorType() {
return qywxErrorType;
}
public void setQywxErrorType(Integer qywxErrorType) {
this.qywxErrorType = qywxErrorType;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import java.util.List;
/**
* 企微报错日志(TabQywxErrorLog)表服务接口
*
* @author mozhu
* @date 2022-04-18 15:28:02
*/
public interface TabQywxErrorLogService {
/**
* 新增数据
*
* @param tabQywxErrorLogBO 实例对象
* @return 实例对象
*/
TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO);
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
TabQywxErrorLogBO queryById(Long id);
/**
* 查询分页列表
*
* @param qywxErrorLogListQDTO qdto qywx错误日志列表
* @return {@link Page }<{@link TabQywxErrorLogBO }>
* @author mozhu
* @date 2022-04-18 16:50:32
*/
List<TabQywxErrorLogBO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO);
}
package com.gic.haoban.manage.service.service.impl;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper;
import com.gic.haoban.manage.service.entity.TabQywxErrorLog;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import com.gic.haoban.manage.service.service.TabQywxErrorLogService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 企微报错日志(TabQywxErrorLog)表服务实现类
*
* @author mozhu
* @date 2022-04-18 15:28:02
*/
@Service
public class TabQywxErrorLogServiceImpl implements TabQywxErrorLogService {
@Autowired
private TabQywxErrorLogMapper tabQywxErrorLogMapper;
@Override
public TabQywxErrorLogBO insert(TabQywxErrorLogBO tabQywxErrorLogBO) {
TabQywxErrorLog tabQywxErrorLog = new TabQywxErrorLog();
BeanUtils.copyProperties(tabQywxErrorLogBO,tabQywxErrorLog);
tabQywxErrorLogBO.setCreateTime(new Date());
this.tabQywxErrorLogMapper.insert(tabQywxErrorLog);
return tabQywxErrorLogBO;
}
@Override
public TabQywxErrorLogBO queryById(Long id) {
TabQywxErrorLog tabQywxErrorLog = this.tabQywxErrorLogMapper.queryById(id);
return EntityUtil.changeEntityByOrika(TabQywxErrorLogBO.class,tabQywxErrorLog);
}
@Override
public List<TabQywxErrorLogBO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) {
return EntityUtil.changeEntityListByOrika(TabQywxErrorLogBO.class,this.tabQywxErrorLogMapper.queryListByPage(qywxErrorLogListQDTO));
}
}
......@@ -22,71 +22,71 @@ import java.util.stream.Collectors;
@Service
public class ApplicationApiServiceImpl implements ApplicationApiService {
@Autowired
private ApplicationService applicationService;
@Autowired
private ApplicationMapper applicationMapper;
@Autowired
private TemplateEnterpriseRelatedService templateEnterpriseRelatedService;
@Autowired
private TemplateApplicationRelatedService templateApplicationRelatedService;
@Autowired
private ApplicationTemplateService applicationTemplateService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public List<ApplicationDTO> listApplication() {
List<TabHaobanApplication> list = applicationService.listApplication();
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
}
@Autowired
private ApplicationService applicationService;
@Autowired
private ApplicationMapper applicationMapper;
@Autowired
private TemplateEnterpriseRelatedService templateEnterpriseRelatedService;
@Autowired
private TemplateApplicationRelatedService templateApplicationRelatedService;
@Autowired
private ApplicationTemplateService applicationTemplateService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Override
public List<ApplicationDTO> listByApplications(List<String> applicationIds) {
List<TabHaobanApplication> list = applicationMapper.listByApplicationIds(applicationIds);
if(CollectionUtil.isEmpty(list)){
return null;
}
List<ApplicationDTO> result = EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
return result;
}
@Override
public List<ApplicationDTO> listApplication() {
List<TabHaobanApplication> list = applicationService.listApplication();
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
}
@Override
public List<ApplicationDTO> listApplicationByWxEnterpriseId(String wxEnterpriseId) {
List<TabHaobanApplication> list = applicationService.listApplication();
TemplateEnterpriseRelatedDTO template = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if(template == null){
return Collections.EMPTY_LIST;
}
List<TabHaobanTemplateApplicationRelated> applicatinList = templateApplicationRelatedService.listByTemplateId(template.getApplicationTemplateId());
List<String> applicationIds = applicatinList.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
List<TabHaobanApplication> result = new ArrayList<TabHaobanApplication>();
for (TabHaobanApplication tabHaobanApplication : list) {
if(applicationIds.contains(tabHaobanApplication.getApplicationId())){
result.add(tabHaobanApplication);
}
}
@Override
public List<ApplicationDTO> listByApplications(List<String> applicationIds) {
List<TabHaobanApplication> list = applicationMapper.listByApplicationIds(applicationIds);
if (CollectionUtil.isEmpty(list)) {
return null;
}
List<ApplicationDTO> result = EntityUtil.changeEntityListByJSON(ApplicationDTO.class, list);
return result;
}
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, result);
}
@Override
public void insertApplicationRelation(String wxEnterpriseId) {
TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if(dto == null){
ApplicationTemplateDTO defaultTemplate = applicationTemplateService.selectDefaultTemplate();
if(defaultTemplate != null){
dto = new TemplateEnterpriseRelatedDTO();
dto.setApplicationTemplateId(defaultTemplate.getApplicationTemplateId());
dto.setWxEnterpriseId(wxEnterpriseId);
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if(enterprise != null){
dto.setWxEnterpriseName(enterprise.getCorpName());
}
templateEnterpriseRelatedService.insert(dto);
}
}
}
@Override
public List<ApplicationDTO> listApplicationByWxEnterpriseId(String wxEnterpriseId) {
List<TabHaobanApplication> list = applicationService.listApplication();
TemplateEnterpriseRelatedDTO template = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if (template == null) {
return Collections.EMPTY_LIST;
}
List<TabHaobanTemplateApplicationRelated> applicatinList = templateApplicationRelatedService.listByTemplateId(template.getApplicationTemplateId());
List<String> applicationIds = applicatinList.stream().map(TabHaobanTemplateApplicationRelated::getApplicationId).collect(Collectors.toList());
List<TabHaobanApplication> result = new ArrayList<TabHaobanApplication>();
for (TabHaobanApplication tabHaobanApplication : list) {
if (applicationIds.contains(tabHaobanApplication.getApplicationId())) {
result.add(tabHaobanApplication);
}
}
return EntityUtil.changeEntityListByJSON(ApplicationDTO.class, result);
}
@Override
public void insertApplicationRelation(String wxEnterpriseId) {
TemplateEnterpriseRelatedDTO dto = templateEnterpriseRelatedService.selectByWxEnterpriseId(wxEnterpriseId);
if (dto == null) {
ApplicationTemplateDTO defaultTemplate = applicationTemplateService.selectDefaultTemplate();
if (defaultTemplate != null) {
dto = new TemplateEnterpriseRelatedDTO();
dto.setApplicationTemplateId(defaultTemplate.getApplicationTemplateId());
dto.setWxEnterpriseId(wxEnterpriseId);
WxEnterpriseDTO enterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if (enterprise != null) {
dto.setWxEnterpriseName(enterprise.getCorpName());
}
templateEnterpriseRelatedService.insert(dto);
}
}
}
}
......@@ -13,10 +13,7 @@ import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.AlertMessageDTO;
import com.gic.haoban.manage.api.dto.ClerkStaffWxUserDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedShortInfoDTO;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.AlertTypeEnum;
import com.gic.haoban.manage.api.service.CheckQywxSettingApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
......@@ -295,7 +292,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Override
public List<ExternalClerkRelatedShortInfoDTO> listExternalClerkByMemberId(String memberId, String enterpriseId) {
if (StringUtils.isAnyBlank(memberId,enterpriseId)) {
if (StringUtils.isAnyBlank(memberId, enterpriseId)) {
return null;
}
List<TabHaobanExternalClerkRelated> list = tabHaobanExternalClerkRelatedMapper.listByMemberId(memberId, enterpriseId);
......@@ -467,6 +464,31 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
return EntityUtil.changeEntityNew(ExternalClerkRelatedDTO.class, related);
}
@Override
public FriendMemberStatusDTO getFriendMemberStatus(String memberId, String enterpriseId) {
TabHaobanExternalClerkRelated tabHaobanExternalClerkRelated = tabHaobanExternalClerkRelatedMapper.getByEnterpriseIdAndMemberId(enterpriseId, memberId, null);
if (tabHaobanExternalClerkRelated != null) {
TabHaobanExternalClerkRelated hasFriend = tabHaobanExternalClerkRelatedMapper.getByEnterpriseIdAndMemberId(enterpriseId, memberId, 1);
if (hasFriend != null) {
FriendMemberStatusDTO friendMemberStatusDTO = new FriendMemberStatusDTO();
friendMemberStatusDTO.setStatusFlag(1);
friendMemberStatusDTO.setLastCreateTime(hasFriend.getCreateTime());
return friendMemberStatusDTO;
} else {
TabHaobanExternalClerkRelated hasCancelFriend = tabHaobanExternalClerkRelatedMapper.getByEnterpriseIdAndMemberId(enterpriseId, memberId, 2);
if (hasCancelFriend != null) {
FriendMemberStatusDTO friendMemberStatusDTO = new FriendMemberStatusDTO();
friendMemberStatusDTO.setStatusFlag(2);
friendMemberStatusDTO.setLastCancelCreateTime(hasCancelFriend.getCreateTime());
return friendMemberStatusDTO;
}
}
}
FriendMemberStatusDTO friendMemberStatusDTO = new FriendMemberStatusDTO();
friendMemberStatusDTO.setStatusFlag(0);
return friendMemberStatusDTO;
}
/**
* 更新状态
*
......
......@@ -26,6 +26,7 @@ import com.gic.member.api.service.MemberTagService;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
import com.gic.member.tag.api.service.MemberTagItemApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.QywxTagDTO;
import com.gic.wechat.api.dto.qywx.QywxTagGroupDTO;
import com.gic.wechat.api.dto.qywx.response.QywxGetCorpTagListDTO;
......@@ -36,6 +37,9 @@ import com.google.common.collect.Sets;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.redisson.api.RRateLimiter;
import org.redisson.api.RateIntervalUnit;
import org.redisson.api.RateType;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -551,6 +555,9 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("不需要操作:{},{}", wxUserId, externalUserId);
return;
}
RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("qywx:tag:limit");
rateLimiter.trySetRate(RateType.OVERALL, 5, 1, RateIntervalUnit.SECONDS);
rateLimiter.acquire();
QywxResponseDTO responseDTO = qywxUserApiService.markTag(wxEnterprise.getCorpid(), config.getWxSuiteid(), wxUserId, externalUserId, needSetTags, needDelTags);
logger.info("操作返回:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
......
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.QywxErrorLogDTO;
import com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO;
import com.gic.haoban.manage.api.service.TabQywxErrorLogApiService;
import com.gic.haoban.manage.service.pojo.bo.TabQywxErrorLogBO;
import com.gic.haoban.manage.service.service.TabQywxErrorLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 企微报错日志(TabQywxErrorLog)表服务实现类
*
* @author mozhu
* @date 2022-04-18 15:28:02
*/
@Service
public class TabQywxErrorLogApiServiceImpl implements TabQywxErrorLogApiService {
@Autowired
private TabQywxErrorLogService tabQywxErrorLogService;
@Override
public void insertQywxErrorLog(String param) {
TabQywxErrorLogBO tabQywxErrorLogBO = JSON.parseObject(param, TabQywxErrorLogBO.class);
tabQywxErrorLogService.insert(tabQywxErrorLogBO);
}
@Override
public QywxErrorLogDTO queryById(Long id) {
return EntityUtil.changeEntityByOrika(QywxErrorLogDTO.class,tabQywxErrorLogService.queryById(id));
}
@Override
public Page<QywxErrorLogDTO> queryListByPage(QywxErrorLogListQDTO qywxErrorLogListQDTO) {
PageHelper.startPage(qywxErrorLogListQDTO.getPageNum(), qywxErrorLogListQDTO.getPageSize());
List<TabQywxErrorLogBO> list = this.tabQywxErrorLogService.queryListByPage(qywxErrorLogListQDTO);
return PageUtil.changePageHelperToCurrentPage(new PageInfo<>(list), QywxErrorLogDTO.class);
}
}
......@@ -123,7 +123,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
secretSetting.setSecretVal(permanentCode);
secretSettingService.saveSecretSetting(secretSetting);
}
agreeExternalUseridFlag(wxEnterpriseId,1);
agreeExternalUseridFlag(wxEnterpriseId, 1);
log.info("企业微信授权处理完成");
}
......@@ -351,13 +351,21 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
@Override
public void wellDoneLogin(StaffLoginDTO staffLoginDTO) {
public void wellDoneLoginAddPrivacy(StaffPrivacyUseLogDTO staffPrivacyUseLogDTO) {
//插入隐私协议
StaffPrivacyUseLogBO staffPrivacyUseLogBO = new StaffPrivacyUseLogBO();
BeanUtils.copyProperties(staffLoginDTO, staffPrivacyUseLogBO);
StaffPrivacyUseLogBO privacyUseLog = staffPrivacyUseLogService.getByStaffId(staffLoginDTO.getStaffId());
if (privacyUseLog == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
BeanUtils.copyProperties(staffPrivacyUseLogDTO, staffPrivacyUseLogBO);
String staffId = staffPrivacyUseLogDTO.getStaffId();
if (StringUtils.isBlank(staffId) || "-1".equals(staffId)) {
StaffPrivacyUseLogBO privacyUseLogBO = staffPrivacyUseLogService.getByUserId(staffPrivacyUseLogDTO.getWxOpenUseId());
if (privacyUseLogBO == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
}
} else {
StaffPrivacyUseLogBO privacyUseLog = staffPrivacyUseLogService.getByStaffId(staffId);
if (privacyUseLog == null) {
staffPrivacyUseLogService.insert(staffPrivacyUseLogBO);
}
}
}
}
......@@ -17,6 +17,7 @@
<result column="staff_ip" property="staffIp"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="wx_open_user_id" property="wxOpenUseId"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -32,7 +33,8 @@
staff_phone_version,
staff_ip,
create_time,
update_time
update_time,
wx_open_user_id
</sql>
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id"
......@@ -42,6 +44,9 @@
<if test="null != staffId and '' != staffId">
staff_id,
</if>
<if test="null != wxOpenUseId and '' != wxOpenUseId ">
wx_open_user_id,
</if>
<if test="null != wxEnterpriseId and '' != wxEnterpriseId">
wx_enterprise_id,
</if>
......@@ -80,6 +85,9 @@
<if test="null != staffId and '' != staffId">
#{staffId},
</if>
<if test="null != wxOpenUseId and '' != wxOpenUseId ">
#{wxOpenUseId},
</if>
<if test="null != wxEnterpriseId and '' != wxEnterpriseId">
#{wxEnterpriseId},
</if>
......@@ -119,20 +127,45 @@
<update id="update" parameterType="com.gic.haoban.manage.service.entity.TabStaffPrivacyUseLog">
UPDATE tab_staff_privacy_use_log
<set>
<if test="null != staffId and '' != staffId">staff_id = #{staffId},</if>
<if test="null != wxEnterpriseId and '' != wxEnterpriseId">wx_enterprise_id = #{wxEnterpriseId},</if>
<if test="null != privacyUseFlag">privacy_use_flag = #{privacyUseFlag},</if>
<if test="null != phoneNumber and '' != phoneNumber">phone_number = #{phoneNumber},</if>
<if test="null != welldoneVersion and '' != welldoneVersion">welldone_version = #{welldoneVersion},</if>
<if test="null != weworkVersion and '' != weworkVersion">wework_version = #{weworkVersion},</if>
<if test="null != staffPhoneBrand and '' != staffPhoneBrand">staff_phone_brand = #{staffPhoneBrand},</if>
<if test="null != staffPhoneModel and '' != staffPhoneModel">staff_phone_model = #{staffPhoneModel},</if>
<if test="null != staffPhoneVersion and '' != staffPhoneVersion">staff_phone_version =
#{staffPhoneVersion},
<if test="null != staffId and '' != staffId">
staff_id = #{staffId},
</if>
<if test="null != wxOpenUseId">
wx_open_user_id = #{wxOpenUseId},
</if>
<if test="null != wxEnterpriseId and '' != wxEnterpriseId">
wx_enterprise_id = #{wxEnterpriseId},
</if>
<if test="null != privacyUseFlag">
privacy_use_flag = #{privacyUseFlag},
</if>
<if test="null != phoneNumber and '' != phoneNumber">
phone_number = #{phoneNumber},
</if>
<if test="null != welldoneVersion and '' != welldoneVersion">
welldone_version = #{welldoneVersion},
</if>
<if test="null != weworkVersion and '' != weworkVersion">
wework_version = #{weworkVersion},
</if>
<if test="null != staffPhoneBrand and '' != staffPhoneBrand">
staff_phone_brand = #{staffPhoneBrand},
</if>
<if test="null != staffPhoneModel and '' != staffPhoneModel">
staff_phone_model = #{staffPhoneModel},
</if>
<if test="null != staffPhoneVersion and '' != staffPhoneVersion">
staff_phone_version = #{staffPhoneVersion},
</if>
<if test="null != staffIp and '' != staffIp">
staff_ip = #{staffIp},
</if>
<if test="null != createTime">
create_time = #{createTime},
</if>
<if test="null != updateTime">
update_time = #{updateTime}
</if>
<if test="null != staffIp and '' != staffIp">staff_ip = #{staffIp},</if>
<if test="null != createTime">create_time = #{createTime},</if>
<if test="null != updateTime">update_time = #{updateTime}</if>
</set>
WHERE id = #{id}
</update>
......
......@@ -656,4 +656,19 @@
</select>
<select id="getByEnterpriseIdAndMemberId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_external_clerk_related
where enterprise_id = #{enterpriseId}
and member_id = #{memberId}
<if test="statusFlag != null and statusFlag == 1">
and status_flag in (1,3,4)
</if>
<if test="statusFlag != null and statusFlag == 2">
and status_flag in (0,2)
</if>
order by create_time desc limit 1
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabQywxErrorLogMapper">
<resultMap type="com.gic.haoban.manage.service.entity.TabQywxErrorLog" id="TabQywxErrorLogMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="scenario" column="scenario" jdbcType="VARCHAR"/>
<result property="errorContent" column="error_content" jdbcType="VARCHAR"/>
<result property="weworkErrorUrl" column="wework_error_url" jdbcType="VARCHAR"/>
<result property="traceId" column="trace_id" jdbcType="VARCHAR"/>
<result property="qywxErrorType" column="qywx_error_type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, scenario, error_content, wework_error_url, trace_id, qywx_error_type, create_time </sql>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.gic.haoban.manage.service.entity.TabQywxErrorLog">
INSERT INTO tab_qywx_error_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="scenario != null and scenario != ''">
scenario,
</if>
<if test="errorContent != null and errorContent != ''">
error_content,
</if>
<if test="weworkErrorUrl != null and weworkErrorUrl != ''">
wework_error_url,
</if>
<if test="traceId != null and traceId != ''">
trace_id,
</if>
<if test="qywxErrorType != null">
qywx_error_type,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="scenario != null and scenario != ''">
#{scenario},
</if>
<if test="errorContent != null and errorContent != ''">
#{errorContent},
</if>
<if test="weworkErrorUrl != null and weworkErrorUrl != ''">
#{weworkErrorUrl},
</if>
<if test="traceId != null and traceId != ''">
#{traceId},
</if>
<if test="qywxErrorType != null">
#{qywxErrorType},
</if>
<if test="createTime != null">
#{createTime},
</if>
</trim>
</insert>
<!--通过主键修改数据-->
<update id="update" parameterType="com.gic.haoban.manage.service.entity.TabQywxErrorLog">
update tab_qywx_error_log
<set>
<if test="scenario != null and scenario != ''">
scenario = #{scenario},
</if>
<if test="errorContent != null and errorContent != ''">
error_content = #{errorContent},
</if>
<if test="weworkErrorUrl != null and weworkErrorUrl != ''">
wework_error_url = #{weworkErrorUrl},
</if>
<if test="traceId != null and traceId != ''">
trace_id = #{traceId},
</if>
<if test="qywxErrorType != null">
qywx_error_type = #{qywxErrorType},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tab_qywx_error_log
where id = #{id}
</delete>
<!--查询单个-->
<select id="queryById" resultMap="TabQywxErrorLogMap">
select
<include refid="Base_Column_List"/>
from tab_qywx_error_log
where id = #{id}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryListByPage" parameterType="com.gic.haoban.manage.api.dto.qdto.QywxErrorLogListQDTO" resultMap="TabQywxErrorLogMap">
select
<include refid="Base_Column_List"/>
from tab_qywx_error_log
<where>
<if test="scenario != null and scenario != ''">
and scenario = #{scenario}
</if>
<if test="qywxErrorType != null">
and qywx_error_type = #{qywxErrorType}
</if>
<if test="startDate != null">
and create_time <![CDATA[ >= ]]> #{startDate}
</if>
<if test="endDate != null">
and create_time <![CDATA[ <= ]]> #{endDate}
</if>
</where>
</select>
</mapper>
......@@ -8,7 +8,6 @@ import com.gic.haoban.manage.api.dto.StoreRangeInfoDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.StoreGroupVo;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
......@@ -18,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -53,12 +51,8 @@ public class GicDepartmentController extends WebBaseController{
List<WxEnterpriseDTO> wxEnterpriseDTOS = wxEnterpriseRelatedApiService.listWxEnterpriseByEid(enterpriseId);
if (CollectionUtils.isNotEmpty(wxEnterpriseDTOS)) {
Map<String, WxEnterpriseDTO> wxEnterpriseDTOMap = wxEnterpriseDTOS.stream().collect(Collectors.toMap(dto -> dto.getWxEnterpriseId(), dto -> dto));
storeRangeMap = rangeInfoDTOList.stream().filter(dto -> (!dto.getWxEnterpriseId().equals(wxEnterpriseId)) && dto.getRelationType() == 1)
.map(dto -> {
dto.setWxEnterpriseName(wxEnterpriseDTOMap.get(dto.getWxEnterpriseId()).getCorpName());
return dto;
}).collect(Collectors.toMap(dto -> dto.getRelationId(), dto -> dto));
.peek(dto -> dto.setWxEnterpriseName(wxEnterpriseDTOMap.get(dto.getWxEnterpriseId()).getCorpName())).collect(Collectors.toMap(dto -> dto.getRelationId(), dto -> dto));
}
}
Map<String, StoreRangeInfoDTO> finalStoreRangeMap = storeRangeMap;
......
package com.gic.haoban.manage.web.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.web.vo.SdkVersionLimitVo;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.ApplicationDTO;
import com.gic.haoban.manage.api.dto.ApplicationSettingDTO;
import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.SdkVersionLimitVo;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
@RestController
public class ApplicationController extends WebBaseController{
@Autowired
private ApplicationApiService applicationApiService;
@Autowired
private ApplicationSettingApiService applicationSettingApiService;
public class ApplicationController extends WebBaseController {
@Autowired
private ApplicationApiService applicationApiService;
@Autowired
private ApplicationSettingApiService applicationSettingApiService;
private static final String SDKVERSION_KEY = "haoban-wx-sdk-version";
@RequestMapping("application-list")
public HaobanResponse applicationList(String wxEnterpriseId) {
List<ApplicationDTO> list = applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId);
List<String> applicationIds = list.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
List<ApplicationSettingDTO> settings = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId, applicationIds);
List<String> openApplicationIds = new ArrayList<String>();
if(CollectionUtil.isNotEmpty(settings)){
openApplicationIds = settings.stream().map(s->s.getApplicationId()).collect(Collectors.toList());
}
Iterator<ApplicationDTO> it = list.listIterator();
while(it.hasNext()){
ApplicationDTO app = it.next();
if(!openApplicationIds.contains(app.getApplicationId())){
it.remove();
continue ;
}
if("通讯录".equals(app.getApplicationName())){
it.remove();
continue ;
}
if("卡券赠送".equals(app.getApplicationName())){
it.remove();
continue ;
}
if("内购券".equals(app.getApplicationName())){
it.remove();
continue ;
}
}
return resultResponse(HaoBanErrCode.ERR_1,list);
}
@RequestMapping("application-list")
public HaobanResponse applicationList(String wxEnterpriseId) {
List<ApplicationDTO> list = applicationApiService.listApplicationByWxEnterpriseId(wxEnterpriseId);
List<String> applicationIds = list.stream().map(s -> s.getApplicationId()).collect(Collectors.toList());
List<ApplicationSettingDTO> settings = applicationSettingApiService.listOpenByWxEnterpriseIdAndApplicationIds(wxEnterpriseId, applicationIds);
List<String> openApplicationIds = new ArrayList<String>();
if (CollectionUtil.isNotEmpty(settings)) {
openApplicationIds = settings.stream().map(s -> s.getApplicationId()).collect(Collectors.toList());
}
Iterator<ApplicationDTO> it = list.listIterator();
while (it.hasNext()) {
ApplicationDTO app = it.next();
if (!openApplicationIds.contains(app.getApplicationId())) {
it.remove();
continue;
}
if ("通讯录".equals(app.getApplicationName())) {
it.remove();
continue;
}
if ("卡券赠送".equals(app.getApplicationName())) {
it.remove();
continue;
}
if ("内购券".equals(app.getApplicationName())) {
it.remove();
continue;
}
}
return resultResponse(HaoBanErrCode.ERR_1, list);
}
@RequestMapping("sdk-version-check")
public HaobanResponse sdkVersionCheck(String skdVersion) {
......@@ -85,8 +78,8 @@ public class ApplicationController extends WebBaseController{
String limitSdkVersion = cache.toString();
sdkVersionLimitVo.setLimitSdkVersion(limitSdkVersion);
String[] limitSdk = StringUtils.split(limitSdkVersion, ".");
String[] versionSplit = StringUtils.split(skdVersion, ".");
String[] limitSdk = StringUtils.split(limitSdkVersion, ".");
String[] versionSplit = StringUtils.split(skdVersion, ".");
int checkFlag = checkNum(Integer.valueOf(limitSdk[0]), Integer.valueOf(versionSplit[0]));
if (checkFlag != 0) {
......
......@@ -132,7 +132,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
wellDoneLoginInfoVo.setWxOpenUseId(userId);
StaffPrivacyUseLogDTO staffPrivacyUseLogDTO = staffApiService.getStaffPrivacyByUserId(userId);
wellDoneLoginInfoVo.setPrivacyUseFlag(staffPrivacyUseLogDTO == null ? 0 : 1);
return resultResponse(HaoBanErrCode.ERR_1,wellDoneLoginInfoVo);
wellDoneLoginInfoVo.setStaffId("-1");
return resultResponse(HaoBanErrCode.ERR_1, wellDoneLoginInfoVo);
}
if (StringUtils.isNotBlank(loginStaff.getPhoneNumber())) {
......@@ -194,6 +195,66 @@ public class WxEnterpriseInfoController extends WebBaseController {
@IgnoreLogin
public RestResponse<String> welldoneLogin(@RequestBody @Valid StaffLoginQO staffLoginQO, HttpServletRequest request) {
String staffId = staffLoginQO.getStaffId();
String wxOpenUseId = staffLoginQO.getWxOpenUseId();
//-1 代表游客登录
if (StringUtils.isBlank(staffId) || "-1".equals(staffId)) {
return wellDoneTouristsLogin(staffLoginQO, request, staffId, wxOpenUseId);
}
//用户登录
return wellDoneLogin(staffLoginQO, request, staffId);
}
/**
* 游客登录
*
* @param staffLoginQO
* @param request
* @param staffId
* @param wxOpenUseId
* @return
*/
private RestResponse<String> wellDoneTouristsLogin(StaffLoginQO staffLoginQO, HttpServletRequest request, String staffId, String wxOpenUseId) {
logger.info("游客登录,wxOpenUseId:{}", wxOpenUseId);
//登录和刷新token兼容
String headerToken = AuthRequestWellDoneUtil.getHeaderToken();
if (StringUtils.isNotBlank(headerToken)) {
return getRefreshToken();
}
Map<String, String> map = new HashMap<>();
map.put("staffId", "-1");
map.put("wxOpenUseId", wxOpenUseId);
String token = JwtUtil.genToken(map);
AuthRequestWellDoneUtil.setAppLoginUser(staffId, token);
StaffPrivacyUseLogDTO privacyUseLogDTO = new StaffPrivacyUseLogDTO();
BeanUtils.copyProperties(staffLoginQO, privacyUseLogDTO);
privacyUseLogDTO.setStaffIp(IPAddressUtil.getIpAddress(request));
wxEnterpriseApiService.wellDoneLoginAddPrivacy(privacyUseLogDTO);
return RestResponse.successResult(token);
}
/**
* 刷新token
*
* @return
*/
private RestResponse<String> getRefreshToken() {
String refreshToken = AuthRequestWellDoneUtil.refreshToken();
if (StringUtils.isBlank(refreshToken)) {
return RestResponse.failure(String.valueOf(HaoBanErrCode.ERR_30010.getCode()), HaoBanErrCode.ERR_30010.getMsg());
}
return RestResponse.successResult(refreshToken);
}
/**
* 用户登录
*
* @param staffLoginQO
* @param request
* @param staffId
* @return
*/
private RestResponse<String> wellDoneLogin(StaffLoginQO staffLoginQO, HttpServletRequest request, String staffId) {
// 正常登录
String loginPhoneNumber = staffLoginQO.getPhoneNumber();
logger.info("好办登录,staffId:{},loginPhoneNumber:{}", staffId, loginPhoneNumber);
StaffDTO staffDTO = staffApiService.selectById(staffId);
......@@ -208,11 +269,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
//登录和刷新token兼容
String headerToken = AuthRequestWellDoneUtil.getHeaderToken();
if (StringUtils.isNotBlank(headerToken)) {
String refreshToken = AuthRequestWellDoneUtil.refreshToken();
if (StringUtils.isBlank(refreshToken)) {
return RestResponse.failure(String.valueOf(HaoBanErrCode.ERR_30010.getCode()), HaoBanErrCode.ERR_30010.getMsg());
}
return RestResponse.successResult(refreshToken);
return getRefreshToken();
}
Map<String, String> map = new HashMap<>();
map.put("staffId", staffId);
......@@ -220,13 +277,13 @@ public class WxEnterpriseInfoController extends WebBaseController {
map.put("phoneNumber", phoneNumber);
String token = JwtUtil.genToken(map);
AuthRequestWellDoneUtil.setAppLoginUser(staffId, token);
StaffLoginDTO staffLoginDTO = new StaffLoginDTO();
BeanUtils.copyProperties(staffLoginQO, staffLoginDTO);
staffLoginDTO.setStaffIp(IPAddressUtil.getIpAddress(request));
staffDTO.setWxEnterpriseId(staffDTO.getWxEnterpriseId());
staffDTO.setPhoneNumber(phoneNumber);
staffDTO.setWxUserId(staffDTO.getWxUserId());
wxEnterpriseApiService.wellDoneLogin(staffLoginDTO);
StaffPrivacyUseLogDTO privacyUseLogDTO = new StaffPrivacyUseLogDTO();
BeanUtils.copyProperties(staffLoginQO, privacyUseLogDTO);
privacyUseLogDTO.setStaffIp(IPAddressUtil.getIpAddress(request));
privacyUseLogDTO.setWxEnterpriseId(staffDTO.getWxEnterpriseId());
privacyUseLogDTO.setPhoneNumber(phoneNumber);
privacyUseLogDTO.setWxUserId(staffDTO.getWxUserId());
wxEnterpriseApiService.wellDoneLoginAddPrivacy(privacyUseLogDTO);
return RestResponse.successResult(token);
}
......@@ -238,12 +295,8 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @date 2021-12-10 18:34:12
*/
@RequestMapping(value = "welldone-token-refresh", method = RequestMethod.GET)
public HaobanResponse welldoneTokenRefresh() {
String token = AuthRequestWellDoneUtil.refreshToken();
if (StringUtils.isBlank(token)) {
return resultResponse(HaoBanErrCode.ERR_30010);
}
return resultResponse(HaoBanErrCode.ERR_1, token);
public RestResponse<String> welldoneTokenRefresh() {
return getRefreshToken();
}
/**
......@@ -252,9 +305,9 @@ public class WxEnterpriseInfoController extends WebBaseController {
* @return
*/
@RequestMapping(value = "welldone-loginout", method = RequestMethod.GET)
public HaobanResponse welldoneLoginOut() {
public RestResponse welldoneLoginOut() {
AuthRequestWellDoneUtil.delToken();
return resultResponse(HaoBanErrCode.ERR_1);
return RestResponse.successResult();
}
/**
......
......@@ -52,6 +52,8 @@ public class StaffLoginQO implements Serializable {
*/
private String staffPhoneVersion;
private String wxOpenUseId;
public String getStaffId() {
return staffId;
}
......@@ -139,4 +141,12 @@ public class StaffLoginQO implements Serializable {
public void setStaffPhoneVersion(String staffPhoneVersion) {
this.staffPhoneVersion = staffPhoneVersion;
}
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment