Commit a8267cb7 by 墨竹
parents 02d9a2eb 86b70229
......@@ -3,24 +3,28 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class CommonMQDTO implements Serializable {
/**
* @Fields serialVersionUID : TODO(用一句话描述这个变量表示什么)
*/
private static final long serialVersionUID = -5681421708810402425L;
private int type ;
private String params ;
private int type;
private Object params;
public int getType() {
return type;
}
public String getParams() {
return params;
}
public void setType(int type) {
this.type = type;
}
public void setParams(String params) {
public Object getParams() {
return params;
}
public void setParams(Object params) {
this.params = params;
}
}
......@@ -3,14 +3,12 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
/**
*
* @ClassName: QwFrientNoticeDTO
* @Description: 企微加好友通知
* @author xugh
* @date 2022年8月18日 上午10:31:14
*
* @author xugh
* @ClassName: QwFrientNoticeDTO
* @Description: 企微加好友通知
* @date 2022年8月18日 上午10:31:14
*/
public class QwFrientNoticeDTO implements Serializable{
public class QwFrientNoticeDTO implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -18,14 +16,14 @@ public class QwFrientNoticeDTO implements Serializable{
private String suiteid;
private String memberUnionidRelatedId;
private String memberUnionidRelatedId;
private String memberId;
private String unionid;
private String wxEnterpriseId;
private String enterpriseId;
private Integer statusFlag;
......@@ -33,13 +31,13 @@ public class QwFrientNoticeDTO implements Serializable{
private String externalUserid;
private String wxUserId;
private String selfExternalUserid;
private String externalName;
private String addCreateTime;
private String avatar;
private String welcomeCode;
......@@ -47,8 +45,9 @@ public class QwFrientNoticeDTO implements Serializable{
* 自定义的state参数
*/
private String state;
private String staffId ;
private String staffId;
private String changeType;
public String getStaffId() {
return staffId;
......@@ -138,45 +137,45 @@ public class QwFrientNoticeDTO implements Serializable{
this.suiteid = suiteid;
}
public String getSelfExternalUserid() {
return selfExternalUserid;
}
public String getSelfExternalUserid() {
return selfExternalUserid;
}
public void setSelfExternalUserid(String selfExternalUserid) {
this.selfExternalUserid = selfExternalUserid;
}
public void setSelfExternalUserid(String selfExternalUserid) {
this.selfExternalUserid = selfExternalUserid;
}
public String getExternalName() {
return externalName;
}
public String getExternalName() {
return externalName;
}
public void setExternalName(String externalName) {
this.externalName = externalName;
}
public void setExternalName(String externalName) {
this.externalName = externalName;
}
public String getAddCreateTime() {
return addCreateTime;
}
public String getAddCreateTime() {
return addCreateTime;
}
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime;
}
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime;
}
public String getEnterpriseId() {
return enterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getAvatar() {
return avatar;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getState() {
return state;
......@@ -185,4 +184,12 @@ public class QwFrientNoticeDTO implements Serializable{
public void setState(String state) {
this.state = state;
}
public String getChangeType() {
return changeType;
}
public void setChangeType(String changeType) {
this.changeType = changeType;
}
}
......@@ -12,12 +12,22 @@ public class WxUserAddLogQDTO implements Serializable{
private String unionid;
private Long linkId;
private Long hmId;
// 是否好友删除导购
private boolean delClerkFlag;
private boolean delFlag;
private String externalUserid;
private String staffId;
private String staffName;
private String clerkId;
public boolean isDelClerkFlag() {
return delClerkFlag;
}
public void setDelClerkFlag(boolean delClerkFlag) {
this.delClerkFlag = delClerkFlag;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
......
......@@ -11,7 +11,9 @@ import com.gic.haoban.manage.api.dto.CommonMQDTO;
*
*/
public interface HaobanCommonMQApiService {
public void commonHandler(CommonMQDTO dto) ;
public void putCommonMessage(CommonMQDTO dto);
public void commonHandler(String message);
}
......@@ -23,4 +23,15 @@ public interface HaobanTimerApiService {
*/
public ServiceResponse<Void> deleteTempWxHm(String params) ;
/**
*
* @Title: repairExternalUserId
* @Description: 检查修复外部联系人ID
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
public ServiceResponse<Void> repairExternalUserId(String wxEnterpriseId) ;
}
package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.api.base.commons.JSONResponse;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalUserDTO;
import com.gic.haoban.manage.api.dto.FriendStoreInfoDTO;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.QwFrientNoticeDTO;
import com.gic.haoban.manage.api.dto.*;
import java.util.List;
public interface MemberUnionidRelatedApiService {
......@@ -257,4 +252,14 @@ public interface MemberUnionidRelatedApiService {
void updateSelfExternalUseridById(String selfExternalUserid, String memberUnionidRelatedId);
/**
* 事件订阅test
*
* @param param 参数
* @author mozhu
* @date 2022-09-09 14:18:34
*/
void addDelFriendEventTest(String param);
}
......@@ -41,20 +41,31 @@ public interface StaffClerkRelationApiService {
/**
* 审核绑定
*
* @param staffClerkRelation
* @param optStaffId
* @param channelCode
*/
void delAndInsert(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int channelCode);
/**
* 解绑
*
* @param storeId
* @param clerkCode
* 解绑导购
* @param staffId
* @param clerkId
* @param channelCode
* @return
*/
void delByStoreIdAndCode(String storeId, String clerkCode);
boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode);
/**
* 解绑门店
* @param wxEnterpriseId
* @param storeId
* @param staffId
* @param channelCode
*/
void delBindByStoreId(String wxEnterpriseId,String storeId, String staffId,int channelCode);
StaffClerkRelationDTO getOneByClerkId(String clerkId);
......@@ -70,15 +81,6 @@ public interface StaffClerkRelationApiService {
List<StaffClerkRelationDTO> listByStoreId(String storeId);
/**
* 解绑
*
* @param staffId 操作人
* @param clerkId
* @return
*/
boolean unbindByStaffAndClerkId(String staffId, String clerkId);
/**
* 查询导购信息
*
* @param clerkId
......@@ -93,7 +95,7 @@ public interface StaffClerkRelationApiService {
* @return
*/
StaffClerkRelationDTO getByClerkId(String clerkId);
StaffClerkRelationDTO getByClerkIdForWxUserId(String clerkId);
/**
......@@ -104,13 +106,6 @@ public interface StaffClerkRelationApiService {
List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid);
/**
* 删除关联关系
*
* @param clerkId
*/
void delByClerkId(String clerkId);
/**
* 搜索查询列表
*
* @param wxEnterpriseId
......@@ -171,7 +166,7 @@ public interface StaffClerkRelationApiService {
* @author mozhu
* @date 2022-06-20 22:46:46
*/
List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId,String staffId);
List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId);
/**
* 通过职员id 查询职员id列表
......@@ -182,7 +177,7 @@ public interface StaffClerkRelationApiService {
* @author mozhu
* @date 2022-07-07 17:28:01
*/
List<StaffClerkRelationDTO> listClerkIdConcatFlagByClerkIds(List<String> clerkIds,String wxEnterpriseId);
List<StaffClerkRelationDTO> listClerkIdConcatFlagByClerkIds(List<String> clerkIds, String wxEnterpriseId);
/**
......@@ -194,19 +189,18 @@ public interface StaffClerkRelationApiService {
* @date 2022-07-12 18:57:15
*/
void clerkStoreMoveDel(String param);
/**
*
* @Title: getCanAddHmCount
* @Description: 获取能创建活码的导购数量
* @author xugh
* @param enterpriseId
* @param wxEnterpriseId
* @return
* @throws
*/
int getCanAddHmCount(String enterpriseId , String wxEnterpriseId , String clerkId) ;
/**
* @param enterpriseId
* @param wxEnterpriseId
* @return
* @throws
* @Title: getCanAddHmCount
* @Description: 获取能创建活码的导购数量
* @author xugh
*/
int getCanAddHmCount(String enterpriseId, String wxEnterpriseId, String clerkId);
List<String> listStaffIdByWxEnterpriseId(String wxEnterpriseId);
}
......@@ -81,15 +81,4 @@ public interface StaffDepartmentRelatedApiService {
*/
void sendBindAuditMessage(String auditId, String staffId, String clerkId, String reason, boolean isRefuse);
/**
* 新增导购
*
* @param auditId
* @param staffId
* @param clerkId
* @param reason
* @param isRefuse
*/
void sendClerkAddAuditMessage(String auditId, String staffId, String clerkId, String reason, boolean isRefuse);
}
......@@ -232,5 +232,9 @@ public interface WxEnterpriseApiService {
* @throws
*/
void stopHaoban(String enterpriseId) ;
public boolean haobanIsStop(String eid) ;
public String getEndDate(String enterpriseId) ;
}
......@@ -165,5 +165,7 @@ public interface WxEnterpriseRelatedApiService {
* @return
*/
com.gic.api.base.commons.ServiceResponse<EnterpriseDetailDTO> queryEnterpriseDetail(String wxEnterpriseId, String enterpriseId);
public int getRelationCount(String enterpriseId) ;
}
......@@ -22,6 +22,8 @@ public interface PendingTaskApiService {
* @param qdto
*/
public ServiceResponse<Boolean> addPendingTask(PendingTaskQDTO qdto);
public ServiceResponse<Boolean> insertPendingTaskBatch(List<PendingTaskQDTO> qdto);
/**
......
......@@ -26,6 +26,8 @@ public class Config {
private String hmLinkUrl;
@Value("${qywx_hbzs_suite}")
private String qywxHbzsSuite;
@Value("${addDelFriendEvent}")
private String addDelFriendEvent;
public String getHmLinkUrl() {
return hmLinkUrl;
......@@ -90,4 +92,12 @@ public class Config {
public void setQywxHbzsSuite(String qywxHbzsSuite) {
this.qywxHbzsSuite = qywxHbzsSuite;
}
public String getAddDelFriendEvent() {
return addDelFriendEvent;
}
public void setAddDelFriendEvent(String addDelFriendEvent) {
this.addDelFriendEvent = addDelFriendEvent;
}
}
......@@ -61,5 +61,7 @@ public interface MemberUnionidRelatedMapper {
* @date 2022-06-30 17:35:50
*/
List<MemberUnionidRelated> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<MemberUnionidRelated> listByWxEnterpriseIdAndExternalUserId(@Param("wxEnterpriseId") String wxEnterpriseId , @Param("list")List<String> externalUserIdList);
}
\ No newline at end of file
......@@ -10,31 +10,20 @@ import java.util.Set;
@Mapper
public interface PendingTaskMapper {
/**
*/
int deleteByPrimaryKey(Integer id);
/**
*/
int insert(TabPendingTask record);
/**
*/
int insertSelective(TabPendingTask record);
/**
*/
TabPendingTask selectByPrimaryKey(Integer id);
/**
*/
int updateByPrimaryKeySelective(TabPendingTask record);
/**
*/
int updateByPrimaryKey(TabPendingTask record);
/**
* 根据关联id 查询单条
*/
TabPendingTask getByRelationId(String relationId);
......
......@@ -8,18 +8,11 @@ import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
public interface TabHaobanClerkMainStoreRelatedMapper {
int deleteByPrimaryKey(String clerkMainStoreRelatedId);
int insert(TabHaobanClerkMainStoreRelated record);
int insertSelective(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByPrimaryKey(String clerkMainStoreRelatedId);
int updateByPrimaryKeySelective(TabHaobanClerkMainStoreRelated record);
int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId , @Param("storeIdList") List<String> storeIdList);
List<TabHaobanClerkMainStoreRelated> listByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
......
package com.gic.haoban.manage.service.dao.mapper;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.Date;
import java.util.List;
public interface TabHaobanExternalClerkRelatedMapper {
......@@ -146,7 +145,7 @@ public interface TabHaobanExternalClerkRelatedMapper {
List<TabHaobanExternalClerkRelated> listByMemberIdAndWxEnterpriseId(@Param("memberId") String memberId,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId);
/**
* 查询会员在企业下的好友关系
*
......@@ -156,8 +155,9 @@ public interface TabHaobanExternalClerkRelatedMapper {
* @return
*/
List<ExternalClerkRelatedDTO> listByMemberIdList(@Param("memberIdList") List<String> memberIdList,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId);
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId);
/**
* 获取最新的最近的外部联系人
*
......@@ -270,7 +270,7 @@ public interface TabHaobanExternalClerkRelatedMapper {
* 根据企业id分页
*
* @param wxEnterpriseId 企业标识
* @return {@link List<TabHaobanWxEnterprise> }
* @return {@link List<TabHaobanExternalClerkRelated> }
* @author mozhu
* @date 2021-12-13 14:59:03
*/
......@@ -295,7 +295,7 @@ public interface TabHaobanExternalClerkRelatedMapper {
*
* @param wxEnterpriseId 企业id
* @param enterpriseId 商户id
* @param staffId 企业微信导购账号
* @param staffId 企业微信导购账号
* @param clerkId 导购id
* @return
*/
......@@ -315,10 +315,11 @@ public interface TabHaobanExternalClerkRelatedMapper {
* 查询所有好友关系
*
* @param wxEnterpriseId wx企业标识
* @param staffId wx用户id
* @param staffId wx用户id
* @return {@link List}<{@link TabHaobanExternalClerkRelated}>
*/
List<TabHaobanExternalClerkRelated> getByWxUserIdAndWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffId") String staffId);
List<TabHaobanExternalClerkRelated> getByWxUserIdAndWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("staffId") String staffId);
/**
......@@ -355,4 +356,17 @@ public interface TabHaobanExternalClerkRelatedMapper {
int countByMemberId(@Param("memberId") String memberId,
@Param("enterpriseId") String enterpriseId);
List<TabHaobanExternalClerkRelated> listPageByWxenterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("startItem") int startItem, @Param("pageSize") int pageSize);
/**
* 获取所有的好友会员id
*
* @param storeId 存储id
* @param staffId 员工id
* @return {@link List}<{@link String}>
*/
List<String> getByStoreIdAndStaffId(@Param("storeId") String storeId,
@Param("staffId") String staffId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanRepairExternalUser;
/**
*
* @ClassName: TabHaobanRepairExternalUserMapper
* @Description: TODO
* @Author 徐高华
* @Date 2022年09月13日 14:47:15
* @Modify
* @CopyRight
*/
public interface TabHaobanRepairExternalUserMapper {
/**
* 新增
* @Title: insert
* @Description: TODO
* @Param @param TabHaobanRepairExternalUser
*/
public int batchInsert(@Param("list") List<TabHaobanRepairExternalUser> list) ;
/**
* 更新
* @Title: update
* @Description: TODO
* @Param @param TabHaobanRepairExternalUser
* @Throws
*/
public int update() ;
/**
* 通过条件查询
* @Title: listAll
* @Description: TODO
* @Param @param TabHaobanRepairExternalUser
* @Param @return
* @Return List
* @Throws
*/
public List<TabHaobanRepairExternalUser> listAll() ;
}
\ No newline at end of file
......@@ -146,7 +146,7 @@ public interface TabHaobanStaffClerkRelationMapper {
List<MemberStaffRelExtDO> listMemberStaffRelNew(
@Param("memberIdList") List<String> memberIdList,
@Param("clerkIdList") List<String> clerkIdList,
@Param("enterpriseId") String enterpriseId);
@Param("enterpriseId") String enterpriseId,@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 根据导购查询wxuserid
......@@ -252,4 +252,7 @@ public interface TabHaobanStaffClerkRelationMapper {
*/
List<StaffClerkRelationDTO> listClerkIdConcatFlagByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId);
void deleteByEnterpriseId(@Param("enterpriseId") String enterpriseId) ;
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
/**
*
* @ClassName: TabHaobanRepairExternalUser
* @Description: TODO
* @Author 徐高华
* @Date 2022年09月13日 14:47:15
* @Modify
* @CopyRight
*/
public class TabHaobanRepairExternalUser implements Serializable {
private static final long serialVersionUID = 533965353379300L;
private Long id;
private String wxEnterpriseId;
/**当前外部联系人ID*/
private String userId;
/**需要替换联系人ID*/
private String newUserId;
/**11(union表不存在)*/
private Integer statusFlag;
/**需要替换的,需要删除的*/
private String remark;
private String selfUserId ;
public String getSelfUserId() {
return selfUserId;
}
public void setSelfUserId(String selfUserId) {
this.selfUserId = selfUserId;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserId() {
return userId;
}
public void setNewUserId(String newUserId) {
this.newUserId = newUserId;
}
public String getNewUserId() {
return newUserId;
}
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
public Integer getStatusFlag() {
return statusFlag;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getRemark() {
return remark;
}
}
\ No newline at end of file
......@@ -26,8 +26,6 @@ public interface ExternalClerkRelatedService {
*/
void delByUserIdAndExternalUserIdBatch(String wxEnterpriseId, String staffId, List<String> externalUserids);
void delByClerkIdAndStaffId(String clerkId, String staffId);
void delByStoreIdAndStaffId(String storeId, String staffId);
void delByStoreIds(Collection<String> storeIds);
......@@ -38,7 +36,7 @@ public interface ExternalClerkRelatedService {
TabHaobanExternalClerkRelated getByParams(String staffId, String wxEnterpriseId, String name, String createTime);
List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserId(String externalUserid, String staffId);
List<TabHaobanExternalClerkRelated> listByExternalUseridAndWxUserId(String externalUserid, String staffId);
List<TabHaobanExternalClerkRelated> listByExTernalUseridAndWxUserIdAllStatus(String wxEnterpriseId, String externalUserid, String wxUserId);
......@@ -71,4 +69,15 @@ public interface ExternalClerkRelatedService {
*/
String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId);
void repairExternalUserId(String wxEnterpriseId);
/**
* 获取所有的好友会员id
*
* @param storeId 存储id
* @param staffId 员工id
* @return {@link List}<{@link String}>
*/
List<String> getByStoreIdAndStaffId(String storeId,String staffId);
}
......@@ -15,7 +15,7 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId);
/**
* 删除绑定
* 解绑-删除绑定(导购级别)
*
* @param clerkId
* @return
......@@ -23,7 +23,7 @@ public interface StaffClerkRelationService {
boolean delBind(String clerkId, String optStaffId, int channelCode);
/**
* 删除绑定
* 解绑-删除绑定(门店级别)
*
* @param wxEnterpriseId 可以不传
* @param storeIds
......
......@@ -35,4 +35,6 @@ public interface WxEnterpriseRelatedService {
* @return
*/
void setClerkEdit(String id, int clerkEditFlag);
int getRelationCount(String enterpriseId) ;
}
......@@ -6,8 +6,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface WxEnterpriseService {
String add(WxEnterpriseDTO wxDTO);
......
......@@ -73,9 +73,14 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService {
}
entity = logUser;
entity.setLogId(UniqueIdUtils.uniqueLong());
entity.setStatusFlag(2);
// 是否所有好友删除 1是0否
entity.setAllDelFlag(this.isAllDel(externalUserid));
if(qdto.isDelClerkFlag()) {
entity.setStatusFlag(3);
entity.setAddChannel(0);
}else {
entity.setStatusFlag(2);
// 是否所有好友删除 1是0否
entity.setAllDelFlag(this.isAllDel(externalUserid));
}
}
// 新增好友
if (!qdto.isDelFlag()) {
......
......@@ -66,6 +66,10 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
logger.info("切换主门店-刷新企业微信好友:{},{}", staffId, storeId);
//主门店切换需要刷新企业微信好友
TabHaobanStaff staff = staffService.selectById(staffId);
if (staff == null) {
logger.info("员工不存在:{}",staffId);
return;
}
String taskName = "自动刷新企业微信好友(" + staff.getStaffName() + ")";
String taskId = dealSyncOperationApiService.createWxFriendTaskSingle(wxEnterpriseId, taskName, staffId, staff.getStaffName(), SyncTaskTypeEnum.FRIEND_SINGLE.getType());
if (StringUtils.isBlank(taskId)) {
......
......@@ -20,6 +20,7 @@ import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.*;
import com.gic.member.api.service.MemberApiService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
......@@ -60,6 +61,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
private HmClerkRelationApiService hmClerkRelationApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private MemberApiService memberApiService;
@Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
......@@ -80,17 +83,20 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
int i = mapper.changeStatusByClerkId(clerkId, 0);
String enterpriseId = clerkRelation.getEnterpriseId();
List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(clerkRelation.getStoreId(), clerkRelation.getStaffId());
for (String memberId : memberIds) {
//解绑通知会员
memberApiService.updateMemberQywxFlag(enterpriseId, memberId, 0);
memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 0, new Date());
}
//删除 并设置主门店
clerkMainStoreRelatedService.delMainStore(clerkRelation.getStaffId(), clerkRelation.getStoreId(), clerkRelation.getWxEnterpriseId());
boolean b = i >= 0;
if (b) {
//推入日志
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, clerkRelation.getStaffClerkRelationId());
//废弃活码
hmClerkRelationApiService.delByClerkId(clerkId, clerkRelation.getEnterpriseId(), clerkRelation.getWxEnterpriseId(), channelCode);
}
return b;
//推入日志
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, clerkRelation.getStaffClerkRelationId());
//废弃活码
hmClerkRelationApiService.delByClerkId(clerkId, enterpriseId, clerkRelation.getWxEnterpriseId(), channelCode);
return i > 0;
}
@Override
......@@ -102,21 +108,27 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
List<TabHaobanStaffClerkRelation> needUnbind = mapper.listBindByStoreIds(wxEnterpriseId, storeIds);
if (CollectionUtils.isEmpty(needUnbind)) {
logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId);
return true;
}
//清除绑定
mapper.delByStoreIds(storeIds);
//删除主门店
clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds);
List<String> need = needUnbind.stream().map(tab -> tab.getStaffClerkRelationId()).collect(Collectors.toList());
//放入队列
staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need);
for (TabHaobanStaffClerkRelation clerkRelation : needUnbind) {
//废弃活码
hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), clerkRelation.getEnterpriseId(), wxEnterpriseId, channelCode);
String enterpriseId = clerkRelation.getEnterpriseId();
hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode);
//删除好友通知会员
List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(clerkRelation.getStoreId(), clerkRelation.getStaffId());
for (String memberId : memberIds) {
//解绑通知会员
memberApiService.updateMemberQywxFlag(enterpriseId, memberId, 0);
memberApiService.updateMemberQywxEveryOccasion(enterpriseId, memberId, 0, new Date());
}
}
return true;
}
......
......@@ -171,12 +171,6 @@ public class StoreRangeServiceImpl implements StoreRangeService {
* @param addStoreIds
*/
private void dealStoreRelation(List<TabStoreRelation> storeRelations, String enterpriseId, Set<String> delStoreIds, Set<String> addStoreIds) {
// //先删除 后新增
// tabHaobanStoreRelationMapper.deleteAllStoreRalation(enterpriseId);
// //批量插入
// insertStoreRelationBatch(storeRelations);
//先删除 后新增
if (CollectionUtils.isNotEmpty(delStoreIds)) {
logger.info("批量删除门店:{}", JSONObject.toJSONString(delStoreIds));
......
......@@ -68,6 +68,11 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
record.setWxEnterpriseRelatedId(id);
record.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(record);
}
@Override
public int getRelationCount(String enterpriseId) {
List<TabHaobanWxEnterpriseRelated> list = this.mapper.listByEnterpriseId(enterpriseId) ;
return list.size();
}
}
package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
......@@ -13,13 +26,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class WxEnterpriseServiceImpl implements WxEnterpriseService {
......@@ -31,6 +37,8 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Autowired
private WxApplicationMapper wxApplicationMapper ;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ;
@Override
public String add(WxEnterpriseDTO wxDTO) {
......@@ -140,7 +148,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
@Override
public void stopHaoban(String enterpriseId) {
List<TabHaobanWxEnterpriseRelated> list = this.wxEnterpriseRelatedMapper.listByEnterpriseId(enterpriseId) ;
logger.info("停用好办={},list={}",enterpriseId,JSON.toJSONString(list));
logger.info("停用好办={},商户list={}",enterpriseId,JSON.toJSONString(list));
if(CollectionUtils.isEmpty(list)){
return ;
}
......@@ -150,8 +158,9 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
wxEnterpriseIdList.add(wxEnterpriseId) ;
}
this.wxEnterpriseRelatedMapper.deleteByEnterpriseId(enterpriseId) ;
this.tabHaobanStaffClerkRelationMapper.deleteByEnterpriseId(enterpriseId);
Map<String,Object> enMap = new HashMap<>();
enMap.put("enterpriseId", enterpriseId) ;
enMap.put("enterpriseId", enterpriseId + list.get(0).getEnterpriseName()) ;
alert("删除商户企微关联告警", enMap);
for(String wxEnterpriseId : wxEnterpriseIdList) {
List<TabHaobanWxEnterpriseRelated> relationList = this.wxEnterpriseRelatedMapper.listByWxenterpriseId(wxEnterpriseId) ;
......@@ -234,6 +243,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private void alert(String title, Map<String, Object> map) {
String msg = title + JSON.toJSONString(map);
String dingUrl = "https://oapi.dingtalk.com/robot/send?access_token=c38fdc53d26e9a019640755bdada1ce07ebd44a2555d1c8acc299de7a7b5b857";
DingUtils.send(msg, dingUrl, true);
DingUtils.send(msg, dingUrl, false);
}
}
......@@ -95,5 +95,7 @@ public interface PendingTaskService {
*/
public boolean changeByRelationId(PendingTaskBO task);
public void insertPendingTaskBatch(List<PendingTaskBO> list);
}
......@@ -142,4 +142,26 @@ public class PendingTaskServiceImpl implements PendingTaskService {
pendingTaskMapper.updateByPrimaryKeySelective(tabPendingTask);
return true;
}
@Override
public void insertPendingTaskBatch(List<PendingTaskBO> tasks) {
if (CollectionUtils.isEmpty(tasks)) {
return ;
}
List<TabPendingTask> pendingTasks = EntityUtil.changeEntityListByJSON(TabPendingTask.class, tasks);
if(pendingTasks.size()>1000) {
int size=1000;
int len = pendingTasks.size();
int yu = len % size;
int nu = len / size+(yu>0?1:0);
for (int i=0;i<nu;i++) {
int start=i*size;
int end=(start+size)>len?(start+yu):(start+size);
List<TabPendingTask> midTask = pendingTasks.subList(start, end);
pendingTaskMapper.insertBatch(midTask);
}
}else {
pendingTaskMapper.insertBatch(pendingTasks);
}
}
}
......@@ -55,6 +55,16 @@ public class PendingTaskApiServiceImpl implements PendingTaskApiService {
pendingTaskService.addOrUpdateBatchPendingTask(list);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Boolean> insertPendingTaskBatch(List<PendingTaskQDTO> qdto) {
if (CollectionUtils.isEmpty(qdto)) {
return ServiceResponse.success(true);
}
List<PendingTaskBO> list = EntityUtil.changeEntityListByJSON(PendingTaskBO.class, qdto);
pendingTaskService.insertPendingTaskBatch(list);
return ServiceResponse.success(true);
}
@Override
public ServiceResponse<Page<PendingTaskDetailDTO>> pagePendingTask(PendingListQDTO listQDTO, BasePageInfo pageInfo) {
......
......@@ -202,15 +202,11 @@ public class AuditApiServiceImpl implements AuditApiService {
if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab);
}
//解绑日志
StaffClerkRelationDTO relationDTO = staffClerkRelationApiService.getByClerkId(obj.getClerkId());
if (null != relationDTO) {
staffClerkRelationApiService.pushToBindLog(relationDTO.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(), relationDTO.getStaffClerkRelationId());
}
staffClerkRelationApiService.delByClerkId(obj.getClerkId());
staffClerkRelationApiService.unbindByStaffAndClerkId(optStaffId,obj.getClerkId(),ChannelCodeEnum.AUDIT_UNBIND.getCode());
staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, "");
} else if (auditType == AuditType.CLERK_UNBIND.getCode()) {
//解绑申请,无需审核,直接通过
logger.info("解绑申请,无需审核,直接通过");
}
tab.setAuditStatus(1);
auditMapper.updateByPrimaryKeySelective(tab);
......
package com.gic.haoban.manage.service.service.out.impl;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.CommonMQDTO;
import com.gic.haoban.manage.api.service.HaobanCommonMQApiService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.quartz.api.dto.QuartzTaskDTO;
import com.gic.quartz.api.service.QuartzService;
@Service("haobanCommonMQApiService")
public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
private final Logger log = LogManager.getLogger(HaobanCommonMQApiService.class);
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
@Autowired
private QuartzService quartzService ;
@Override
public void commonHandler(CommonMQDTO dto) {
public void putCommonMessage(CommonMQDTO dto) {
String message = JSONObject.toJSONString(dto);
log.info("加入好办通用队列params={}",message);
try {
mqClient.sendCommonMessage("haobanCommonRouter", message,
"com.gic.haoban.manage.api.service.HaobanCommonMQApiService", "commonHandler");
} catch (Exception e) {
log.error("发送MQ异常");
e.printStackTrace();
}
}
@Override
public void commonHandler(String message) {
log.info("接收好办通用队列params={}",message);
CommonMQDTO dto = JSON.parseObject(message, CommonMQDTO.class);
// 好办停用,删除定时
if(dto.getType()==1) {
Map<String,String> map = (Map<String, String>) dto.getParams() ;
String enterpriseId = map.get("enterpriseId") ;
this.deleteQuartz(enterpriseId);
}
}
}
private void deleteQuartz(String enterpriseId) {
if(StringUtils.isBlank(enterpriseId)) {
return ;
}
log.info("删除好办定时eid={}",enterpriseId);
// 日报
QuartzTaskDTO task = new QuartzTaskDTO();
task.setTaskService("com.gic.haoban.app.daily.api.service.DailyReportTaskApiService");
task.setTaskMethod("run");
task.setReferId(enterpriseId);
this.quartzService.delQuartzTask(task);
}
}
......@@ -5,6 +5,7 @@ import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
@Service("haobanTimerApiService")
......@@ -13,10 +14,21 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
@Autowired
private HmQrcodeTempService hmQrcodeTempService ;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService ;
@Override
public ServiceResponse<Void> deleteTempWxHm(String params) {
this.hmQrcodeTempService.deleteForTimer();
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> repairExternalUserId(String wxEnterpriseId) {
this.externalClerkRelatedService.repairExternalUserId(wxEnterpriseId) ;
return ServiceResponse.success();
}
}
......@@ -10,10 +10,7 @@ import com.gic.haoban.app.customer.service.api.service.InnerApiService;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.WxEditType;
import com.gic.haoban.manage.api.enums.*;
import com.gic.haoban.manage.api.service.MessageApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
......@@ -316,7 +313,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());
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId(), ChannelCodeEnum.ADMIN_UNBIND.getCode());
}
}
}
......
......@@ -209,12 +209,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public void delByStoreIdAndCode(String storeId, String clerkCode) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getByCodeAndStoreId(clerkCode, storeId);
//删除绑定关系
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode);
//删除主门店
delSetMainStore(staffClerkRelation, ChannelCodeEnum.SELF_UNBIND.getCode());
public void delBindByStoreId(String wxEnterpriseId,String storeId, String staffId,int channelCode) {
Set<String> needUnBindStoreIds = new HashSet<>();
needUnBindStoreIds.add(storeId);
staffClerkRelationService.delBindByStoreIds(wxEnterpriseId, needUnBindStoreIds, staffId, ChannelCodeEnum.SELF_UNBIND.getCode());
}
@Override
......@@ -236,8 +234,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId) {
return staffClerkRelationService.delBind(clerkId, staffId, ChannelCodeEnum.ADMIN_UNBIND.getCode());
public boolean unbindByStaffAndClerkId(String staffId, String clerkId,int channelCode) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode);
}
@Override
......@@ -280,28 +278,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation, ChannelCodeEnum.AUDIT_UNBIND.getCode());
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation, Integer channelCode) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
String clerkId = staffClerkRelation.getClerkId();
externalClerkRelatedService.delByClerkIdAndStaffId(clerkId, staffId);
//删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
//废弃活码
hmClerkRelationApiService.delByClerkId(clerkId, staffClerkRelation.getEnterpriseId(), wxEnterpriseId, channelCode);
}
@Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
......
......@@ -16,7 +16,6 @@ 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.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
......@@ -49,8 +48,6 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private Config config;
@Autowired
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper;
......@@ -519,27 +516,4 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
}
@Override
public void sendClerkAddAuditMessage(String auditId, String staffId, String clerkId, String reason, boolean isRefuse) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO == null) {
return;
}
StaffDTO staffDTO = staffApiService.selectById(staffId);
//字段
Map<String, String> params = new HashMap<String, String>();
params.put("staffName", staffDTO.getStaffName());
params.put("clerkCode", clerkDTO.getClerkCode());
params.put("reason", reason);
//参数
JSONObject jsonObject = new JSONObject();
jsonObject.put("storeId", clerkDTO.getStoreId());
//发送消息
if (isRefuse) {
NoticeMessageUtil.sendNoticeMessageByStaff(clerkDTO.getEnterpriseId(), staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_REFUSE.getType(), auditId, params, jsonObject);
} else {
NoticeMessageUtil.sendNoticeMessageByStaff(clerkDTO.getEnterpriseId(), staffId, clerkId, NoticeMessageTypeEnum.STORE_ACCOUNT_AGREE.getType(), auditId, params, jsonObject);
}
}
}
......@@ -92,6 +92,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
@Override
public EnterpriseDetailDTO getByEnterpriseId(String wxEnterpriseId, String enterpriseId) {
TabHaobanWxEnterpriseRelated entity = wxEnterpriseRelatedService.getByEnterpriseId(wxEnterpriseId, enterpriseId);
if(null == entity) {
return null ;
}
EnterpriseDetailDTO dto = EntityUtil.changeEntityByJSON(EnterpriseDetailDTO.class, entity);
return dto;
}
......@@ -698,4 +701,9 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
enterpriseDetailDTO.setCustomerPhone(enterprise.getCustomerPhone());
return com.gic.api.base.commons.ServiceResponse.success(enterpriseDetailDTO);
}
@Override
public int getRelationCount(String enterpriseId) {
return this.wxEnterpriseRelatedService.getRelationCount(enterpriseId);
}
}
......@@ -316,6 +316,9 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该活码不存在");
}
Integer hmType = hmQrcodeQDTO.getHmType();
if (hmType == null) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "活码类型为空");
}
List<String> clerkIdList = setStoreClerk(hmQrcodeQDTO, wxEnterpriseId, hmId, hmType, false);
if (CollectionUtils.isEmpty(clerkIdList)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "该导购已经生成过活码或未关联过好办");
......
......@@ -131,7 +131,7 @@
timeout="10000"/>
<dubbo:service interface="com.gic.haoban.manage.api.service.ValidationCodeApiService" ref="validationCodeApiServiceImpl"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DepartmentService" id="gicDepartmentService"/>
<dubbo:reference interface="com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
id="qywxDepartmentApiService"/>
......@@ -192,5 +192,6 @@
<dubbo:reference interface="com.gic.marketing.api.service.AccountOverdueSmsSendService" id="accountOverdueSmsSendService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.thirdparty.api.service.VoiceService" id="voiceService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.thirdparty.api.service.CommunicationService" id="communicationService" timeout="10000" retries="0"/>
<dubbo:reference interface="com.gic.member.api.service.MemberEntranceApiService" id="memberEntranceApiService" timeout="10000" retries="0"/>
</beans>
\ No newline at end of file
......@@ -185,5 +185,16 @@
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select id="listByWxEnterpriseIdAndExternalUserId" resultMap="BaseResultMap">
select
external_userid, self_external_userid from tab_haoban_member_unionid_related
where wx_enterprise_id = #{wxEnterpriseId}
and external_userid in
<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
</mapper>
\ No newline at end of file
......@@ -26,16 +26,8 @@
overdue_time, invalid_time, store_id, clerk_id, finish_time, finish_flag, overdue_flag,
delete_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_pending_task
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_haoban_pending_task
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabPendingTask">
insert into tab_haoban_pending_task (id, enterprise_id, relation_id,
task_type, title, description,
......@@ -50,6 +42,7 @@
#{finishFlag,jdbcType=INTEGER}, #{overdueFlag,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabPendingTask">
insert into tab_haoban_pending_task
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -222,27 +215,7 @@
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabPendingTask">
update tab_haoban_pending_task
set enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
relation_id = #{relationId,jdbcType=VARCHAR},
business_id = #{businessId,jdbcType=VARCHAR},
task_type = #{taskType,jdbcType=INTEGER},
title = #{title,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
task_status_flag = #{taskStatusFlag,jdbcType=INTEGER},
overdue_time = #{overdueTime,jdbcType=TIMESTAMP},
invalid_time = #{invalidTime,jdbcType=TIMESTAMP},
store_id = #{storeId,jdbcType=VARCHAR},
clerk_id = #{clerkId,jdbcType=VARCHAR},
finish_time = #{finishTime,jdbcType=TIMESTAMP},
finish_flag = #{finishFlag,jdbcType=INTEGER},
overdue_flag = #{overdueFlag,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getByRelationId" resultMap="BaseResultMap">
select
......
......@@ -16,16 +16,8 @@
clerk_main_store_related_id, staff_id, wx_enterprise_id, store_id, main_store_flag, fresh_friend_flag,
status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
<include refid="Base_Column_List" />
from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
delete from tab_haoban_clerk_main_store_related
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related (clerk_main_store_related_id, staff_id,
wx_enterprise_id, store_id, main_store_flag, fresh_friend_flag,
......@@ -37,67 +29,7 @@
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
insert into tab_haoban_clerk_main_store_related
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
clerk_main_store_related_id,
</if>
<if test="staffId != null" >
staff_id,
</if>
<if test="wxEnterpriseId != null" >
wx_enterprise_id,
</if>
<if test="storeId != null" >
store_id,
</if>
<if test="mainStoreFlag != null" >
main_store_flag,
</if>
<if test="freshFriendFlag != null">
fresh_friend_flag,
</if>
<if test="statusFlag != null" >
status_flag,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="clerkMainStoreRelatedId != null" >
#{clerkMainStoreRelatedId,jdbcType=VARCHAR},
</if>
<if test="staffId != null" >
#{staffId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null" >
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null" >
#{storeId,jdbcType=VARCHAR},
</if>
<if test="mainStoreFlag != null" >
#{mainStoreFlag,jdbcType=INTEGER},
</if>
<if test="freshFriendFlag != null">
#{freshFriendFlag},
</if>
<if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER},
</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.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
<set >
......@@ -128,18 +60,7 @@
</set>
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated" >
update tab_haoban_clerk_main_store_related
set staff_id = #{staffId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
main_store_flag = #{mainStoreFlag,jdbcType=INTEGER},
fresh_friend_flag = #{freshFriendFlag,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where clerk_main_store_related_id = #{clerkMainStoreRelatedId,jdbcType=VARCHAR}
</update>
<select id="selectByWxEnterpriseIdAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
......
......@@ -652,6 +652,8 @@
</if>
order by create_time desc limit 1
</select>
<select id="countByMemberId" resultType="int">
select count(*)
from tab_haoban_external_clerk_related
......@@ -659,5 +661,20 @@
and member_id = #{memberId}
and status_flag = 1
</select>
<select id="listPageByWxenterpriseId" resultMap="BaseResultMap">
select DISTINCT(external_user_id) from tab_haoban_external_clerk_related where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
limit ${startItem},${pageSize}
</select>
<select id="getByStoreIdAndStaffId" resultType="java.lang.String">
select member_id
from tab_haoban_external_clerk_related
where store_id = #{storeId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag in (1, 3, 4)
</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.TabHaobanRepairExternalUserMapper">
<resultMap type="com.gic.haoban.manage.service.entity.TabHaobanRepairExternalUser" id="result-map-tabHaobanRepairExternalUser">
<result column="id" property="id"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="user_id" property="userId"/>
<result column="new_user_id" property="newUserId"/>
<result column="status_flag" property="statusFlag"/>
<result column="remark" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
wx_enterprise_id,
user_id,
new_user_id,
status_flag,
remark , self_user_id
</sql>
<insert id="batchInsert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanRepairExternalUser">
INSERT INTO tab_haoban_repair_external_user(
id ,
wx_enterprise_id,
user_id,
new_user_id,
status_flag,
remark , self_user_id
)VALUES
<foreach collection= "list" item="item" separator=",">
( #{item.id} , #{item.wxEnterpriseId,jdbcType=CHAR},
#{item.userId,jdbcType=VARCHAR},
#{item.newUserId,jdbcType=VARCHAR},
#{item.statusFlag,jdbcType=INTEGER},
#{item.remark,jdbcType=VARCHAR} , #{item.selfUserId}
)
</foreach>
</insert>
<!-- ==================更新 ========== -->
<update id="updateByPrimaryKey" parameterType="tabHaobanRepairExternalUser">
<![CDATA[
UPDATE tab_haoban_repair_external_user SET
status_flag=#{statusFlag,jdbcType=INTEGER},
remark=#{remark,jdbcType=VARCHAR}
id = #{id}
]]>
</update>
<select id="listAll" parameterType="tabHaobanRepairExternalUser" resultMap="result-map-tabHaobanRepairExternalUser">
select * from tab_haoban_repair_external_user
</select>
</mapper>
\ No newline at end of file
......@@ -24,7 +24,7 @@
from tab_haoban_staff_clerk_relation
where staff_clerk_relation_id = #{staffClerkRelationId,jdbcType=VARCHAR}
</select>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation">
insert into tab_haoban_staff_clerk_relation (staff_clerk_relation_id, staff_id, wx_enterprise_id,
enterprise_id, store_id,
......@@ -194,9 +194,10 @@
where clerk_id = #{clerkId,jdbcType=VARCHAR}
and status_flag=1 order by create_time desc limit 1
</select>
<select id="getByClerkIdForWxUserId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO" parameterType="java.lang.String">
<select id="getByClerkIdForWxUserId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"
parameterType="java.lang.String">
select
a.staff_clerk_relation_id staffClerkRelationId,
a.staff_id staffId,
......@@ -212,7 +213,7 @@
left join tab_haoban_staff b on b.staff_id = a.staff_id
where a.clerk_id = #{clerkId,jdbcType=VARCHAR} and a.status_flag=1
</select>
<select id="getByClerkIdNoStatus" resultMap="BaseResultMap" parameterType="java.lang.String">
select
......@@ -262,8 +263,8 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
</select>
<select id="lisByStaffId" resultMap="BaseResultMap">
<select id="lisByStaffId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
......@@ -271,15 +272,15 @@
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
<if test="null != storeIdList">
and store_id in
<foreach collection="storeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="null != storeIdList">
and store_id in
<foreach collection="storeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by create_time desc
</select>
<select id="pageByWxEnterpriseId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
......@@ -287,7 +288,7 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
</select>
<select id="listBindByStoreId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select
a.staff_clerk_relation_id staffClerkRelationId,
......@@ -369,30 +370,31 @@
</select>
<select id="listMemberStaffRelNew" resultType="com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO">
select * from (
select ecr.member_id as memberId,
ecr.external_user_id as memberExternalUserId,
scr.staff_id as staffId,
scr.clerk_id as staffClerkId
from tab_haoban_external_clerk_related as ecr
left join
(select b.staff_id,
a.clerk_id
from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id and b.status_flag = 1
where a.clerk_id in
<foreach collection="clerkIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and a.status_flag = 1
group by a.staff_id, a.clerk_id) as scr on scr.staff_id = ecr.staff_id
where ecr.status_flag = 1
and ecr.enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and ecr.member_id in
<foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
) t where t.staffId is not null
select * from (
select ecr.member_id as memberId,
ecr.external_user_id as memberExternalUserId,
scr.staff_id as staffId,
scr.clerk_id as staffClerkId
from tab_haoban_external_clerk_related as ecr
left join
(select b.staff_id,
a.clerk_id
from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id and b.status_flag = 1
where a.clerk_id in
<foreach collection="clerkIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and a.status_flag = 1
group by a.staff_id, a.clerk_id) as scr on scr.staff_id = ecr.staff_id
where ecr.status_flag = 1
and ecr.enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and ecr.wx_enterprise_id=#{wxEnterpriseId}
and ecr.member_id in
<foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
) t where t.staffId is not null
</select>
......@@ -534,4 +536,9 @@
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<update id="deleteByEnterpriseId">
update tab_haoban_staff_clerk_relation set status_flag = 0 , update_time=now() where enterprise_id = #{enterpriseId}
</update>
</mapper>
\ No newline at end of file
import java.util.Arrays;
import java.util.List;
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;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
......@@ -7,25 +16,18 @@ import com.gic.haoban.manage.api.dto.hm.HmGroupQueryDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO;
import com.gic.haoban.manage.api.dto.hm.HmWelcomeRelationDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeRelationQDTO;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.service.hm.HmWelcomeRelationApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
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;
import java.util.Arrays;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
......@@ -42,12 +44,20 @@ public class HmPageServiceTest {
@Autowired
private HmWelcomeRelationApiService welcomeRelationApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService ;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService ;
@Test
public void test(){
HmPageQDTO pageQDTO = new HmPageQDTO();
this.externalClerkRelatedService.repairExternalUserId("218a8a6c2ca14e28a1053f541be0e49d,ca66a01b79474c40b3e7c7f93daf1a3b");
// this.wxEnterpriseApiService.stopHaoban("ff80808182c3a46b0182c3a4ea7d0000");
/* HmPageQDTO pageQDTO = new HmPageQDTO();
pageQDTO.setPageSearchText("MB01419872763172380673");
ServiceResponse<Page<HmPageDTO>> pageServiceResponse = pageService.queryPageList(pageQDTO);
ServiceResponse<Page<HmPageDTO>> pageServiceResponse = pageService.queryPageList(pageQDTO);*/
}
......
......@@ -471,6 +471,11 @@ public class LoginController extends WebBaseController {
logger.info("切换商户失败,gic账号不存在,eid={},phone={}", enterpriseId, phoneNumber);
return this.fail("切换商户失败,gic账号不存在");
}
String endMessage = wxEnterpriseApiService.getEndDate(enterpriseId);
if (StringUtils.isNotBlank(endMessage)) {
logger.info("切换商户失败,商户已过期,eid={},phone={}", enterpriseId, phoneNumber);
return this.fail(endMessage);
}
loginUser.setEnterpriseId(enterpriseId);
loginUser.setClerkId(clerk.getClerkId());
loginUser.setClerkName(clerk.getClerkName());
......@@ -482,11 +487,6 @@ public class LoginController extends WebBaseController {
loginUser.setClerkPhone(clerk.getPhoneNumber()) ;
AuthWebRequestUtil.setSessionUser(loginUser);
AuthWebRequestUtil.setAppLoginUser(token, loginUser);
boolean flag = wxEnterpriseApiService.enterpriseIsOver(enterpriseId);
if (flag) {
logger.info("切换商户失败,商户已过期,eid={},phone={}", enterpriseId, phoneNumber);
return this.fail("切换商户失败,商户已过期");
}
return resultResponse(HaoBanErrCode.ERR_1, false);
}
......
......@@ -275,7 +275,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);
boolean b = staffClerkRelationApiService.unbindByStaffAndClerkId(login.getClerkId(), clerkId,ChannelCodeEnum.ADMIN_UNBIND.getCode());
return resultResponse(HaoBanErrCode.ERR_1, b);
}
......
......@@ -110,7 +110,7 @@ public class ClerkController extends WebBaseController {
if (clerk != null) {
long memberCount = distributeApiService.getClerkMemberCount(staffClerkRelationDTO.getEnterpriseId(), clerk.getClerkId(), storeId);
logger.info("【获取会员数】enterpriseId={},clerkId={},storeId={},memberCount={}", staffClerkRelationDTO.getEnterpriseId(), clerk.getClerkId(), storeId, memberCount);
staffDTO.setMemberCount(Convert.toInt(memberCount,0));
staffDTO.setMemberCount(Convert.toInt(memberCount, 0));
staffDTO.setClerkId(clerk.getClerkId());
staffDTO.setClerkCode(clerk.getClerkCode());
resultList.add(EntityUtil.changeEntityNew(StaffVO.class, staffDTO));
......@@ -646,10 +646,10 @@ public class ClerkController extends WebBaseController {
return !over;
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
if(CollectionUtils.isEmpty(storeIds)) {
return resultResponse(HaoBanErrCode.ERR_1, new ArrayList<>());
if (CollectionUtils.isEmpty(storeIds)) {
return resultResponse(HaoBanErrCode.ERR_1, new ArrayList<>());
}
logger.info("查询到企微门店数={},{}",storeIds.size(),storeIds);
logger.info("查询到企微门店数={},{}", storeIds.size(), storeIds);
List<ClerkDTO> clerkList = clerkNewService.listClerkByEnterpriseIdAndSearchAndClerkType(enterpriseIdList, storeIds, keyword);
List<ClerkStoreVO> clerkStoreList = buildClerkRelation(clerkList, enterpriseIdList);
return resultResponse(HaoBanErrCode.ERR_1, clerkStoreList);
......@@ -919,9 +919,7 @@ public class ClerkController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_111145);
}
staffClerkRelationApiService.delByStoreIdAndCode(storeId, clerkCode);
//加入日志
staffClerkRelationApiService.pushToBindLog(staffClerkRelation.getStaffId(), clerkId, BindTypeEnum.UNBIND.getVal(), ChannelCodeEnum.SELF_UNBIND.getCode(), staffClerkRelation.getStaffClerkRelationId());
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId, ChannelCodeEnum.SELF_UNBIND.getCode());
return resultResponse(HaoBanErrCode.ERR_1);
}
......@@ -1014,7 +1012,7 @@ public class ClerkController extends WebBaseController {
if (staffRelation == null) {
return resultResponse(HaoBanErrCode.ERR_10006);
}
// staffApiService.wxGetAdd(staffRelation.getWxUserId(), wxEnterpriseId);
// staffApiService.wxGetAdd(staffRelation.getWxUserId(), wxEnterpriseId);
String staffId = staffRelation.getStaffId();
StaffDTO staff = staffApiService.selectById(staffId);
if (staff == null) {
......@@ -1217,14 +1215,14 @@ public class ClerkController extends WebBaseController {
if (StringUtils.isNotBlank(wxOpenId)) {
return RestResponse.successResult(wxOpenId);
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
int code = HaoBanErrCode.ERR_400002.getCode();
return RestResponse.failure(String.valueOf(code), HaoBanErrCode.ERR_400002.getMsg());
}
String wxUserId = staffDTO.getWxUserId();
if(qwDTO.needOpenUserId3th()) {
wxUserId = staffDTO.getWxOpenUseId() ;
if (qwDTO.needOpenUserId3th()) {
wxUserId = staffDTO.getWxOpenUseId();
}
String openid = qywxUserApiService.getSelfOpenIdByUserId(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId);
if (StringUtils.isBlank(openid)) {
......
......@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.dubbo.common.utils.CollectionUtils;
import com.alibaba.fastjson.JSON;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil;
......@@ -105,49 +106,35 @@ public class StoreController extends WebBaseController {
logger.info("没有关联任何商户:{}", wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
List<String> enterpriseIdList = enterpriseList.stream().filter(dto->{
String enterpriseId = dto.getEnterpriseId() ;
return !this.wxEnterpriseApiService.haobanIsStop(enterpriseId);
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(enterpriseIdList)) {
logger.info("没有关联任何商户或商户都已停用:{}", wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
Map<String, EnterpriseDetailDTO> enterpriseTypeMap = enterpriseList.stream().collect(Collectors.toMap(dto -> dto.getEnterpriseId(), dto -> dto));
List<String> enterpriseIdList = enterpriseList.stream().map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
List<StaffClerkRelationDTO> bindRelationList = staffClerkRelationApiService.listBindCodeByStaffId(enterpriseIdList, staffId);
if (CollectionUtils.isEmpty(bindRelationList)) {
logger.info("没有关联任何商户导购:{}", wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
Map<String,Boolean> map = new HashMap<>();
logger.info("成员绑定导购数据={}",JSON.toJSONString(bindRelationList));
for (StaffClerkRelationDTO staffClerkRelationDTO : bindRelationList) {
String storeId = staffClerkRelationDTO.getStoreId() ;
StoreDTO store = storeService.getStore(storeId);
if (store == null) {
continue;
}
String enterprsieId = store.getEnterpriseId() ;
if(StringUtils.isNotBlank(gicEnterpriseId) && !gicEnterpriseId.equals(enterprsieId)) {
logger.info("非当前商户,直接跳过={},{}",gicEnterpriseId,enterprsieId);
String enterpriseId = store.getEnterpriseId();
if(StringUtils.isNotBlank(gicEnterpriseId) && !gicEnterpriseId.equals(enterpriseId)) {
logger.info("非当前商户,直接跳过={},{}",gicEnterpriseId,enterpriseId);
continue ;
}
if(null != map.get(enterprsieId)) {
if(Boolean.FALSE.equals(map.get(enterprsieId))) {
logger.info("该企业过期,{}", enterprsieId);
continue ;
}
}else {
boolean enterpriseOver = isEnterpriseOver(enterprsieId);
if (enterpriseOver) {
logger.info("该企业过期,{}", staffId, enterprsieId);
map.put(enterprsieId, false) ;
continue;
}
/* Integer code = this.enterpriseUseForbidService.selectPermissionStatus(enterprsieId, "haoban-3") ;
logger.info("是否停用={},{}",enterprsieId,code);
// 不能用
if(!(code ==0 || code==1)) {
logger.info("该企业过期,{}", staffId, enterprsieId);
map.put(enterprsieId, false) ;
continue;
}*/
}
map.put(enterprsieId, true) ;
ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode());
ClerkDTO clerk = clerkService.getClerkByClerkCode(enterpriseId, staffClerkRelationDTO.getClerkCode());
if (clerk == null) {
continue;
}
......@@ -159,7 +146,6 @@ public class StoreController extends WebBaseController {
if (wxEnterpriseDTO == null) {
continue;
}
String enterpriseId = clerk.getEnterpriseId();
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (enterpriseDTO == null) {
continue;
......@@ -321,7 +307,7 @@ public class StoreController extends WebBaseController {
AuditDTO auditDTO = auditApiService.findByStoreIdAndChangeField(storeId, changeField);
if (auditDTO == null) {
//为空,可继续提交审核
int i = auditApiService.save(1, wxEnterpriseId, enterpriseId, staffId, storeId, changeField, oldValue, newValue);
auditApiService.save(1, wxEnterpriseId, enterpriseId, staffId, storeId, changeField, oldValue, newValue);
} else {
return resultResponse(HaoBanErrCode.ERR_400018);
}
......@@ -380,23 +366,4 @@ public class StoreController extends WebBaseController {
}
return resultResponse(HaoBanErrCode.ERR_1, vo);
}
public boolean isEnterpriseOver(String enterpriseId) {
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(enterpriseId);
if (enterprise == null || enterprise.getStatus() != 1) {
return true;
}
if (enterprise.getExpireTime() == null) {
if (enterprise.getEnabledState() == null) {
return false;
} else {
return enterprise.getEnabledState() != 1;
}
} else {
return enterprise.getExpireTime().getTime() <= System.currentTimeMillis() || enterprise.getEnabledState() != 1;
}
}
}
package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -12,7 +32,11 @@ import com.gic.dict.api.service.ManagerDictService;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.app.customer.dto.*;
import com.gic.haoban.app.customer.dto.ChildDTO;
import com.gic.haoban.app.customer.dto.CustomerDTO;
import com.gic.haoban.app.customer.dto.FilterListDTO;
import com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO;
import com.gic.haoban.app.customer.dto.StaffOpenRelatedDTO;
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;
......@@ -21,9 +45,29 @@ 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.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalUserDTO;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.MiniprogramSettingDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO;
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.WxEnterpriseRelationDetailDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.GetUserByMemberCodeQo;
......@@ -38,21 +82,9 @@ import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
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.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
@RestController
public class WxEnterpriseInfoController extends WebBaseController {
......@@ -90,8 +122,6 @@ public class WxEnterpriseInfoController extends WebBaseController {
@Autowired
private Config config;
@Autowired
private WxApplicationApiService wxApplicationApiService;
@Autowired
private ClerkMainStoreRelatedApiService clerkMainStoreRelatedApiService;
@Autowired
private CustomerApiService customerApiService;
......@@ -117,6 +147,14 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
String userId = user.getUserid();
String corpId = user.getCorpid();
// 判断好办是否到期
ServiceResponse<Boolean> resp = this.wxEnterpriseApiService.isStopHaoban(corpId);
if (!resp.isSuccess()) {
HaobanResponse response = new HaobanResponse();
response.setErrorCode(-888);
response.setMessage(resp.getMessage());
return response;
}
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId);
StaffDTO loginStaff = null;
if (enterprise != null) {
......
......@@ -13,7 +13,7 @@
<!-- 应用名称 -->
<dubbo:application name="haoban-manage3-wx"/>
<dubbo:protocol name="dubbo" port="30010"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService"
id="staffDepartmentRelatedApiService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/>
......
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