Commit c3ed75be by 徐高华

Merge branch 'master_xgh_我的客户迭代' into 'master'

Master xgh 我的客户迭代

See merge request !455
parents db3e0508 9631eca4
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* desc:员工导购id与导购wxUserId实体
......@@ -23,13 +24,24 @@ public class ClerkStaffWxUserDTO implements Serializable {
*/
private String staffClerkId;
private Date addFriendTime ;
public Date getAddFriendTime() {
return addFriendTime;
}
public void setAddFriendTime(Date addFriendTime) {
this.addFriendTime = addFriendTime;
}
public ClerkStaffWxUserDTO() {
}
public ClerkStaffWxUserDTO(String staffId, String staffClerkId, String memberExternalUserId) {
public ClerkStaffWxUserDTO(String staffId, String staffClerkId, String memberExternalUserId , Date addFriendTime) {
this.memberExternalUserId = memberExternalUserId;
this.staffId = staffId;
this.staffClerkId = staffClerkId;
this.addFriendTime = addFriendTime ;
}
public String getMemberExternalUserId() {
......
......@@ -193,6 +193,10 @@ public interface ExternalClerkRelatedApiService {
*/
boolean isFriends(String memberId, String clerkId, String enterpriseId);
com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriend(String enterpriseId, String staffId, String memberId) ;
com.gic.api.base.commons.ServiceResponse<String> getExternalUseridForWxa(String enterpriseId, String staffId, String memberId) ;
List<String> listMemberAndClerk(List<String> memberIdList , List<String> clerkIdList , String enterpriseId) ;
/**
......
......@@ -279,6 +279,17 @@ public interface StaffApiService {
*/
boolean isManager(String clerkId);
/**
*
* @Title: isEnterpriseManager
* @Description: 是否是区经
* @author xugh
* @param clerkId
* @return
* @throws
*/
com.gic.api.base.commons.ServiceResponse<Boolean> isEnterpriseManager(String clerkId) ;
/**
* 绑定的员工列表
......
......@@ -56,7 +56,7 @@ public interface StaffClerkRelationApiService {
* @param channelCode
* @return
*/
boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode);
boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode,String wxEnterpriseId);
/**
* 解绑门店
......@@ -82,8 +82,6 @@ public interface StaffClerkRelationApiService {
*/
List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds);
/**
* 查询导购信息
* @param storeId
......
......@@ -10,8 +10,6 @@ public interface StaffDepartmentRelatedApiService {
List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId);
List<StaffDepartmentRelatedDTO> listByDepartmentIds(List<String> departmentIds);
List<StaffDepartmentRelatedDTO> listByStaffId(String staffId);
void updateById(StaffDepartmentRelatedDTO dto);
......@@ -25,12 +23,6 @@ public interface StaffDepartmentRelatedApiService {
*/
StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId);
void deleteCode(StaffDepartmentRelatedDTO dto);
StaffDepartmentRelatedDTO getOneByClerkCodeAndDepartmentId(String clerkCode, String departmentId);
StaffDepartmentRelatedDTO getOneByStaffIdAndDepartmentId(String staffId, String departmentId);
Map<String, String> getWxUserIdByClerkId(String clerkId);
String getPageUrl(int type, String data);
......
......@@ -70,14 +70,6 @@ public interface WxEnterpriseApiService {
List<YwWxEnterpriseDTO> listByIds(Set<String> enterpriseIds);
/**
* 企业是否过期 true是
*
* @param enterpriseId
* @return
*/
boolean enterpriseIsOver(String enterpriseId);
/**
* 获取配置
*
* @param wxEnterpriseId
......
package com.gic.haoban.manage.api.service.out;
import com.gic.haoban.manage.api.dto.ErrorLogDTO;
/**
* desc:好办错误日志服务接口
*
* @author: YongEn
* @date: 2022/1/18
**/
public interface ErrorLogApiService {
/**
* desc: 保存
*
* @param dto
* @return :
* @author : YongEn
* @date : 2022/1/18
*/
void save(ErrorLogDTO dto);
}
......@@ -17,8 +17,6 @@ public interface StaffDepartmentRelatedMapper {
List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId);
void deleteCode(TabHaobanStaffDepartmentRelated dto);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
TabHaobanStaffDepartmentRelated getById(String staffDepartmentRelatedId);
......
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanErrorLog;
public interface TabHaobanErrorLogMapper {
int deleteByPrimaryKey(Long id);
int insert(TabHaobanErrorLog record);
int insertSelective(TabHaobanErrorLog record);
TabHaobanErrorLog selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(TabHaobanErrorLog record);
int updateByPrimaryKey(TabHaobanErrorLog record);
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity.ext;
import java.io.Serializable;
import java.util.Date;
/**
* desc:会员导购关系扩展实体类
......@@ -24,6 +25,16 @@ public class MemberStaffRelExtDO implements Serializable {
*/
private String staffClerkId;
private Date addFriendTime ;
public Date getAddFriendTime() {
return addFriendTime;
}
public void setAddFriendTime(Date addFriendTime) {
this.addFriendTime = addFriendTime;
}
public String getMemberId() {
return memberId;
}
......
package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanErrorLog;
/**
* desc:好办错误日志服务
*
* @author: YongEn
* @date: 2022/1/18
**/
public interface ErrorLogService {
/**
* desc: 保存错误日志
*
* @param errorLog
* @return :
* @author : YongEn
* @date : 2022/1/18
*/
void save(TabHaobanErrorLog errorLog);
}
......@@ -14,7 +14,7 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId);
boolean delBind(String clerkId, String optStaffId, int channelCode , String newClerkId);
boolean delBind(String clerkId, String optStaffId, int channelCode , String newClerkId , String wxEnterpriseId);
/**
* 解绑-删除绑定(门店级别)
......
package com.gic.haoban.manage.service.service.impl;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanErrorLogMapper;
import com.gic.haoban.manage.service.entity.TabHaobanErrorLog;
import com.gic.haoban.manage.service.service.ErrorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* desc:
*
* @author: YongEn
* @date: 2022/1/18
**/
@Service
public class ErrorLogServiceImpl implements ErrorLogService {
@Autowired
private TabHaobanErrorLogMapper tabHaobanErrorLogMapper;
@Override
public void save(TabHaobanErrorLog errorLog) {
errorLog.setId(UniqueIdUtils.uniqueLong());
errorLog.setCreateTime(new Date());
errorLog.setUpdateTime(new Date());
tabHaobanErrorLogMapper.insert(errorLog);
}
}
......@@ -72,17 +72,21 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId, String enterpriseId, Set<String> clerkCodeList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCode(wxEnterpriseId, enterpriseId, clerkCodeList));
return mapper.listBindCode(wxEnterpriseId, enterpriseId, clerkCodeList);
}
@Override
public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCodeByStaffId(enterpriseIdList, staffId));
return mapper.listBindCodeByStaffId(enterpriseIdList, staffId);
}
@Override
public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId) {
TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(oldClerkId, null);
public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId, String wxEnterpriseId) {
TabHaobanStaff staff = this.staffService.selectById(optStaffId) ;
if(null != staff) {
wxEnterpriseId = staff.getWxEnterpriseId() ;
}
StaffClerkRelationDTO clerkRelation = mapper.getOneByClerkId(oldClerkId, wxEnterpriseId);
if (null == clerkRelation) {
logger.info("老的绑定关联不存在,clerkId={}", oldClerkId);
return true;
......@@ -126,13 +130,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
logger.info("没有传门店列表:{}", wxEnterpriseId);
return true;
}
List<TabHaobanStaffClerkRelation> needUnbind = mapper.listBindByStoreIds(wxEnterpriseId, storeIds);
List<String> storeIdList = new ArrayList<>();
storeIdList.addAll(storeIds) ;
List<StaffClerkRelationDTO> needUnbind = mapper.listByStoreIds(wxEnterpriseId, storeIdList);
if (CollectionUtils.isEmpty(needUnbind)) {
logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId);
return true;
}
for (TabHaobanStaffClerkRelation staffClerkRelation : needUnbind) {
for (StaffClerkRelationDTO staffClerkRelation : needUnbind) {
String enterpriseId = staffClerkRelation.getEnterpriseId();
//删除好友通知会员
List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(staffClerkRelation.getStoreId(), staffClerkRelation.getStaffId());
......@@ -146,7 +152,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds);
//放入队列
staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need);
for (TabHaobanStaffClerkRelation clerkRelation : needUnbind) {
for (StaffClerkRelationDTO clerkRelation : needUnbind) {
//废弃活码
String enterpriseId = clerkRelation.getEnterpriseId();
hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode);
......@@ -212,13 +218,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, relation);
return mapper.getOneByClerkId(clerkId, wxEnterpriseId);
}
@Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId));
return mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId);
}
......@@ -254,17 +259,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getOneBindStoreId(staffId, storeId));
return mapper.getOneByStoreIdAndStaffId(storeId,staffId);
}
@Override
public StaffClerkRelationDTO getByClerkId(String clerkId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByClerkId(clerkId, null));
return mapper.getOneByClerkId(clerkId, null);
}
@Override
public StaffClerkRelationDTO getByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation staffClerkRelation = mapper.getByClerkId(clerkId, wxEnterpriseId);
StaffClerkRelationDTO staffClerkRelation = mapper.getOneByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityNew(StaffClerkRelationDTO.class, staffClerkRelation);
}
......@@ -308,19 +313,19 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkRelation> clerkBindList = mapper.pageByWxEnterpriseId(wxEnterpriseId);
List<StaffClerkRelationDTO> clerkBindList = mapper.pageByWxEnterpriseId(wxEnterpriseId);
Page<StaffClerkRelationDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindList), StaffClerkRelationDTO.class);
return retPage;
}
@Override
public List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId) {
return mapper.listBindByStoreId(wxEnterpriseId, storeId);
return mapper.listByStoreIds(wxEnterpriseId, Arrays.asList(storeId));
}
@Override
public List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId) {
List<TabHaobanStaffClerkRelation> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId);
List<StaffClerkRelationDTO> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(clerkRelations)) {
return new ArrayList<>();
}
......@@ -339,9 +344,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) {
return mapper.listWxOpenUserIdByClerkIds(clerkList, wxEnterpriseId);
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId,2);
}
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId);
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId,1);
}
@Override
......@@ -351,9 +356,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) {
return mapper.listIdsByWxOpenUserIds(wxUserIds, wxEnterpriseId, enterpriseId);
return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId,2);
}
return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId);
return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId,1);
}
@Override
......@@ -385,6 +390,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId) {
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, mapper.listManageBindByStaffId(staffId));
return mapper.listManageBindByStaffId(staffId);
}
}
......@@ -216,7 +216,7 @@ public class AuditApiServiceImpl implements AuditApiService {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
}
staffClerkRelationApiService.unbindByStaffAndClerkId(optStaffId, obj.getClerkId(), ChannelCodeEnum.AUDIT_UNBIND.getCode());
staffClerkRelationApiService.unbindByStaffAndClerkId(optStaffId, obj.getClerkId(), ChannelCodeEnum.AUDIT_UNBIND.getCode(),obj.getWxEnterpriseId());
staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, "");
} else if (auditType == AuditType.CLERK_UNBIND.getCode()) {
//解绑申请,无需审核,直接通过
......
package com.gic.haoban.manage.service.service.out.impl;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.ErrorLogDTO;
import com.gic.haoban.manage.api.service.out.ErrorLogApiService;
import com.gic.haoban.manage.service.entity.TabHaobanErrorLog;
import com.gic.haoban.manage.service.service.ErrorLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* desc:好办错误日志服务实现
*
* @author: YongEn
* @date: 2022/1/18
**/
@Service
public class ErrorLogApiServiceImpl implements ErrorLogApiService {
@Autowired
private ErrorLogService errorLogService;
@Override
public void save(ErrorLogDTO dto) {
TabHaobanErrorLog errorLog = EntityUtil.changeEntityNew(TabHaobanErrorLog.class, dto);
errorLogService.save(errorLog);
}
}
......@@ -26,7 +26,6 @@ import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.*;
import com.gic.haoban.manage.service.entity.MemberUnionidRelated;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
......@@ -55,7 +54,6 @@ import org.redisson.api.RateType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
......@@ -68,8 +66,6 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Autowired
private TabHaobanExternalClerkRelatedMapper tabHaobanExternalClerkRelatedMapper;
@Autowired
private MemberUnionidRelatedMapper memberUnionidRelatedMapper;
@Autowired
private TabHaobanStaffClerkRelationMapper staffClerkRelationMapper;
@Autowired
private WxEnterpriseMapper wxEnterriseMapper;
......@@ -443,17 +439,32 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Override
public boolean isFriends(String memberId, String clerkId, String enterpriseId) {
TabHaobanStaffClerkRelation staffClerkRelation = staffClerkRelationMapper.getByClerkId(clerkId,null);
StaffClerkRelationDTO staffClerkRelation = staffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (staffClerkRelation == null) {
return false;
}
String staffId = staffClerkRelation.getStaffId();
log.info("【查询会员】clerkId = {},staffId={},memberId={}", clerkId, staffId, memberId);
return this.isQwFriend(enterpriseId, staffId, memberId).getResult() ;
}
@Override
public com.gic.api.base.commons.ServiceResponse<Boolean> isQwFriend(String enterpriseId, String staffId, String memberId) {
log.info("查询是否好友enterpriseId={},staffId={},memberId={}",enterpriseId, staffId, memberId);
TabHaobanExternalClerkRelated externalClerkRelated = tabHaobanExternalClerkRelatedMapper.getByMemberIdAndStaffId(staffId, enterpriseId, memberId);
if (externalClerkRelated == null) {
return false;
return com.gic.api.base.commons.ServiceResponse.success(Boolean.FALSE);
}
return com.gic.api.base.commons.ServiceResponse.success(externalClerkRelated.getStatusFlag() == 1);
}
@Override
public com.gic.api.base.commons.ServiceResponse<String> getExternalUseridForWxa(String enterpriseId, String staffId,
String memberId) {
TabHaobanExternalClerkRelated externalClerkRelated = tabHaobanExternalClerkRelatedMapper.getByMemberIdAndStaffId(staffId, enterpriseId, memberId);
if(null != externalClerkRelated) {
return com.gic.api.base.commons.ServiceResponse.success(externalClerkRelated.getExternalClerkRelatedId());
}
return externalClerkRelated.getStatusFlag() == 1;
return com.gic.api.base.commons.ServiceResponse.failure("9999", "无好友关系") ;
}
@Override
......@@ -480,7 +491,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
// key-memberId
MemberStaffRelExtDO::getMemberId,
// value-list
e -> new ArrayList<>(Collections.singletonList(new ClerkStaffWxUserDTO(e.getStaffId(), e.getStaffClerkId(), e.getMemberExternalUserId()))),
e -> new ArrayList<>(Collections.singletonList(new ClerkStaffWxUserDTO(e.getStaffId(), e.getStaffClerkId(), e.getMemberExternalUserId(),e.getAddFriendTime()))),
// 重复key的value添加到集合
(List<ClerkStaffWxUserDTO> oldList, List<ClerkStaffWxUserDTO> newList) -> {
oldList.addAll(newList);
......
......@@ -341,7 +341,7 @@ public class MessageApiServiceImpl implements MessageApiService {
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationApiService.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId(), ChannelCodeEnum.ADMIN_UNBIND.getCode());
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId(), ChannelCodeEnum.ADMIN_UNBIND.getCode(),wxEnterpriseId);
}
}
}
......
......@@ -39,7 +39,7 @@ import com.gic.wechat.api.service.qywx.QywxExternalUserService;
public class QwFriendApiServiceImpl implements QwFriendApiService {
private static final Logger log = LogManager.getLogger(QwFriendApiService.class);
private static final int subjectType = 0 ;
private int subjectType = 0 ;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService;
......@@ -73,6 +73,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
public ServiceResponse<Map<String, String>> pendingIdCheck(String enterpriseId, String unionid, String openid,
String wxaUnionid, String wxaOpenid , boolean setCheckFlag) {
if("ff8080815dacd3a2015dacd3ef5c0000".equals(enterpriseId)) {
subjectType = 1 ;
}
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,setCheckFlag);
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
......@@ -128,6 +131,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
}
if("ff8080815dacd3a2015dacd3ef5c0000".equals(enterpriseId)) {
subjectType = 1 ;
}
String suiteid = config.getWxSuiteid();
WxEnterpriseQwDTO qwDTO = corpidResp.getResult();
String wxEnterpriseId = qwDTO.getWxEnterpriseId();
......
package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
......@@ -28,6 +27,7 @@ import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.ImageUtil;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.dto.StoreWidgetDTO;
import com.gic.enterprise.api.service.EnterpriseService;
......@@ -38,7 +38,16 @@ import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.RolesListUtils;
import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO;
import com.gic.haoban.manage.api.dto.StaffQrCodeDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
......@@ -69,6 +78,8 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.hutool.core.collection.CollectionUtil;
@Service
public class StaffApiServiceImpl implements StaffApiService {
......@@ -803,24 +814,24 @@ public class StaffApiServiceImpl implements StaffApiService {
Object cache = RedisUtil.getCache(cacheKey);
if (cache != null) {
List<String> storeList = (List<String>) cache;
logger.info("从缓存中获取通道={},数量:{}", cacheKey, storeList.size());
logger.info("从缓存中获取key={},store数量:{}", cacheKey, storeList.size());
return storeList;
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO == null) {
logger.info("导购不存在:clerkId:{}", clerkId);
logger.info("导购不存在:clerkId:{},无门店", clerkId);
return Collections.emptyList();
}
String enterpriseId = clerkDTO.getEnterpriseId();
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(enterpriseIdStoreIds)) {
logger.info("好办门店空,eid={}", enterpriseId);
logger.info("无好办门店,eid={}", enterpriseId);
return Collections.emptyList();
}
logger.info("好办门店id数量:{}", enterpriseIdStoreIds.size());
logger.info("好办门店数量={}", enterpriseIdStoreIds.size());
List<String> gicStoreIds = getStoreIdList(clerkDTO);
if (CollectionUtils.isEmpty(gicStoreIds)) {
logger.info("gic门店为空");
logger.info("gic门店为空");
return Collections.emptyList();
}
if (gicStoreIds.contains("-1")) {
......@@ -840,10 +851,10 @@ public class StaffApiServiceImpl implements StaffApiService {
RedisUtil.setCache(cacheKey, enterpriseIdStoreIds, 10L, TimeUnit.MINUTES);
return enterpriseIdStoreIds;
}
logger.info("gic门店数量{}", gicStoreIds.size());
logger.info("gic门店数量={}", gicStoreIds.size());
//取交集
List<String> storeList = RolesListUtils.mergeList(enterpriseIdStoreIds, gicStoreIds);
logger.info("该导购权限:clerkId:{},门店数量:{}", clerkId, storeList.size());
logger.info("clerkId={},门店交集数量={}", clerkId, storeList.size());
RedisUtil.setCache(cacheKey, storeList, 10L, TimeUnit.MINUTES);
return storeList;
}
......@@ -893,14 +904,25 @@ public class StaffApiServiceImpl implements StaffApiService {
return storeRoleDTO;
}
if (storeIds.contains("-1")) {
logger.info("该导购为超管");
int gicStoreCount = storeWidgetService.getClerkWidgetStore(clerkId);
storeRoleDTO.setStoreCount(gicStoreCount);
logger.info("该导购为所有门店,clerkId={}",clerkId);
String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId);
int storeCount = 0 ;
String storeId = null ;
if(null != storeWidgetId) {
Page<Object> pageParam = new Page<Object>();
pageParam.setCurrentPage(1);
pageParam.setPageSize(1);
Page<StoreDTO> page = storeWidgetService.getStoreWidgetStore(storeWidgetId, null, clerkDTO.getEnterpriseId(), pageParam, null,null);
storeId = page.getResult().get(0).getStoreId();
storeCount = page.getTotalCount();
storeRoleDTO.setStoreId(storeId);
storeRoleDTO.setStoreCount(storeCount);
}
return storeRoleDTO;
}
int size = storeIds.size();
storeRoleDTO.setStoreCount(size);
if (size == 1) {
if (size >= 1) {
storeRoleDTO.setStoreId(storeIds.get(0));
}
return storeRoleDTO;
......@@ -914,7 +936,6 @@ public class StaffApiServiceImpl implements StaffApiService {
Integer superAdmin = clerkDTO.getSuperAdmin();
if (superAdmin != null && superAdmin == 1) {
logger.info("gic超管,clerkId:{}", clerkId);
//gic超管
return Collections.singletonList("-1");
}
String enterpriseId = clerkDTO.getEnterpriseId();
......@@ -922,23 +943,22 @@ public class StaffApiServiceImpl implements StaffApiService {
if (enterpriseSetting.getEnableAccessControl() != null && enterpriseSetting.getEnableAccessControl() == 1) {
String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId);
if (StringUtils.isBlank(storeWidgetId)) {
logger.info("导购权限不存在");
logger.info("导购无门店权限,门店组件id is null");
return Collections.emptyList();
}
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidgetBykey(storeWidgetId);
if (storeWidgetDTO == null) {
logger.info("导购权限不存在");
logger.info("导购门店权限查不到,storeWidgetId={}",storeWidgetId);
return Collections.emptyList();
}
Integer selectType = storeWidgetDTO.getSelectType();
if (selectType != null && selectType == 0) {
//gic超管
logger.info("gic超管,clerkId:{}", clerkId);
logger.info("gic超管所有门店,clerkId:{}", clerkId);
return Collections.singletonList("-1");
}
return getStoreWidgetIdStoreIds(storeWidgetId, enterpriseId);
} else {
//未开启分权
logger.info("无开启权限 ,所有门店,clerkId={}", clerkId);
return Collections.singletonList("-1");
}
}
......@@ -948,7 +968,7 @@ public class StaffApiServiceImpl implements StaffApiService {
*/
private List<String> getStoreWidgetIdStoreIds(String storeWidgetId, String enterpriseId) {
// 门店id列表
List<String> storeIdList = storeWidgetService.getStoreWidgetStore(storeWidgetId, enterpriseId, null, null, 2);
List<String> storeIdList = storeWidgetService.getStoreWidgetStore(storeWidgetId, enterpriseId, null, null, 0);
if (CollectionUtils.isEmpty(storeIdList)) {
return Collections.emptyList();
}
......@@ -970,6 +990,18 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public com.gic.api.base.commons.ServiceResponse<Boolean> isEnterpriseManager(String clerkId) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO != null) {
Integer clerkType = clerkDTO.getClerkType();
if (clerkType == 2) {
return com.gic.api.base.commons.ServiceResponse.success(true);
}
}
return com.gic.api.base.commons.ServiceResponse.success(false);
}
@Override
public List<StaffDTO> listBindStoreIds(List<String> storeIds, String wxEnterpriseId) {
return staffMapper.listBindStoreIds(storeIds,wxEnterpriseId);
}
......
......@@ -246,30 +246,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public List<StaffClerkRelationDTO> listByStoreId(String storeId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreId(storeId);
if (CollectionUtil.isEmpty(list)) {
return new ArrayList<>();
}
List<StaffClerkRelationDTO> result = EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
return result;
}
@Override
public List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreIds(storeIds);
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, list);
return tabHaobanStaffClerkRelationMapper.listByStoreIds(null,Arrays.asList(storeId));
}
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode, null);
public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode,String wxEnterpriseId) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode, null,wxEnterpriseId);
}
@Override
public StaffClerkRelationDTO getOneByClerkId(String clerkId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
StaffClerkRelationDTO result = EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, tab);
return result;
return tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
}
@Override
......@@ -284,13 +271,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId,
String staffId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId,String staffId) {
StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
if (tab == null) {
return null;
}
return EntityUtil.changeEntity(StaffClerkRelationDTO.class, tab);
return tab;
}
@Override
......@@ -338,8 +324,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
return tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid);
}
@Override
......@@ -497,7 +482,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
Integer status = clerkDTO.getStatus();
logger.info("导购删除,clerkId:{},status:{}", clerkId, status);
if (!status.equals(1)) {
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null);
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null,null);
}
} else if (type == 2) {
logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId());
......@@ -539,7 +524,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else if (clerkType == 2) {
logger.info("区经变更为导购,解绑:{}", clerkId);
//解绑
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null);
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null,null);
}
}
}
......@@ -552,7 +537,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
if (flag) {
String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId());
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId(),oldRelationDTO.getWxEnterpriseId());
// 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
......@@ -563,7 +548,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
} else {
String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null);
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null,null);
// 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
......
package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
......@@ -16,24 +33,14 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
import cn.hutool.core.collection.CollectionUtil;
@Service
public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService {
......@@ -64,24 +71,12 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
@Override
public List<StaffDepartmentRelatedDTO> listByDepartmentIds(List<String> departmentIds) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedMapper.listByDepartmentIds(departmentIds);
List<StaffDepartmentRelatedDTO> resultList = EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
return resultList;
}
@Override
public void updateById(StaffDepartmentRelatedDTO dto) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto);
staffDepartmentRelatedMapper.updateByPrimaryKeySelective(tab);
}
@Override
public void deleteCode(StaffDepartmentRelatedDTO dto) {
staffDepartmentRelatedMapper.deleteCode(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto));
}
@Override
public StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getById(staffDepartmentRelatedId);
if (Objects.isNull(tab)) {
......@@ -112,30 +107,10 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
@Override
public StaffDepartmentRelatedDTO getOneByClerkCodeAndDepartmentId(String clerkCode, String departmentId) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getDepartmentIdAndCode(departmentId, clerkCode);
if (tab == null) {
return null;
}
StaffDepartmentRelatedDTO dto = EntityUtil.changeEntity(StaffDepartmentRelatedDTO.class, tab);
return dto;
}
@Override
public StaffDepartmentRelatedDTO getOneByStaffIdAndDepartmentId(String staffId, String departmentId) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getDepartmentIdAndStaffId(departmentId, staffId);
if (tab == null) {
return null;
}
StaffDepartmentRelatedDTO dto = EntityUtil.changeEntity(StaffDepartmentRelatedDTO.class, tab);
return dto;
}
@Override
public Map<String, String> getWxUserIdByClerkId(String clerkId) {
Map<String, String> map = new HashMap<>();
TabHaobanStaffClerkRelation relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
StaffClerkRelationDTO relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (relation == null) {
return map;
}
......@@ -267,7 +242,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId);
return;
}
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId());
StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return;
......@@ -298,7 +273,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId);
return;
}
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId());
StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return;
......
......@@ -302,12 +302,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxEnterpriseService.update(enterpriseDTO);
}
// 返回true说明已过期
@Override
public boolean enterpriseIsOver(String enterpriseId) {
return haobanIsStop(enterpriseId) ;
}
@Override
public SecretSettingDTO getSecretSetting(String wxEnterpriseId, int secretType, String enterpriseId) {
if (secretType == SecretTypeEnum.MEMBER_WAPP.getVal()) {
......
package com.gic.haoban.manage.service.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
@Component
public class ClerkUtils {
private static ClerkService clerkService;
@Autowired
public void setClerkService(ClerkService clerkService) {
ClerkUtils.clerkService = clerkService;
}
public String getClerkStore(ClerkDTO clerk, String clerkId) {
if (null == clerk) {
clerk = clerkService.getclerkById(clerkId);
}
if (null == clerk) {
return null;
}
if (clerk.getClerkType() != 0 && clerk.getClerkType() != 1) {
return null;
}
return clerk.getStoreId();
}
}
......@@ -97,9 +97,6 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.out.SecretSettingApiService"
ref="secretSettingApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.out.ErrorLogApiService"
ref="errorLogApiServiceImpl" timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.out.WelcomeApiService"
ref="welcomeApiServiceImpl" timeout="10000"/>
......
......@@ -91,13 +91,6 @@
</select>
<update id="deleteCode" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated">
update tab_haoban_staff_department_related
set clerk_code = '',
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select id="listStaffDepartmentByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
......
<?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.TabHaobanErrorLogMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanErrorLog">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId" />
<result column="module_desc" jdbcType="VARCHAR" property="moduleDesc" />
<result column="error_desc" jdbcType="VARCHAR" property="errorDesc" />
<result column="error_flag_id" jdbcType="VARCHAR" property="errorFlagId" />
<result column="error_param" jdbcType="VARCHAR" property="errorParam" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, enterprise_id, module_desc, error_desc, error_flag_id, error_param, remark, create_time,
update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_haoban_error_log
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from tab_haoban_error_log
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.gic.haoban.manage.service.entity.TabHaobanErrorLog" useGeneratedKeys="true">
insert into tab_haoban_error_log (id,enterprise_id, module_desc, error_desc,
error_flag_id, error_param, remark,
create_time, update_time)
values (#{id,jdbcType=BIGINT}, #{enterpriseId,jdbcType=VARCHAR}, #{moduleDesc,jdbcType=VARCHAR}, #{errorDesc,jdbcType=VARCHAR},
#{errorFlagId,jdbcType=VARCHAR}, #{errorParam,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.gic.haoban.manage.service.entity.TabHaobanErrorLog" useGeneratedKeys="true">
insert into tab_haoban_error_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="moduleDesc != null">
module_desc,
</if>
<if test="errorDesc != null">
error_desc,
</if>
<if test="errorFlagId != null">
error_flag_id,
</if>
<if test="errorParam != null">
error_param,
</if>
<if test="remark != null">
remark,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="moduleDesc != null">
#{moduleDesc,jdbcType=VARCHAR},
</if>
<if test="errorDesc != null">
#{errorDesc,jdbcType=VARCHAR},
</if>
<if test="errorFlagId != null">
#{errorFlagId,jdbcType=VARCHAR},
</if>
<if test="errorParam != null">
#{errorParam,jdbcType=VARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanErrorLog">
update tab_haoban_error_log
<set>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="moduleDesc != null">
module_desc = #{moduleDesc,jdbcType=VARCHAR},
</if>
<if test="errorDesc != null">
error_desc = #{errorDesc,jdbcType=VARCHAR},
</if>
<if test="errorFlagId != null">
error_flag_id = #{errorFlagId,jdbcType=VARCHAR},
</if>
<if test="errorParam != null">
error_param = #{errorParam,jdbcType=VARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanErrorLog">
update tab_haoban_error_log
set enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
module_desc = #{moduleDesc,jdbcType=VARCHAR},
error_desc = #{errorDesc,jdbcType=VARCHAR},
error_flag_id = #{errorFlagId,jdbcType=VARCHAR},
error_param = #{errorParam,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
......@@ -445,7 +445,8 @@
<sql id="canAddClerkSql">
tab_haoban_staff_clerk_relation a LEFT JOIN tab_haoban_hm_qrcode b ON a.clerk_id = b.clerk_id and b.hm_type = 1 and b.status_flag in (1,3)
WHERE a.enterprise_id = #{enterpriseId} AND a.status_flag = 1 AND a.open_concat_flag = 1
left join tab_haoban_staff c on a.staff_id = c.staff_id
WHERE a.enterprise_id = #{enterpriseId} AND a.status_flag = 1 AND a.open_concat_flag = 1 and c.status_flag = 1
<if test="null != storeIdList">
and a.store_id in
<foreach collection="storeIdList" item="id" index="index" open="(" close=")" separator=",">
......
import com.gic.haoban.manage.service.entity.TabHaobanErrorLog;
import com.gic.haoban.manage.service.service.ErrorLogService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* desc:
*
* @author: YongEn
* @date: 2022/1/18
**/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class ErrorLogTest {
@Autowired
private ErrorLogService errorLogService;
@Test
public void testSave() {
TabHaobanErrorLog errorLog = new TabHaobanErrorLog();
errorLog.setEnterpriseId("123123");
errorLog.setModuleDesc("haoban-manage3-service");
errorLog.setErrorDesc("测试错误");
errorLog.setErrorFlagId("123123");
errorLog.setErrorParam("{123,123}");
errorLog.setRemark("123123");
errorLogService.save(errorLog);
}
}
......@@ -19,12 +19,11 @@ import com.gic.haoban.manage.web.vo.ClerkVo;
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.*;
import java.util.stream.Collectors;
@RestController
@Deprecated
public class ClerkController extends WebBaseController{
@Autowired
private ClerkService clerkService;
......
package com.gic.haoban.manage.web.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
......@@ -12,15 +24,7 @@ import com.gic.haoban.manage.api.dto.MaterialCategoryDTO;
import com.gic.haoban.manage.api.dto.MaterialDTO;
import com.gic.haoban.manage.api.service.MaterialApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import com.gic.haoban.manage.web.utils.EmojiFilterUtil;
@RestController
public class MaterialController extends WebBaseController {
......@@ -126,6 +130,10 @@ public class MaterialController extends WebBaseController {
materialDTO.setStaffId(login.getClerkId());
materialDTO.setStaffName(login.getClerkName());
String msg = this.checkEmoji(materialDTO.getMaterialContent()) ;
if(null != msg) {
return this.fail(msg) ;
}
String materialTitle = materialDTO.getMaterialTitle();
String categoryId = materialDTO.getCategoryId();
Integer categoryType = materialDTO.getMaterialType();
......@@ -185,6 +193,10 @@ public class MaterialController extends WebBaseController {
materialDTO.setStaffId(login.getClerkId());
materialDTO.setStaffName(login.getClerkName());
String materialId = materialDTO.getMaterialId();
String msg = this.checkEmoji(materialDTO.getMaterialContent()) ;
if(null != msg) {
return this.fail(msg) ;
}
MaterialDTO dto = materialApiService.selectMaterialById(materialId);
if (dto == null) {
return resultResponse(HaoBanErrCode.ERR_2);
......@@ -263,4 +275,18 @@ public class MaterialController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1);
}
public static String checkEmoji(String msg) {
if(StringUtils.isBlank(msg)) {
return null ;
}
String s = EmojiFilterUtil.filterEmoji(msg) ;
if(!msg.equals(s)) {
return "保存失败,不支持特殊表情字符" ;
}
return null ;
}
public static void main(String[] args) {
System.out.println(EmojiFilterUtil.filterEmoji("!@#~!@#¥%……&*&)()——+——+{}“”:?》") );;
}
}
......@@ -313,7 +313,7 @@ public class StaffController extends WebBaseController {
@RequestMapping("del-clerk-relation")
public HaobanResponse delStaffClerkList(String clerkId) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser();
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(login.getClerkId(), clerkId, ChannelCodeEnum.ADMIN_UNBIND.getCode());
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(login.getClerkId(), clerkId, ChannelCodeEnum.ADMIN_UNBIND.getCode(),login.getWxEnterpriseId());
return resultResponse(HaoBanErrCode.ERR_1, b);
}
......@@ -336,7 +336,7 @@ public class StaffController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_10010);
}
List<String> enterpriseIds = list.stream().filter(dto -> {
boolean over = wxEnterpriseApiService.enterpriseIsOver(dto.getEnterpriseId());
boolean over = wxEnterpriseApiService.haobanIsStop(dto.getEnterpriseId());
return !over;
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
......
package com.gic.haoban.manage.web.utils;
public class EmojiFilterUtil {
/**
* 是否包含表情
*/
private static boolean isEmojiCharacter(char codePoint) {
return !((codePoint == 0x0) || (codePoint == 0x9) || (codePoint == 0xA) || (codePoint == 0xD)
|| ((codePoint >= 0x20) && (codePoint <= 0xD7FF)) || ((codePoint >= 0xE000) && (codePoint <= 0xFFFD))
|| ((codePoint >= 0x10000) && (codePoint <= 0x10FFFF)));
}
public static String filterEmoji(String source) {
StringBuilder buf = null;
int len = source.length();
for (int i = 0; i < len; i++) {
char codePoint = source.charAt(i);
if (!isEmojiCharacter(codePoint)) {// 如果不包含 则将字符append
if (buf == null) {
buf = new StringBuilder(source.length());
}
buf.append(codePoint);
} else {
}
}
if (buf == null) {
return source;// 如果没有找到 emoji表情,则返回源字符串
} else {
if (buf.length() == len) {// 这里的意义在于尽可能少的toString,因为会重新生成字符串
buf = null;
return source;
} else {
return buf.toString();
}
}
}
}
......@@ -179,7 +179,46 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-ecm-api</artifactId>
<version>${gic-ecm-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-marketing-api</artifactId>
<version>${gic-marketing-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-marketing-pro-api</artifactId>
<version>${gic-marketing-pro-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-enterprise-operation-api</artifactId>
<version>${gic-enterprise-operation-api}</version>
<exclusions>
<exclusion>
<artifactId>hibernate-validator</artifactId>
<groupId>org.hibernate.validator</groupId>
</exclusion>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-game-api</artifactId>
<version>${gic-game-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-integral-mall-api</artifactId>
<version>${gic-integral-mall-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -36,4 +36,16 @@ public class WebBaseController {
response.setErrorCode(errCode.getCode());
return response;
}
public HaobanResponse success(Object obj) {
return resultResponse(HaoBanErrCode.ERR_1, obj, null);
}
public HaobanResponse fail(String message) {
HaobanResponse response = new HaobanResponse();
response.setMessage(message);
response.setErrorCode(HaoBanErrCode.ERR_OTHER.getCode());
response.setDetailError(message);
return response;
}
}
......@@ -18,10 +18,8 @@ import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService;
import com.gic.haoban.common.anno.HttpLimit;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.AuthRequestWellDoneUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.JwtUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.*;
......
package com.gic.haoban.manage.web.controller.member;
import org.springframework.web.bind.annotation.RestController;
import com.gic.haoban.manage.web.controller.WebBaseController;
@RestController
public class MemberController extends WebBaseController {
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
import java.util.Date;
/**
* @Author guojx
* @Date 2022/3/17 15:23
*/
public class AiMemberLogListVO implements Serializable {
private Long aiLogId;
/**
* 拨打时间 (触达时间)
*/
private Date aiTime;
/**
* 活动名称
*/
private String planName;
/**
* 活动场景
*/
private String activityScene;
/**
* 话术名称(模板名称)
*/
private String aiTemplateName;
public Long getAiLogId() {
return aiLogId;
}
public AiMemberLogListVO setAiLogId(Long aiLogId) {
this.aiLogId = aiLogId;
return this;
}
public Date getAiTime() {
return aiTime;
}
public AiMemberLogListVO setAiTime(Date aiTime) {
this.aiTime = aiTime;
return this;
}
public String getPlanName() {
return planName;
}
public AiMemberLogListVO setPlanName(String planName) {
this.planName = planName;
return this;
}
public String getActivityScene() {
return activityScene;
}
public AiMemberLogListVO setActivityScene(String activityScene) {
this.activityScene = activityScene;
return this;
}
public String getAiTemplateName() {
return aiTemplateName;
}
public AiMemberLogListVO setAiTemplateName(String aiTemplateName) {
this.aiTemplateName = aiTemplateName;
return this;
}
@Override
public String toString() {
return "AiMemberLogListVO{" +
"aiLogId=" + aiLogId +
", aiTime=" + aiTime +
", planName='" + planName + '\'' +
", activityScene='" + activityScene + '\'' +
", aiTemplateName='" + aiTemplateName + '\'' +
'}';
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
public class ClerkListVO implements Serializable {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = -4120100748397513224L;
private String clerkId;
private String clerkName;
private String clerkCode;
public String getClerkId() {
return clerkId;
}
public String getClerkName() {
return clerkName;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
public void setClerkName(String clerkName) {
this.clerkName = clerkName;
}
public String getClerkCode() {
return clerkCode;
}
public void setClerkCode(String clerkCode) {
this.clerkCode = clerkCode;
}
}
package com.gic.haoban.manage.web.vo;
import java.io.Serializable;
public class StoreListVO implements Serializable{
private String storeId ;
private String storeName ;
public String getStoreId() {
return storeId;
}
public String getStoreName() {
return storeName;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
}
......@@ -8,11 +8,24 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban"/>
<!-- 应用名称 -->
<dubbo:application name="haoban-manage3-wx"/>
<dubbo:protocol name="dubbo" port="30010"/>
<dubbo:reference interface="com.gic.member.api.service.GradeService" id="gradeService" />
<dubbo:reference interface="com.gic.ecm.api.service.EcmPlanService" id="ecmPlanService" />
<dubbo:reference interface="com.gic.marketing.api.service.CardExportService" id="cardExportService" />
<dubbo:reference interface="com.gic.marketing.api.service.SmsService" id="smsService" />
<dubbo:reference interface="com.gic.marketing.api.service.WechatMarketingService" id="wechatMarketingService" />
<dubbo:reference interface="com.gic.marketing.pro.api.service.ai.AiMemberLogApiService" id="aiMemberLogApiService" />
<dubbo:reference interface="com.gic.marketing.api.service.CouponCardService" id="couponCardService" />
<dubbo:reference interface="com.gic.game.api.service.GameService" id="gameService" />
<dubbo:reference interface="com.gic.enterprise.service.CustomSettingApiService" id="customSettingApiService" />
<dubbo:reference interface="com.gic.marketing.pro.api.service.game.GameApiService" id="gameApiService" />
<dubbo:reference interface="com.gic.member.api.service.AchievementService" id="achievementService" />
<dubbo:reference interface="com.gic.clerk.api.service.PowerService" id="powerService" />
<dubbo:reference interface="com.gic.integralmall.api.service.IntegralmallService" id="integralmallService" />
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService"
id="staffDepartmentRelatedApiService"/>
......
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