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; package com.gic.haoban.manage.api.dto;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* desc:员工导购id与导购wxUserId实体 * desc:员工导购id与导购wxUserId实体
...@@ -22,14 +23,25 @@ public class ClerkStaffWxUserDTO implements Serializable { ...@@ -22,14 +23,25 @@ public class ClerkStaffWxUserDTO implements Serializable {
* 员工导购id * 员工导购id
*/ */
private String staffClerkId; private String staffClerkId;
private Date addFriendTime ;
public Date getAddFriendTime() {
return addFriendTime;
}
public void setAddFriendTime(Date addFriendTime) {
this.addFriendTime = addFriendTime;
}
public ClerkStaffWxUserDTO() { public ClerkStaffWxUserDTO() {
} }
public ClerkStaffWxUserDTO(String staffId, String staffClerkId, String memberExternalUserId) { public ClerkStaffWxUserDTO(String staffId, String staffClerkId, String memberExternalUserId , Date addFriendTime) {
this.memberExternalUserId = memberExternalUserId; this.memberExternalUserId = memberExternalUserId;
this.staffId = staffId; this.staffId = staffId;
this.staffClerkId = staffClerkId; this.staffClerkId = staffClerkId;
this.addFriendTime = addFriendTime ;
} }
public String getMemberExternalUserId() { public String getMemberExternalUserId() {
......
...@@ -193,6 +193,10 @@ public interface ExternalClerkRelatedApiService { ...@@ -193,6 +193,10 @@ public interface ExternalClerkRelatedApiService {
*/ */
boolean isFriends(String memberId, String clerkId, String enterpriseId); 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) ; List<String> listMemberAndClerk(List<String> memberIdList , List<String> clerkIdList , String enterpriseId) ;
/** /**
......
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO; import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
import java.util.List; import java.util.List;
public interface StaffApiService { public interface StaffApiService {
StaffDTO selectById(String staffId); StaffDTO selectById(String staffId);
List<StaffDTO> listByIds(List<String> staffIds); List<StaffDTO> listByIds(List<String> staffIds);
StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber); StaffDTO selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId); List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId);
Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag, Page<StaffDTO> pageStaff(List<String> departmentId, Integer activeFlag,
String keyword, BasePageInfo pageInfo, Integer relationFlag, String wxEnterpriseId); String keyword, BasePageInfo pageInfo, Integer relationFlag, String wxEnterpriseId);
/** /**
* 保存微信成员 * 保存微信成员
* *
* @param userId * @param userId
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId); ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId);
/** /**
* 新增成员 * 新增成员
* *
* @param userId * @param userId
* @param wxEnterpriseId * @param wxEnterpriseId
*/ */
ServiceResponse wxGetAdd(String userId, String wxEnterpriseId); ServiceResponse wxGetAdd(String userId, String wxEnterpriseId);
/** /**
* 成员修改 * 成员修改
* *
* @param staffDTO * @param staffDTO
* @param departmentIds * @param departmentIds
*/ */
void staffEdit(StaffDTO staffDTO, String departmentIds); void staffEdit(StaffDTO staffDTO, String departmentIds);
/** /**
* 选择用户id和企业标识 * 选择用户id和企业标识
* *
* @param userId 用户id * @param userId 用户id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link StaffDTO } * @return {@link StaffDTO }
* @author mozhu * @author mozhu
* @date 2022-01-13 15:02:22 * @date 2022-01-13 15:02:22
*/ */
StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId); StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
/** /**
* 没手机号的时候需要重新刷 * 没手机号的时候需要重新刷
* *
* @param userId * @param userId
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
StaffDTO getByUserIdAndReflushWhenNoPhone(String userId, String wxEnterpriseId); StaffDTO getByUserIdAndReflushWhenNoPhone(String userId, String wxEnterpriseId);
StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId); StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code); StaffDepartmentRelatedDTO getDepartmentIdAndCode(String departmentId, String code);
void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId); void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId);
List<String> listUnBindClerk(String storeId); List<String> listUnBindClerk(String storeId);
String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO); String insertUserLoginLog(UserLoginLogDTO userLoginLogDTO);
int countByDepartmentIds(List<String> departmentIds); int countByDepartmentIds(List<String> departmentIds);
List<StaffDTO> listByPhoneNumber(String phoneNumber); List<StaffDTO> listByPhoneNumber(String phoneNumber);
/** /**
* 获取成员头像 * 获取成员头像
* *
* @param clerkCode * @param clerkCode
* @param storeId * @param storeId
* @return * @return
*/ */
ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId); ServiceResponse<String> getStaffQrcode(String clerkCode, String storeId);
void wxFristAdd(String userJson, String wxEnterpriseId); void wxFristAdd(String userJson, String wxEnterpriseId);
List<String> listBindStaffId(String storeId); List<String> listBindStaffId(String storeId);
List<StaffClerkRelationDTO> listBindRelationUserId(String storeId); List<StaffClerkRelationDTO> listBindRelationUserId(String storeId);
/** /**
* 激活 * 激活
* *
* @param staffId * @param staffId
* @return * @return
*/ */
boolean activeStaff(String staffId); boolean activeStaff(String staffId);
/** /**
* 是否隐私 * 是否隐私
* *
* @param staffId 员工id * @param staffId 员工id
* @return {@link StaffPrivacyUseLogDTO } * @return {@link StaffPrivacyUseLogDTO }
* @author mozhu * @author mozhu
* @date 2021-12-16 19:53:48 * @date 2021-12-16 19:53:48
*/ */
StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId); StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId);
/** /**
* 让员工隐私员工id * 让员工隐私员工id
* *
* @param userId 用户id * @param userId 用户id
* @return {@link StaffPrivacyUseLogDTO } * @return {@link StaffPrivacyUseLogDTO }
* @author mozhu * @author mozhu
* @date 2022-04-14 14:31:39 * @date 2022-04-14 14:31:39
*/ */
StaffPrivacyUseLogDTO getStaffPrivacyByUserId(String userId); StaffPrivacyUseLogDTO getStaffPrivacyByUserId(String userId);
/** /**
* 用户id wx企业id列表 * 用户id wx企业id列表
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param pageNum 页面num * @param pageNum 页面num
* @param pageSize 页面大小 * @param pageSize 页面大小
* @return {@link List<StaffDTO> } * @return {@link List<StaffDTO> }
* @author mozhu * @author mozhu
* @date 2022-02-25 09:40:15 * @date 2022-02-25 09:40:15
*/ */
Page<StaffDTO> listUserIdByWxEnterpriseId(String wxEnterpriseId, Integer pageNum, Integer pageSize); Page<StaffDTO> listUserIdByWxEnterpriseId(String wxEnterpriseId, Integer pageNum, Integer pageSize);
/** /**
* desc: 查询当前品牌所有员工 * desc: 查询当前品牌所有员工
* *
* @param wxEnterpriseId * @param wxEnterpriseId
* @return : {@link List< StaffDTO>} * @return : {@link List< StaffDTO>}
* @author : YongEn * @author : YongEn
* @date : 2022/3/23 * @date : 2022/3/23
*/ */
List<StaffDTO> listAllStaffByWxEnterpriseId(String wxEnterpriseId); List<StaffDTO> listAllStaffByWxEnterpriseId(String wxEnterpriseId);
/** /**
* 通过开放用户id和wx企业id列表 * 通过开放用户id和wx企业id列表
* *
* @param openUserIds 开放的用户id * @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link List<StaffDTO> } * @return {@link List<StaffDTO> }
* @author mozhu * @author mozhu
* @date 2021-12-21 17:23:36 * @date 2021-12-21 17:23:36
*/ */
List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId); List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId);
/** /**
* 更新开放用户id,用户id * 更新开放用户id,用户id
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id * @param wxUserId wx用户id
* @param wxOpenUseId wx开放使用id * @param wxOpenUseId wx开放使用id
* @return int * @return int
* @author mozhu * @author mozhu
* @date 2021-12-21 19:53:30 * @date 2021-12-21 19:53:30
*/ */
int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId); int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId);
/** /**
* 更新开放id员工id * 更新开放id员工id
* *
* @param staffId 员工id * @param staffId 员工id
* @param openId 开放id * @param openId 开放id
* @return int * @return int
*/ */
int updateOpenIdByStaffId(String staffId, String openId); int updateOpenIdByStaffId(String staffId, String openId);
/** /**
* 更新二维码通过员工id * 更新二维码通过员工id
* *
* @param staffId 员工id * @param staffId 员工id
* @param qrCode 二维码 * @param qrCode 二维码
* @return int * @return int
*/ */
int updateQrCodeByStaffId(String staffId, String qrCode); int updateQrCodeByStaffId(String staffId, String qrCode);
/** /**
* 获取职员id二维码 * 获取职员id二维码
* *
* @param clerkId 职员id * @param clerkId 职员id
* @return {@link StaffQrCodeDTO} * @return {@link StaffQrCodeDTO}
*/ */
StaffQrCodeDTO getQrCodeByClerkId(String clerkId); StaffQrCodeDTO getQrCodeByClerkId(String clerkId);
/** /**
* 导购gic门店和好办企业门店交集 * 导购gic门店和好办企业门店交集
* 所有门店返回 -1 * 所有门店返回 -1
* *
* @param clerkId 职员id * @param clerkId 职员id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }> * @return {@link List }<{@link String }>
* @author mozhu * @author mozhu
* @date 2022-06-01 11:04:40 * @date 2022-06-01 11:04:40
*/ */
List<String> getHaoBanStoreIdsRolesByClerkId(String clerkId, String wxEnterpriseId); List<String> getHaoBanStoreIdsRolesByClerkId(String clerkId, String wxEnterpriseId);
/** /**
* 门店筛选器id和好办企业门店交集 * 门店筛选器id和好办企业门店交集
* *
* @param storeWidgetId 存储部件id * @param storeWidgetId 存储部件id
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识 * @param enterpriseId 企业标识
* @return {@link List }<{@link String }> * @return {@link List }<{@link String }>
* @author mozhu * @author mozhu
* @date 2022-05-31 09:35:42 * @date 2022-05-31 09:35:42
*/ */
List<String> getHaoBanStoreRolesByStoreWidgetId(String storeWidgetId, String wxEnterpriseId, String enterpriseId); List<String> getHaoBanStoreRolesByStoreWidgetId(String storeWidgetId, String wxEnterpriseId, String enterpriseId);
/** /**
* 该门店好办是否有权限 true有,false 否 * 该门店好办是否有权限 true有,false 否
* *
* @param storeId 存储id * @param storeId 存储id
* @param enterpriseId 企业标识 * @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return boolean * @return boolean
* @author mozhu * @author mozhu
* @date 2022-05-18 14:19:11 * @date 2022-05-18 14:19:11
*/ */
boolean isFlagByStoreIdAndEnterpriseId(String storeId, String enterpriseId, String wxEnterpriseId); boolean isFlagByStoreIdAndEnterpriseId(String storeId, String enterpriseId, String wxEnterpriseId);
/** /**
* 是否超级管理员 true是 * 是否超级管理员 true是
* *
* @param clerkId 职员id * @param clerkId 职员id
* @return boolean * @return boolean
* @author mozhu * @author mozhu
* @date 2022-05-27 09:43:00 * @date 2022-05-27 09:43:00
*/ */
boolean isSuperAdmin(String clerkId); boolean isSuperAdmin(String clerkId);
/** /**
* 获取到好办的企业门店id * 获取到好办的企业门店id
* *
* @param enterpriseId 企业标识 * @param enterpriseId 企业标识
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }> * @return {@link List }<{@link String }>
* @author mozhu * @author mozhu
* @date 2022-05-30 11:46:08 * @date 2022-05-30 11:46:08
*/ */
List<String> getHaoBanStoreRolesByEnterpriseId(String enterpriseId, String wxEnterpriseId); List<String> getHaoBanStoreRolesByEnterpriseId(String enterpriseId, String wxEnterpriseId);
/** /**
* *
* 获取区经管辖门店数量 * 获取区经管辖门店数量
* *
* @param wxEnterpriseId wx企业标识 * @param wxEnterpriseId wx企业标识
* @param clerkId 职员id * @param clerkId 职员id
* @return int * @return int
*/ */
StoreRoleDTO getCountHaoBanStoreIdsByClerkId(String clerkId, String wxEnterpriseId); StoreRoleDTO getCountHaoBanStoreIdsByClerkId(String clerkId, String wxEnterpriseId);
/** /**
* 是否店长权限 true 是 * 是否店长权限 true 是
* @param clerkId * @param clerkId
* @return * @return
*/ */
boolean isManager(String clerkId); boolean isManager(String clerkId);
/**
/** *
* 绑定的员工列表 * @Title: isEnterpriseManager
* * @Description: 是否是区经
* @param storeIds 存储id * @author xugh
* @param wxEnterpriseId wx企业标识 * @param clerkId
* @return {@link List }<{@link StaffDTO }> * @return
* @author mozhu * @throws
* @date 2022-10-21 00:25:46 */
*/ com.gic.api.base.commons.ServiceResponse<Boolean> isEnterpriseManager(String clerkId) ;
List<StaffDTO> listBindStoreIds(List<String> storeIds,String wxEnterpriseId);
}
/**
* 绑定的员工列表
*
* @param storeIds 存储id
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link StaffDTO }>
* @author mozhu
* @date 2022-10-21 00:25:46
*/
List<StaffDTO> listBindStoreIds(List<String> storeIds,String wxEnterpriseId);
}
...@@ -56,7 +56,7 @@ public interface StaffClerkRelationApiService { ...@@ -56,7 +56,7 @@ public interface StaffClerkRelationApiService {
* @param channelCode * @param channelCode
* @return * @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 { ...@@ -82,8 +82,6 @@ public interface StaffClerkRelationApiService {
*/ */
List<StaffClerkRelationDTO> listByStoreId(String storeId); List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds);
/** /**
* 查询导购信息 * 查询导购信息
* @param storeId * @param storeId
......
...@@ -10,8 +10,6 @@ public interface StaffDepartmentRelatedApiService { ...@@ -10,8 +10,6 @@ public interface StaffDepartmentRelatedApiService {
List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId); List<StaffDepartmentRelatedDTO> listByDepartmentId(String departmentId);
List<StaffDepartmentRelatedDTO> listByDepartmentIds(List<String> departmentIds);
List<StaffDepartmentRelatedDTO> listByStaffId(String staffId); List<StaffDepartmentRelatedDTO> listByStaffId(String staffId);
void updateById(StaffDepartmentRelatedDTO dto); void updateById(StaffDepartmentRelatedDTO dto);
...@@ -25,12 +23,6 @@ public interface StaffDepartmentRelatedApiService { ...@@ -25,12 +23,6 @@ public interface StaffDepartmentRelatedApiService {
*/ */
StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId); 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); Map<String, String> getWxUserIdByClerkId(String clerkId);
String getPageUrl(int type, String data); String getPageUrl(int type, String data);
......
...@@ -70,14 +70,6 @@ public interface WxEnterpriseApiService { ...@@ -70,14 +70,6 @@ public interface WxEnterpriseApiService {
List<YwWxEnterpriseDTO> listByIds(Set<String> enterpriseIds); List<YwWxEnterpriseDTO> listByIds(Set<String> enterpriseIds);
/** /**
* 企业是否过期 true是
*
* @param enterpriseId
* @return
*/
boolean enterpriseIsOver(String enterpriseId);
/**
* 获取配置 * 获取配置
* *
* @param wxEnterpriseId * @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 { ...@@ -17,8 +17,6 @@ public interface StaffDepartmentRelatedMapper {
List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId); List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId);
void deleteCode(TabHaobanStaffDepartmentRelated dto);
List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId); List<TabHaobanStaffDepartmentRelated> listStaffDepartmentByStaffId(String staffId);
TabHaobanStaffDepartmentRelated getById(String staffDepartmentRelatedId); 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
...@@ -14,130 +14,69 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -14,130 +14,69 @@ public interface TabHaobanStaffClerkRelationMapper {
TabHaobanStaffClerkRelation selectByPrimaryKey(String staffClerkRelationId); TabHaobanStaffClerkRelation selectByPrimaryKey(String staffClerkRelationId);
List<TabHaobanStaffClerkRelation> listBindCode(@Param("wxEnterpriseId") String wxEnterpriseId, List<StaffClerkRelationDTO> listBindCode(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId, @Param("enterpriseId") String enterpriseId,
@Param("clerkCodeList") Set<String> clerkCodeList); @Param("clerkCodeList") Set<String> clerkCodeList);
List<TabHaobanStaffClerkRelation> listBindCodeByStaffId(@Param("enterpriseIdList") List<String> enterpriseIdList, @Param("staffId") String staffId); List<StaffClerkRelationDTO> listBindCodeByStaffId(@Param("enterpriseIdList") List<String> enterpriseIdList, @Param("staffId") String staffId);
TabHaobanStaffClerkRelation getOneByClerkId(@Param("clerkId") String clerkId); StaffClerkRelationDTO getOneByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId);
/** StaffClerkRelationDTO getByCodeAndEnterpriseId(@Param("clerkCode") String clerkCode, @Param("enterpriseId") String enterpriseId);
* 改变状态 格局clerkId
* List<StaffClerkRelationDTO> listByClerkIds(@Param("clerkIds") List<String> clerkIds, @Param("wxEnterpriseId") String wxEnterpriseId);
* @param clerkId
* @param status StaffClerkRelationDTO getOneByStoreIdAndStaffId(@Param("storeId") String storeId, @Param("staffId") String staffId);
* @return
*/
int changeStatusByClerkId(@Param("clerkId") String clerkId, @Param("status") Integer status); int changeStatusByClerkId(@Param("clerkId") String clerkId, @Param("status") Integer status);
/** /**
* 更新信息 * 更新信息
*
* @param record
* @return
*/ */
int updateByClerkId(TabHaobanStaffClerkRelation record); int updateByClerkId(TabHaobanStaffClerkRelation record);
/** /**
* 格局clerkId 查询staffClerkRelation
*
* @param clerkId
* @param wxEnterpriseId
* @return
*/
TabHaobanStaffClerkRelation getBindByClerkId(@Param("clerkId") String clerkId, @Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaffClerkRelation getByCodeAndEnterpriseId(@Param("clerkCode") String clerkCode, @Param("enterpriseId") String enterpriseId);
/**
* 解绑 * 解绑
*/ */
void delByStoreIdAndCode(@Param("storeId") String storeId, @Param("clerkCode") String clerkCode); void delByStoreIdAndCode(@Param("storeId") String storeId, @Param("clerkCode") String clerkCode);
/**
* 由职员id列表
*
* @param clerkIds 职员id
* @return {@link List<StaffClerkRelationDTO> }
* @author mozhu
* @date 2022-01-13 11:36:11
*/
List<StaffClerkRelationDTO> listByClerkIds(@Param("clerkIds") List<String> clerkIds, @Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanStaffClerkRelation> listByStoreId(@Param("storeId") String storeId);
TabHaobanStaffClerkRelation getOneByStoreIdAndStaffId(@Param("storeId") String storeId, @Param("staffId") String staffId);
/** /**
* 解绑 * 解绑
*/ */
int cleanStaffDepart(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); int cleanStaffDepart(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
TabHaobanStaffClerkRelation getOneBindStoreId(@Param("staffId") String staffId, @Param("storeId") String storeId);
TabHaobanStaffClerkRelation getByClerkId(@Param("clerkId") String clerkId, @Param("wxEnterpriseId") String wxEnterpriseId);
int delByPrimaryKey(@Param("staffClerkRelationId") String staffClerkRelationId); int delByPrimaryKey(@Param("staffClerkRelationId") String staffClerkRelationId);
void delByClerkId(@Param("clerkId") String clerkId); void delByClerkId(@Param("clerkId") String clerkId);
List<TabHaobanStaffClerkRelation> listByEnterpriseIdAndStaffid(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId); List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId);
List<TabHaobanStaffClerkRelation> lisByStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffId") String staffId, @Param("storeIdList") List<String> storeIdList); List<StaffClerkRelationDTO> lisByStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffId") String staffId, @Param("storeIdList") List<String> storeIdList);
TabHaobanStaffClerkRelation getByCodeAndStoreId(@Param("clerkCode") String clerkCode, @Param("storeId") String storeId); StaffClerkRelationDTO getByCodeAndStoreId(@Param("clerkCode") String clerkCode, @Param("storeId") String storeId);
List<String> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId); List<String> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanStaffClerkRelation> pageByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId); List<StaffClerkRelationDTO> pageByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<StaffClerkRelationDTO> listBindByStoreId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("storeId") String storeId);
/** /**
* 授权绑定的列表 * 查询有关联的员工id列表
*
* @param wxEnterpriseId
* @param storeIds
* @return
*/ */
List<TabHaobanStaffClerkRelation> listBindByStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("storeIds") Set<String> storeIds); List<String> listRelationsStaffId(@Param("staffIdList") Set<String> staffIdList);
/** /**
* 授权绑定的列表 * 已使用的门店id列表
*
* @param wxEnterpriseId
* @param storeIds
* @return
*/ */
List<TabHaobanStaffClerkRelation> listBindNotInStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("storeIds") Set<String> storeIds); List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId);
/** /**
* 删除绑定根据门店 * 删除绑定根据门店
*
* @param storeIds
*/ */
void delByStoreIds(@Param("storeIds") Set<String> storeIds); void delByStoreIds(@Param("storeIds") Set<String> storeIds);
/** /**
* 已使用的门店id列表 * 批量查询会员与导购关系并且返回关联信息
*
* @param enterpriseId
*/
List<TabHaobanStaffClerkRelation> listBindStoreIdByEnterpriseId(String enterpriseId);
/**
* 查询有关联的员工id列表
*
* @param staffIdList 员工id列表
* @return {@link List<String>}
* @author: YongEn
*/
List<String> listRelationsStaffId(@Param("staffIdList") Set<String> staffIdList);
/**
* 批量查询会员与导购关系并且返回关联信息(新企业)
*/ */
List<MemberStaffRelExtDO> listMemberStaffRelNew( List<MemberStaffRelExtDO> listMemberStaffRelNew(
@Param("memberIdList") List<String> memberIdList, @Param("memberIdList") List<String> memberIdList,
...@@ -146,77 +85,24 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -146,77 +85,24 @@ public interface TabHaobanStaffClerkRelationMapper {
/** /**
* 根据导购查询wxuserid * 根据导购查询wxuserid
*
* @param clerkIds 职员id
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-07-07 15:26:34
*/ */
List<String> listWxUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds, List<String> listWxUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId , @Param("type") int type);
/**
* 根据导购查询wxopenuserid
*
* @param clerkIds 职员id
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-08-09 00:42:31
*/
List<String> listWxOpenUserIdByClerkIds(@Param("clerkIds") List<String> clerkIds,
@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 通过open userId 查询id
*
* @param wxOpenUserIds wx开放用户id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link StaffClerkRelationDTO }>
* @author mozhu
* @date 2022-08-08 21:51:22
*/
List<StaffClerkRelationDTO> listIdsByWxOpenUserIds(@Param("wxOpenUserIds") List<String> wxOpenUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId);
/** /**
* id wx用户id列表 * id wx用户id列表
*
* @param wxUserIds wx用户id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link StaffClerkRelationDTO }>
* @author mozhu
* @date 2022-08-16 14:35:28
*/ */
List<StaffClerkRelationDTO> listIdsByWxUserIds(@Param("wxUserIds") List<String> wxUserIds, List<StaffClerkRelationDTO> listIdsByWxUserIds(@Param("wxUserIds") List<String> wxUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId); @Param("enterpriseId") String enterpriseId , @Param("type")int type);
/** /**
* 更新联系我状态 * 更新联系我状态
*
* @param openConcatFlag 打开concat国旗
* @param staffClerkRelationId 员工职员关系id
* @return int
* @author mozhu
* @date 2022-07-07 15:32:23
*/ */
int updateOpenConcatFlagById(@Param("openConcatFlag") Integer openConcatFlag, @Param("staffClerkRelationId") String staffClerkRelationId); int updateOpenConcatFlagById(@Param("openConcatFlag") Integer openConcatFlag, @Param("staffClerkRelationId") String staffClerkRelationId);
/** /**
* 通过openuserid 不在范围内 查询id * 通过openuserid 不在范围内 查询id
*
* @param wxOpenUserIds wx开放用户id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link StaffClerkRelationDTO }>
* @author mozhu
* @date 2022-08-08 22:02:18
*/ */
List<StaffClerkRelationDTO> listIdsByNotInWxOpenUserIds(@Param("wxOpenUserIds") List<String> wxOpenUserIds, List<StaffClerkRelationDTO> listIdsByNotInWxOpenUserIds(@Param("wxOpenUserIds") List<String> wxOpenUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
...@@ -225,13 +111,6 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -225,13 +111,6 @@ public interface TabHaobanStaffClerkRelationMapper {
/** /**
* 通过userid 不在范围内 查询id * 通过userid 不在范围内 查询id
*
* @param wxUserIds wx用户id
* @param wxEnterpriseId wx企业标识
* @param enterpriseId 企业标识
* @return {@link List }<{@link StaffClerkRelationDTO }>
* @author mozhu
* @date 2022-08-16 14:45:57
*/ */
List<StaffClerkRelationDTO> listIdsByNotInWxUserIds(@Param("wxUserIds") List<String> wxUserIds, List<StaffClerkRelationDTO> listIdsByNotInWxUserIds(@Param("wxUserIds") List<String> wxUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
...@@ -241,16 +120,12 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -241,16 +120,12 @@ public interface TabHaobanStaffClerkRelationMapper {
/** /**
* 获取区经 * 获取区经
*
* @param enterpriseId 企业标识
* @return int
*/ */
int getBindByManage(@Param("enterpriseId") String enterpriseId); int getBindByManage(@Param("enterpriseId") String enterpriseId);
int getBindByStaffIdAndEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId); int getBindByStaffIdAndEnterpriseId(@Param("enterpriseId") String enterpriseId, @Param("staffId") String staffId);
List<TabHaobanStaffClerkRelation> listManageBindByStaffId(@Param("staffId") String staffId); List<StaffClerkRelationDTO> listManageBindByStaffId(@Param("staffId") String staffId);
List<TabHaobanStaffClerkRelation> listByStoreIds(@Param("storeIds") List<String> storeIds); List<StaffClerkRelationDTO> listByStoreIds(@Param("wxEnterpriseId") String wxEnterpriseId,@Param("storeIds") List<String> storeIds);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.entity.ext; package com.gic.haoban.manage.service.entity.ext;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* desc:会员导购关系扩展实体类 * desc:会员导购关系扩展实体类
...@@ -23,6 +24,16 @@ public class MemberStaffRelExtDO implements Serializable { ...@@ -23,6 +24,16 @@ public class MemberStaffRelExtDO implements Serializable {
* 员工导购id * 员工导购id
*/ */
private String staffClerkId; private String staffClerkId;
private Date addFriendTime ;
public Date getAddFriendTime() {
return addFriendTime;
}
public void setAddFriendTime(Date addFriendTime) {
this.addFriendTime = addFriendTime;
}
public String getMemberId() { public String getMemberId() {
return memberId; 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 { ...@@ -14,7 +14,7 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId); 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 ...@@ -72,17 +72,21 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId, String enterpriseId, Set<String> clerkCodeList) { 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 @Override
public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) { public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCodeByStaffId(enterpriseIdList, staffId)); return mapper.listBindCodeByStaffId(enterpriseIdList, staffId);
} }
@Override @Override
public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId) { public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(oldClerkId, null); TabHaobanStaff staff = this.staffService.selectById(optStaffId) ;
if(null != staff) {
wxEnterpriseId = staff.getWxEnterpriseId() ;
}
StaffClerkRelationDTO clerkRelation = mapper.getOneByClerkId(oldClerkId, wxEnterpriseId);
if (null == clerkRelation) { if (null == clerkRelation) {
logger.info("老的绑定关联不存在,clerkId={}", oldClerkId); logger.info("老的绑定关联不存在,clerkId={}", oldClerkId);
return true; return true;
...@@ -126,13 +130,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -126,13 +130,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
logger.info("没有传门店列表:{}", wxEnterpriseId); logger.info("没有传门店列表:{}", wxEnterpriseId);
return true; 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)) { if (CollectionUtils.isEmpty(needUnbind)) {
logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId); logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId);
return true; return true;
} }
for (TabHaobanStaffClerkRelation staffClerkRelation : needUnbind) { for (StaffClerkRelationDTO staffClerkRelation : needUnbind) {
String enterpriseId = staffClerkRelation.getEnterpriseId(); String enterpriseId = staffClerkRelation.getEnterpriseId();
//删除好友通知会员 //删除好友通知会员
List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(staffClerkRelation.getStoreId(), staffClerkRelation.getStaffId()); List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(staffClerkRelation.getStoreId(), staffClerkRelation.getStaffId());
...@@ -146,7 +152,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -146,7 +152,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds); clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds);
//放入队列 //放入队列
staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need); staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need);
for (TabHaobanStaffClerkRelation clerkRelation : needUnbind) { for (StaffClerkRelationDTO clerkRelation : needUnbind) {
//废弃活码 //废弃活码
String enterpriseId = clerkRelation.getEnterpriseId(); String enterpriseId = clerkRelation.getEnterpriseId();
hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode); hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode);
...@@ -212,13 +218,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -212,13 +218,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) { public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId); return mapper.getOneByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, relation);
} }
@Override @Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) { 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 ...@@ -254,17 +259,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) { public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getOneBindStoreId(staffId, storeId)); return mapper.getOneByStoreIdAndStaffId(storeId,staffId);
} }
@Override @Override
public StaffClerkRelationDTO getByClerkId(String clerkId) { public StaffClerkRelationDTO getByClerkId(String clerkId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByClerkId(clerkId, null)); return mapper.getOneByClerkId(clerkId, null);
} }
@Override @Override
public StaffClerkRelationDTO getByClerkId(String clerkId, String wxEnterpriseId) { 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); return EntityUtil.changeEntityNew(StaffClerkRelationDTO.class, staffClerkRelation);
} }
...@@ -308,19 +313,19 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -308,19 +313,19 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) { public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) {
PageHelper.startPage(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); Page<StaffClerkRelationDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindList), StaffClerkRelationDTO.class);
return retPage; return retPage;
} }
@Override @Override
public List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId) { public List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId) {
return mapper.listBindByStoreId(wxEnterpriseId, storeId); return mapper.listByStoreIds(wxEnterpriseId, Arrays.asList(storeId));
} }
@Override @Override
public List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId) { public List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId) {
List<TabHaobanStaffClerkRelation> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId); List<StaffClerkRelationDTO> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(clerkRelations)) { if (CollectionUtils.isEmpty(clerkRelations)) {
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -339,9 +344,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -339,9 +344,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) { 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 @Override
...@@ -351,9 +356,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -351,9 +356,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) { 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 @Override
...@@ -385,6 +390,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -385,6 +390,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId) { 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 { ...@@ -216,7 +216,7 @@ public class AuditApiServiceImpl implements AuditApiService {
if (StringUtils.isNotBlank(batchId)) { if (StringUtils.isNotBlank(batchId)) {
insertBatchLog(batchId, AuditRsultType.success.getCode(), tab); 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, ""); staffDepartmentRelatedApiService.sendClerkDel(obj.getClerkName(), obj.getClerkCode(), tab.getCommitStoreId(), 1, "");
} else if (auditType == AuditType.CLERK_UNBIND.getCode()) { } 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; ...@@ -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.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.*; 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.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
...@@ -55,7 +54,6 @@ import org.redisson.api.RateType; ...@@ -55,7 +54,6 @@ import org.redisson.api.RateType;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -68,8 +66,6 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -68,8 +66,6 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Autowired @Autowired
private TabHaobanExternalClerkRelatedMapper tabHaobanExternalClerkRelatedMapper; private TabHaobanExternalClerkRelatedMapper tabHaobanExternalClerkRelatedMapper;
@Autowired @Autowired
private MemberUnionidRelatedMapper memberUnionidRelatedMapper;
@Autowired
private TabHaobanStaffClerkRelationMapper staffClerkRelationMapper; private TabHaobanStaffClerkRelationMapper staffClerkRelationMapper;
@Autowired @Autowired
private WxEnterpriseMapper wxEnterriseMapper; private WxEnterpriseMapper wxEnterriseMapper;
...@@ -443,17 +439,32 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -443,17 +439,32 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Override @Override
public boolean isFriends(String memberId, String clerkId, String enterpriseId) { public boolean isFriends(String memberId, String clerkId, String enterpriseId) {
TabHaobanStaffClerkRelation staffClerkRelation = staffClerkRelationMapper.getByClerkId(clerkId,null); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
return false; return false;
} }
String staffId = staffClerkRelation.getStaffId(); 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); TabHaobanExternalClerkRelated externalClerkRelated = tabHaobanExternalClerkRelatedMapper.getByMemberIdAndStaffId(staffId, enterpriseId, memberId);
if (externalClerkRelated == null) { 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 @Override
...@@ -480,7 +491,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -480,7 +491,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
// key-memberId // key-memberId
MemberStaffRelExtDO::getMemberId, MemberStaffRelExtDO::getMemberId,
// value-list // 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添加到集合 // 重复key的value添加到集合
(List<ClerkStaffWxUserDTO> oldList, List<ClerkStaffWxUserDTO> newList) -> { (List<ClerkStaffWxUserDTO> oldList, List<ClerkStaffWxUserDTO> newList) -> {
oldList.addAll(newList); oldList.addAll(newList);
......
...@@ -341,7 +341,7 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -341,7 +341,7 @@ public class MessageApiServiceImpl implements MessageApiService {
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationApiService.listByStaffId(wxEnterpriseId, staffId); List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationApiService.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) { if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : 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; ...@@ -39,7 +39,7 @@ import com.gic.wechat.api.service.qywx.QywxExternalUserService;
public class QwFriendApiServiceImpl implements QwFriendApiService { public class QwFriendApiServiceImpl implements QwFriendApiService {
private static final Logger log = LogManager.getLogger(QwFriendApiService.class); private static final Logger log = LogManager.getLogger(QwFriendApiService.class);
private static final int subjectType = 0 ; private int subjectType = 0 ;
@Autowired @Autowired
private EnterpriseUseForbidService enterpriseUseForbidService; private EnterpriseUseForbidService enterpriseUseForbidService;
...@@ -73,6 +73,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService { ...@@ -73,6 +73,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
public ServiceResponse<Map<String, String>> pendingIdCheck(String enterpriseId, String unionid, String openid, public ServiceResponse<Map<String, String>> pendingIdCheck(String enterpriseId, String unionid, String openid,
String wxaUnionid, String wxaOpenid , boolean setCheckFlag) { String wxaUnionid, String wxaOpenid , boolean setCheckFlag) {
if("ff8080815dacd3a2015dacd3ef5c0000".equals(enterpriseId)) {
subjectType = 1 ;
}
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,setCheckFlag); ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,setCheckFlag);
if (!corpidResp.isSuccess()) { if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage()); return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
...@@ -128,6 +131,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService { ...@@ -128,6 +131,9 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
if (!corpidResp.isSuccess()) { if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage()); return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
} }
if("ff8080815dacd3a2015dacd3ef5c0000".equals(enterpriseId)) {
subjectType = 1 ;
}
String suiteid = config.getWxSuiteid(); String suiteid = config.getWxSuiteid();
WxEnterpriseQwDTO qwDTO = corpidResp.getResult(); WxEnterpriseQwDTO qwDTO = corpidResp.getResult();
String wxEnterpriseId = qwDTO.getWxEnterpriseId(); String wxEnterpriseId = qwDTO.getWxEnterpriseId();
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
...@@ -28,6 +27,7 @@ import com.gic.commons.util.GlobalInfo; ...@@ -28,6 +27,7 @@ import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.GlobalVar; import com.gic.commons.util.GlobalVar;
import com.gic.commons.util.ImageUtil; import com.gic.commons.util.ImageUtil;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO; 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.StoreGroupDTO;
import com.gic.enterprise.api.dto.StoreWidgetDTO; import com.gic.enterprise.api.dto.StoreWidgetDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
...@@ -38,7 +38,16 @@ import com.gic.haoban.base.api.common.ServiceResponse; ...@@ -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.PageUtil;
import com.gic.haoban.common.utils.RolesListUtils; import com.gic.haoban.common.utils.RolesListUtils;
import com.gic.haoban.common.utils.UuidUtil; 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.dto.role.StoreRoleDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
...@@ -69,6 +78,8 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService; ...@@ -69,6 +78,8 @@ import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import cn.hutool.core.collection.CollectionUtil;
@Service @Service
public class StaffApiServiceImpl implements StaffApiService { public class StaffApiServiceImpl implements StaffApiService {
...@@ -803,24 +814,24 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -803,24 +814,24 @@ public class StaffApiServiceImpl implements StaffApiService {
Object cache = RedisUtil.getCache(cacheKey); Object cache = RedisUtil.getCache(cacheKey);
if (cache != null) { if (cache != null) {
List<String> storeList = (List<String>) cache; List<String> storeList = (List<String>) cache;
logger.info("从缓存中获取通道={},数量:{}", cacheKey, storeList.size()); logger.info("从缓存中获取key={},store数量:{}", cacheKey, storeList.size());
return storeList; return storeList;
} }
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if (clerkDTO == null) { if (clerkDTO == null) {
logger.info("导购不存在:clerkId:{}", clerkId); logger.info("导购不存在:clerkId:{},无门店", clerkId);
return Collections.emptyList(); return Collections.emptyList();
} }
String enterpriseId = clerkDTO.getEnterpriseId(); String enterpriseId = clerkDTO.getEnterpriseId();
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId); List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(enterpriseIdStoreIds)) { if (CollectionUtils.isEmpty(enterpriseIdStoreIds)) {
logger.info("好办门店空,eid={}", enterpriseId); logger.info("无好办门店,eid={}", enterpriseId);
return Collections.emptyList(); return Collections.emptyList();
} }
logger.info("好办门店id数量:{}", enterpriseIdStoreIds.size()); logger.info("好办门店数量={}", enterpriseIdStoreIds.size());
List<String> gicStoreIds = getStoreIdList(clerkDTO); List<String> gicStoreIds = getStoreIdList(clerkDTO);
if (CollectionUtils.isEmpty(gicStoreIds)) { if (CollectionUtils.isEmpty(gicStoreIds)) {
logger.info("gic门店为空"); logger.info("gic门店为空");
return Collections.emptyList(); return Collections.emptyList();
} }
if (gicStoreIds.contains("-1")) { if (gicStoreIds.contains("-1")) {
...@@ -840,10 +851,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -840,10 +851,10 @@ public class StaffApiServiceImpl implements StaffApiService {
RedisUtil.setCache(cacheKey, enterpriseIdStoreIds, 10L, TimeUnit.MINUTES); RedisUtil.setCache(cacheKey, enterpriseIdStoreIds, 10L, TimeUnit.MINUTES);
return enterpriseIdStoreIds; return enterpriseIdStoreIds;
} }
logger.info("gic门店数量{}", gicStoreIds.size()); logger.info("gic门店数量={}", gicStoreIds.size());
//取交集 //取交集
List<String> storeList = RolesListUtils.mergeList(enterpriseIdStoreIds, gicStoreIds); 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); RedisUtil.setCache(cacheKey, storeList, 10L, TimeUnit.MINUTES);
return storeList; return storeList;
} }
...@@ -893,14 +904,25 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -893,14 +904,25 @@ public class StaffApiServiceImpl implements StaffApiService {
return storeRoleDTO; return storeRoleDTO;
} }
if (storeIds.contains("-1")) { if (storeIds.contains("-1")) {
logger.info("该导购为超管"); logger.info("该导购为所有门店,clerkId={}",clerkId);
int gicStoreCount = storeWidgetService.getClerkWidgetStore(clerkId); String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId);
storeRoleDTO.setStoreCount(gicStoreCount); 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; return storeRoleDTO;
} }
int size = storeIds.size(); int size = storeIds.size();
storeRoleDTO.setStoreCount(size); storeRoleDTO.setStoreCount(size);
if (size == 1) { if (size >= 1) {
storeRoleDTO.setStoreId(storeIds.get(0)); storeRoleDTO.setStoreId(storeIds.get(0));
} }
return storeRoleDTO; return storeRoleDTO;
...@@ -914,7 +936,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -914,7 +936,6 @@ public class StaffApiServiceImpl implements StaffApiService {
Integer superAdmin = clerkDTO.getSuperAdmin(); Integer superAdmin = clerkDTO.getSuperAdmin();
if (superAdmin != null && superAdmin == 1) { if (superAdmin != null && superAdmin == 1) {
logger.info("gic超管,clerkId:{}", clerkId); logger.info("gic超管,clerkId:{}", clerkId);
//gic超管
return Collections.singletonList("-1"); return Collections.singletonList("-1");
} }
String enterpriseId = clerkDTO.getEnterpriseId(); String enterpriseId = clerkDTO.getEnterpriseId();
...@@ -922,23 +943,22 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -922,23 +943,22 @@ public class StaffApiServiceImpl implements StaffApiService {
if (enterpriseSetting.getEnableAccessControl() != null && enterpriseSetting.getEnableAccessControl() == 1) { if (enterpriseSetting.getEnableAccessControl() != null && enterpriseSetting.getEnableAccessControl() == 1) {
String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId); String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId);
if (StringUtils.isBlank(storeWidgetId)) { if (StringUtils.isBlank(storeWidgetId)) {
logger.info("导购权限不存在"); logger.info("导购无门店权限,门店组件id is null");
return Collections.emptyList(); return Collections.emptyList();
} }
StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidgetBykey(storeWidgetId); StoreWidgetDTO storeWidgetDTO = this.storeWidgetService.getStoreWidgetBykey(storeWidgetId);
if (storeWidgetDTO == null) { if (storeWidgetDTO == null) {
logger.info("导购权限不存在"); logger.info("导购门店权限查不到,storeWidgetId={}",storeWidgetId);
return Collections.emptyList(); return Collections.emptyList();
} }
Integer selectType = storeWidgetDTO.getSelectType(); Integer selectType = storeWidgetDTO.getSelectType();
if (selectType != null && selectType == 0) { if (selectType != null && selectType == 0) {
//gic超管 logger.info("gic超管所有门店,clerkId:{}", clerkId);
logger.info("gic超管,clerkId:{}", clerkId);
return Collections.singletonList("-1"); return Collections.singletonList("-1");
} }
return getStoreWidgetIdStoreIds(storeWidgetId, enterpriseId); return getStoreWidgetIdStoreIds(storeWidgetId, enterpriseId);
} else { } else {
//未开启分权 logger.info("无开启权限 ,所有门店,clerkId={}", clerkId);
return Collections.singletonList("-1"); return Collections.singletonList("-1");
} }
} }
...@@ -948,7 +968,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -948,7 +968,7 @@ public class StaffApiServiceImpl implements StaffApiService {
*/ */
private List<String> getStoreWidgetIdStoreIds(String storeWidgetId, String enterpriseId) { private List<String> getStoreWidgetIdStoreIds(String storeWidgetId, String enterpriseId) {
// 门店id列表 // 门店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)) { if (CollectionUtils.isEmpty(storeIdList)) {
return Collections.emptyList(); return Collections.emptyList();
} }
...@@ -968,6 +988,18 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -968,6 +988,18 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
return false; return false;
} }
@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 @Override
public List<StaffDTO> listBindStoreIds(List<String> storeIds, String wxEnterpriseId) { public List<StaffDTO> listBindStoreIds(List<String> storeIds, String wxEnterpriseId) {
......
...@@ -246,30 +246,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -246,30 +246,17 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public List<StaffClerkRelationDTO> listByStoreId(String storeId) { public List<StaffClerkRelationDTO> listByStoreId(String storeId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreId(storeId); return tabHaobanStaffClerkRelationMapper.listByStoreIds(null,Arrays.asList(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);
} }
@Override @Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode) { public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode,String wxEnterpriseId) {
return staffClerkRelationService.delBind(clerkId, staffId, channelCode, null); return staffClerkRelationService.delBind(clerkId, staffId, channelCode, null,wxEnterpriseId);
} }
@Override @Override
public StaffClerkRelationDTO getOneByClerkId(String clerkId) { public StaffClerkRelationDTO getOneByClerkId(String clerkId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); return tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
StaffClerkRelationDTO result = EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, tab);
return result;
} }
@Override @Override
...@@ -284,13 +271,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -284,13 +271,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId, public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId,String staffId) {
String staffId) { StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
if (tab == null) { if (tab == null) {
return null; return null;
} }
return EntityUtil.changeEntity(StaffClerkRelationDTO.class, tab); return tab;
} }
@Override @Override
...@@ -338,8 +324,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -338,8 +324,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) { public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid); return tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
} }
@Override @Override
...@@ -497,7 +482,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -497,7 +482,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
Integer status = clerkDTO.getStatus(); Integer status = clerkDTO.getStatus();
logger.info("导购删除,clerkId:{},status:{}", clerkId, status); logger.info("导购删除,clerkId:{},status:{}", clerkId, status);
if (!status.equals(1)) { 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) { } else if (type == 2) {
logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId()); logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId());
...@@ -539,7 +524,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -539,7 +524,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else if (clerkType == 2) { } else if (clerkType == 2) {
logger.info("区经变更为导购,解绑:{}", clerkId); 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 ...@@ -552,7 +537,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
if (flag) { if (flag) {
String oldClerkId = oldRelationDTO.getClerkId(); 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 // 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId()); oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId()); oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
...@@ -563,7 +548,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -563,7 +548,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
} else { } else {
String oldClerkId = oldRelationDTO.getClerkId(); 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 // 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId()); oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId()); oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
......
package com.gic.haoban.manage.service.service.out.impl; 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.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; 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.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
...@@ -16,24 +33,14 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil; ...@@ -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.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; 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.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; 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 cn.hutool.core.collection.CollectionUtil;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Service @Service
public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService { public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService {
...@@ -64,24 +71,12 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -64,24 +71,12 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
} }
@Override @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) { public void updateById(StaffDepartmentRelatedDTO dto) {
TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto); TabHaobanStaffDepartmentRelated tab = EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto);
staffDepartmentRelatedMapper.updateByPrimaryKeySelective(tab); staffDepartmentRelatedMapper.updateByPrimaryKeySelective(tab);
} }
@Override @Override
public void deleteCode(StaffDepartmentRelatedDTO dto) {
staffDepartmentRelatedMapper.deleteCode(EntityUtil.changeEntityByJSON(TabHaobanStaffDepartmentRelated.class, dto));
}
@Override
public StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId) { public StaffDepartmentRelatedDTO getByStaffDepartmentRelatedId(String staffDepartmentRelatedId) {
TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getById(staffDepartmentRelatedId); TabHaobanStaffDepartmentRelated tab = staffDepartmentRelatedMapper.getById(staffDepartmentRelatedId);
if (Objects.isNull(tab)) { if (Objects.isNull(tab)) {
...@@ -112,30 +107,10 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -112,30 +107,10 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
} }
@Override @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) { public Map<String, String> getWxUserIdByClerkId(String clerkId) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
TabHaobanStaffClerkRelation relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); StaffClerkRelationDTO relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (relation == null) { if (relation == null) {
return map; return map;
} }
...@@ -267,7 +242,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -267,7 +242,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId); logger.info("店长不存在,发送消息失败{}", storeId);
return; return;
} }
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId()); StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) { if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId()); logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return; return;
...@@ -298,7 +273,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -298,7 +273,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId); logger.info("店长不存在,发送消息失败{}", storeId);
return; return;
} }
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId()); StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) { if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId()); logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return; return;
......
...@@ -302,12 +302,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -302,12 +302,6 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
wxEnterpriseService.update(enterpriseDTO); wxEnterpriseService.update(enterpriseDTO);
} }
// 返回true说明已过期
@Override
public boolean enterpriseIsOver(String enterpriseId) {
return haobanIsStop(enterpriseId) ;
}
@Override @Override
public SecretSettingDTO getSecretSetting(String wxEnterpriseId, int secretType, String enterpriseId) { public SecretSettingDTO getSecretSetting(String wxEnterpriseId, int secretType, String enterpriseId) {
if (secretType == SecretTypeEnum.MEMBER_WAPP.getVal()) { 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 @@ ...@@ -97,9 +97,6 @@
<dubbo:service interface="com.gic.haoban.manage.api.service.out.SecretSettingApiService" <dubbo:service interface="com.gic.haoban.manage.api.service.out.SecretSettingApiService"
ref="secretSettingApiServiceImpl" timeout="10000"/> 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" <dubbo:service interface="com.gic.haoban.manage.api.service.out.WelcomeApiService"
ref="welcomeApiServiceImpl" timeout="10000"/> ref="welcomeApiServiceImpl" timeout="10000"/>
......
...@@ -91,13 +91,6 @@ ...@@ -91,13 +91,6 @@
</select> </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 id="listStaffDepartmentByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String">
select select
<include refid="Base_Column_List"/> <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
...@@ -17,8 +17,7 @@ ...@@ -17,8 +17,7 @@
<result column="clerk_type" property="clerkType" jdbcType="INTEGER"/> <result column="clerk_type" property="clerkType" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
staff_clerk_relation_id staff_clerk_relation_id,
,
staff_id, staff_id,
wx_enterprise_id, wx_enterprise_id,
enterprise_id, enterprise_id,
...@@ -54,41 +53,44 @@ ...@@ -54,41 +53,44 @@
</insert> </insert>
<select id="listBindCode" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="listBindCode" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO" parameterType="java.lang.String">
select <include refid="leftJoinStaffSQL"/>
<include refid="Base_Column_List"/> where a.enterprise_id = #{enterpriseId}
from tab_haoban_staff_clerk_relation and a.wx_enterprise_id = #{wxEnterpriseId} and a.status_flag = 1 and b.status_flag = 1
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and a.clerk_code in
and wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
and clerk_code in
<foreach collection="clerkCodeList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="clerkCodeList" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR} #{id,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </select>
<select id="listBindCodeByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="listBindCodeByStaffId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL"/>
<include refid="Base_Column_List"/> where a.staff_id = #{staffId,jdbcType=VARCHAR}
from tab_haoban_staff_clerk_relation and a.status_flag = 1 and b.status_flag = 1
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
<if test="enterpriseIdList!=null and enterpriseIdList.size &gt; 0"> <if test="enterpriseIdList!=null and enterpriseIdList.size &gt; 0">
and enterprise_id in and a.enterprise_id in
<foreach collection="enterpriseIdList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="enterpriseIdList" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR} #{id,jdbcType=VARCHAR}
</foreach> </foreach>
</if> </if>
</select> </select>
<select id="getOneByClerkId" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="getOneByClerkId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL"/>
<include refid="Base_Column_List"/> where a.status_flag = 1 and a.clerk_id = #{clerkId} and b.status_flag = 1
from tab_haoban_staff_clerk_relation <if test="null != wxEnterpriseId">
where and a.wx_enterprise_id = #{wxEnterpriseId}
status_flag = 1 </if>
and clerk_id = #{clerkId}
</select> </select>
<select id="getByCodeAndEnterpriseId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL"/>
where a.status_flag = 1 and b.status_flag = 1
and a.enterprise_id = #{enterpriseId}
and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1
</select>
<update id="changeStatusByClerkId"> <update id="changeStatusByClerkId">
update tab_haoban_staff_clerk_relation update tab_haoban_staff_clerk_relation
set status_flag = #{status}, set status_flag = #{status},
...@@ -105,24 +107,6 @@ ...@@ -105,24 +107,6 @@
where clerk_id = #{clerkId,jdbcType=VARCHAR} where clerk_id = #{clerkId,jdbcType=VARCHAR}
</update> </update>
<select id="getBindByClerkId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where clerk_id = #{clerkId,jdbcType=VARCHAR} and wx_enterprise_id=#{wxEnterpriseId} and status_flag=1
</select>
<select id="getByCodeAndEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where
status_flag = 1
and enterprise_id = #{enterpriseId}
and clerk_code = #{clerkCode} order by create_time desc limit 1
</select>
<update id="delByStoreIdAndCode"> <update id="delByStoreIdAndCode">
update tab_haoban_staff_clerk_relation update tab_haoban_staff_clerk_relation
set status_flag = 0, set status_flag = 0,
...@@ -132,21 +116,8 @@ ...@@ -132,21 +116,8 @@
and status_flag = 1 and status_flag = 1
</update> </update>
<select id="listByClerkIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO" parameterType="java.lang.String"> <select id="listByClerkIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select a.staff_clerk_relation_id staffClerkRelationId, <include refid="leftJoinStaffSQL"/>
a.staff_id staffId,
a.wx_enterprise_id wxEnterpriseId,
a.enterprise_id enterpriseId,
a.store_id storeId,
a.clerk_id clerkId,
a.clerk_code clerkCode,
a.status_flag statusFlag,
a.open_concat_flag openConcatFlag ,
a.clerk_type clerkType ,
a.manage_flag manageFlag ,
b.wx_user_id qwUserId,
b.wx_open_user_id openUserId
from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on b.staff_id = a.staff_id
where a.status_flag=1 and b.status_flag = 1 where a.status_flag=1 and b.status_flag = 1
<if test="wxEnterpriseId != null and wxEnterpriseId != ''"> <if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and a.wx_enterprise_id = #{wxEnterpriseId} and a.wx_enterprise_id = #{wxEnterpriseId}
...@@ -157,24 +128,14 @@ ...@@ -157,24 +128,14 @@
</foreach> </foreach>
</select> </select>
<select id="listByStoreId" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="getOneByStoreIdAndStaffId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL" />
<include refid="Base_Column_List"/> where a.status_flag=1 and b.status_flag=1
from tab_haoban_staff_clerk_relation and a.staff_id = #{staffId,jdbcType=VARCHAR}
where status_flag=1
and store_id = #{storeId,jdbcType=VARCHAR}
</select>
<select id="getOneByStoreIdAndStaffId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where status_flag=1
and staff_id = #{staffId,jdbcType=VARCHAR}
<if test="null != storeId and storeId != ''"> <if test="null != storeId and storeId != ''">
and store_id = #{storeId} and a.store_id = #{storeId}
</if> </if>
order by update_time desc limit 1 order by a.update_time desc limit 1
</select> </select>
...@@ -190,28 +151,6 @@ ...@@ -190,28 +151,6 @@
</foreach> </foreach>
</update> </update>
<select id="getOneBindStoreId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where store_id = #{storeId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag=1
order by update_time desc limit 1
</select>
<select id="getByClerkId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where clerk_id = #{clerkId,jdbcType=VARCHAR}
and status_flag=1
<if test="wxEnterpriseId != null and wxEnterpriseId != ''">
and wx_enterprise_id = #{wxEnterpriseId}
</if>
order by create_time desc limit 1
</select>
<update id="delByPrimaryKey"> <update id="delByPrimaryKey">
update tab_haoban_staff_clerk_relation update tab_haoban_staff_clerk_relation
set status_flag = 0, set status_flag = 0,
...@@ -228,55 +167,44 @@ ...@@ -228,55 +167,44 @@
and status_flag = 1 and status_flag = 1
</update> </update>
<select id="listByEnterpriseIdAndStaffid" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="listByEnterpriseIdAndStaffid" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL" />
<include refid="Base_Column_List"/> where a.enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
from tab_haoban_staff_clerk_relation and a.staff_id = #{staffId} and a.status_flag=1 and b.status_flag=1
where
enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
</select> </select>
<select id="getByCodeAndStoreId" resultMap="BaseResultMap" parameterType="java.lang.String"> <select id="getByCodeAndStoreId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL" />
<include refid="Base_Column_List"/> where a.clerk_code = #{clerkCode}
from tab_haoban_staff_clerk_relation and a.store_id = #{storeId}
where and a.status_flag = 1 and b.status_flag=1
clerk_code = #{clerkCode}
and store_id = #{storeId}
and status_flag = 1
</select> </select>
<select id="listByWxEnterpriseId" resultType="String"> <select id="listByWxEnterpriseId" resultType="String">
select staff_id select a.staff_id
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on a.staff_id = b.staff_id
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} where a.wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1 and a.status_flag = 1 and b.status_flag = 1
</select> </select>
<select id="lisByStaffId" resultMap="BaseResultMap"> <select id="lisByStaffId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL" />
<include refid="Base_Column_List"/> where a.wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
from tab_haoban_staff_clerk_relation and a.staff_id = #{staffId}
where and a.status_flag = 1 and b.status_flag = 1
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
<if test="null != storeIdList"> <if test="null != storeIdList">
and store_id in and a.store_id in
<foreach collection="storeIdList" item="item" separator="," open="(" close=")"> <foreach collection="storeIdList" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
order by create_time desc order by a.create_time desc
</select> </select>
<select id="pageByWxEnterpriseId" resultMap="BaseResultMap"> <select id="pageByWxEnterpriseId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL"/>
<include refid="Base_Column_List"/> where a.wx_enterprise_id = #{wxEnterpriseId}
from tab_haoban_staff_clerk_relation and a.status_flag =1
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
</select> </select>
<select id="listBindByStoreId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"> <select id="listBindByStoreId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
...@@ -299,34 +227,7 @@ ...@@ -299,34 +227,7 @@
and a.status_flag = 1 and a.status_flag = 1
</select> </select>
<select id="listBindByStoreIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where store_id in
<foreach collection="storeIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="wxEnterpriseId!=null">
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
and status_flag =1
</select>
<select id="listBindNotInStoreIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
where store_id NOT in
<foreach collection="storeIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
<if test="wxEnterpriseId!=null">
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
</if>
and enterprise_id=#{enterpriseId}
and status_flag =1
</select>
<update id="delByStoreIds"> <update id="delByStoreIds">
UPDATE UPDATE
tab_haoban_staff_clerk_relation tab_haoban_staff_clerk_relation
...@@ -340,30 +241,28 @@ ...@@ -340,30 +241,28 @@
and status_flag =1 and status_flag =1
</update> </update>
<select id="listBindStoreIdByEnterpriseId" resultMap="BaseResultMap"> <select id="listBindStoreIdByEnterpriseId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select store_id, <include refid="leftJoinStaffSQL" />
wx_enterprise_id where a.enterprise_id = #{wxEnterpriseId}
from tab_haoban_staff_clerk_relation and a.status_flag = 1 and b.status_flag = 1
where enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR} group by a.store_id
and status_flag = 1
group by store_id
</select> </select>
<select id="listRelationsStaffId" resultType="java.lang.String"> <select id="listRelationsStaffId" resultType="java.lang.String">
select staff_id select a.staff_id
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on a.staff_id = b.staff_id
where staff_id in where a.staff_id in
<foreach collection="staffIdList" item="item" separator="," open="(" close=")"> <foreach collection="staffIdList" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
and status_flag = 1 group by staff_id; and a.status_flag = 1 and b.status_flag = 1 group by a.staff_id;
</select> </select>
<select id="listMemberStaffRelNew" resultType="com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO"> <select id="listMemberStaffRelNew" resultType="com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO">
select * from ( select * from (
select ecr.member_id as memberId, select ecr.member_id as memberId,
ecr.external_user_id as memberExternalUserId, ecr.external_user_id as memberExternalUserId,
ecr.create_time as addFriendTime ,
scr.staff_id as staffId, scr.staff_id as staffId,
scr.clerk_id as staffClerkId scr.clerk_id as staffClerkId
from tab_haoban_external_clerk_related as ecr from tab_haoban_external_clerk_related as ecr
...@@ -385,59 +284,27 @@ ...@@ -385,59 +284,27 @@
<foreach collection="memberIdList" item="item" separator="," open="(" close=")"> <foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
) t where t.staffId is not null ) t where t.staffId is not null ORDER BY t.addFriendTime DESC
</select> </select>
<select id="listWxUserIdByClerkIds" resultType="string"> <select id="listWxUserIdByClerkIds" resultType="string">
select select
DISTINCT b.wx_user_id <if test="type==1">
from tab_haoban_staff_clerk_relation a DISTINCT b.wx_user_id
left join tab_haoban_staff b on a.staff_id = b.staff_id </if>
where a.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId} <if test="type==2">
and a.clerk_id in DISTINCT b.wx_open_user_id
<foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=","> </if>
#{id,jdbcType=VARCHAR}
</foreach>
</select>
<select id="listWxOpenUserIdByClerkIds" resultType="string">
select
DISTINCT b.wx_open_user_id
from tab_haoban_staff_clerk_relation a from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id left join tab_haoban_staff b on a.staff_id = b.staff_id
where a.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId} where a.status_flag=1 and b.status_flag=1 and a.wx_enterprise_id = #{wxEnterpriseId}
and a.clerk_id in and a.clerk_id in
<foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=","> <foreach collection="clerkIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR} #{id,jdbcType=VARCHAR}
</foreach> </foreach>
</select> </select>
<select id="listIdsByWxOpenUserIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select
a.staff_clerk_relation_id staffClerkRelationId,
a.store_id storeId,
a.wx_enterprise_id wxEnterpriseId,
a.enterprise_id enterpriseId,
b.wx_user_id wxUserId,
a.staff_id staffId,
a.clerk_id clerkId,
b.staff_name staffName,
b.wx_open_user_id wxOpenUserId
from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on b.staff_id = a.staff_id
where a.status_flag=1 and b.status_flag = 1
and a.wx_enterprise_id = #{wxEnterpriseId}
and a.enterprise_id = #{enterpriseId}
and b.wx_open_user_id in
<foreach collection="wxOpenUserIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
group by a.staff_clerk_relation_id
</select>
<select id="listIdsByWxUserIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO"> <select id="listIdsByWxUserIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select select
a.staff_clerk_relation_id staffClerkRelationId, a.staff_clerk_relation_id staffClerkRelationId,
...@@ -454,10 +321,18 @@ ...@@ -454,10 +321,18 @@
where a.status_flag=1 and b.status_flag = 1 where a.status_flag=1 and b.status_flag = 1
and a.wx_enterprise_id = #{wxEnterpriseId} and a.wx_enterprise_id = #{wxEnterpriseId}
and a.enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and b.wx_user_id in <if test="type==1">
<foreach collection="wxUserIds" item="id" index="index" open="(" close=")" separator=","> and b.wx_user_id in
#{id,jdbcType=VARCHAR} <foreach collection="wxUserIds" item="id" index="index" open="(" close=")" separator=",">
</foreach> #{id,jdbcType=VARCHAR}
</foreach>
</if>
<if test="type==2">
and b.wx_open_user_id in
<foreach collection="wxOpenUserIds" item="id" index="index" open="(" close=")" separator=",">
#{id,jdbcType=VARCHAR}
</foreach>
</if>
group by a.staff_clerk_relation_id group by a.staff_clerk_relation_id
</select> </select>
...@@ -525,38 +400,52 @@ ...@@ -525,38 +400,52 @@
<select id="getBindByManage" resultType="java.lang.Integer"> <select id="getBindByManage" resultType="java.lang.Integer">
select count(*) select count(*)
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on a.staff_id = b.staff_id
where status_flag = 1 where a.status_flag = 1 and b.status_flag = 1
and enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and manage_flag = 1 and a.manage_flag = 1
</select> </select>
<select id="getBindByStaffIdAndEnterpriseId" resultType="java.lang.Integer"> <select id="getBindByStaffIdAndEnterpriseId" resultType="java.lang.Integer">
select count(*) select count(*)
from tab_haoban_staff_clerk_relation from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on a.staff_id = b.staff_id
where status_flag = 1 where a.status_flag = 1 and b.status_flag = 1
and enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and staff_id = #{staffId} and a.staff_id = #{staffId}
</select> </select>
<select id="listManageBindByStaffId" resultMap="BaseResultMap"> <select id="listManageBindByStaffId" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
select <include refid="leftJoinStaffSQL"/>
<include refid="Base_Column_List"></include> where a.status_flag=1 and a.manage_flag = 1 and a.staff_id = #{staffId}
from tab_haoban_staff_clerk_relation and b.status_flag = 1
where status_flag=1 and manage_flag = 1 and staff_id = #{staffId}
</select> </select>
<select id="listByStoreIds" resultMap="BaseResultMap"> <sql id="leftJoinStaffSQL">
select select a.staff_clerk_relation_id staffClerkRelationId,
<include refid="Base_Column_List"/> a.staff_id staffId,
from tab_haoban_staff_clerk_relation a.wx_enterprise_id wxEnterpriseId,
where status_flag=1 a.enterprise_id enterpriseId,
<if test="null != storeIds and storeIds.size gt 0"> a.store_id storeId,
and store_id in a.clerk_id clerkId,
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")"> a.clerk_code clerkCode,
#{item} a.status_flag statusFlag,
</foreach> a.open_concat_flag openConcatFlag ,
a.clerk_type clerkType ,
a.manage_flag manageFlag ,
b.wx_user_id qwUserId,
b.wx_open_user_id openUserId
from tab_haoban_staff_clerk_relation a left join tab_haoban_staff b on b.staff_id = a.staff_id
</sql>
<select id="listByStoreIds" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL"/>
where a.status_flag=1 and b.status_flag=1 and a.store_id in
<foreach collection="storeIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="null != wxEnterpriseId">
and a.wx_enterprise_id = #{wxEnterpriseId}
</if> </if>
</select> </select>
......
...@@ -445,7 +445,8 @@ ...@@ -445,7 +445,8 @@
<sql id="canAddClerkSql"> <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) 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"> <if test="null != storeIdList">
and a.store_id in and a.store_id in
<foreach collection="storeIdList" item="id" index="index" open="(" close=")" separator=","> <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; ...@@ -19,12 +19,11 @@ import com.gic.haoban.manage.web.vo.ClerkVo;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RestController @Deprecated
public class ClerkController extends WebBaseController{ public class ClerkController extends WebBaseController{
@Autowired @Autowired
private ClerkService clerkService; private ClerkService clerkService;
......
package com.gic.haoban.manage.web.controller; 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.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
...@@ -12,15 +24,7 @@ import com.gic.haoban.manage.api.dto.MaterialCategoryDTO; ...@@ -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.dto.MaterialDTO;
import com.gic.haoban.manage.api.service.MaterialApiService; import com.gic.haoban.manage.api.service.MaterialApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import org.apache.commons.lang3.StringUtils; import com.gic.haoban.manage.web.utils.EmojiFilterUtil;
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;
@RestController @RestController
public class MaterialController extends WebBaseController { public class MaterialController extends WebBaseController {
...@@ -126,6 +130,10 @@ public class MaterialController extends WebBaseController { ...@@ -126,6 +130,10 @@ public class MaterialController extends WebBaseController {
materialDTO.setStaffId(login.getClerkId()); materialDTO.setStaffId(login.getClerkId());
materialDTO.setStaffName(login.getClerkName()); materialDTO.setStaffName(login.getClerkName());
String msg = this.checkEmoji(materialDTO.getMaterialContent()) ;
if(null != msg) {
return this.fail(msg) ;
}
String materialTitle = materialDTO.getMaterialTitle(); String materialTitle = materialDTO.getMaterialTitle();
String categoryId = materialDTO.getCategoryId(); String categoryId = materialDTO.getCategoryId();
Integer categoryType = materialDTO.getMaterialType(); Integer categoryType = materialDTO.getMaterialType();
...@@ -185,6 +193,10 @@ public class MaterialController extends WebBaseController { ...@@ -185,6 +193,10 @@ public class MaterialController extends WebBaseController {
materialDTO.setStaffId(login.getClerkId()); materialDTO.setStaffId(login.getClerkId());
materialDTO.setStaffName(login.getClerkName()); materialDTO.setStaffName(login.getClerkName());
String materialId = materialDTO.getMaterialId(); String materialId = materialDTO.getMaterialId();
String msg = this.checkEmoji(materialDTO.getMaterialContent()) ;
if(null != msg) {
return this.fail(msg) ;
}
MaterialDTO dto = materialApiService.selectMaterialById(materialId); MaterialDTO dto = materialApiService.selectMaterialById(materialId);
if (dto == null) { if (dto == null) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
...@@ -262,5 +274,19 @@ public class MaterialController extends WebBaseController { ...@@ -262,5 +274,19 @@ public class MaterialController extends WebBaseController {
} }
return resultResponse(HaoBanErrCode.ERR_1); 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 { ...@@ -313,7 +313,7 @@ public class StaffController extends WebBaseController {
@RequestMapping("del-clerk-relation") @RequestMapping("del-clerk-relation")
public HaobanResponse delStaffClerkList(String clerkId) { public HaobanResponse delStaffClerkList(String clerkId) {
WebLoginDTO login = AuthWebRequestUtil.getLoginUser(); 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); return resultResponse(HaoBanErrCode.ERR_1, b);
} }
...@@ -336,7 +336,7 @@ public class StaffController extends WebBaseController { ...@@ -336,7 +336,7 @@ public class StaffController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_10010); return resultResponse(HaoBanErrCode.ERR_10010);
} }
List<String> enterpriseIds = list.stream().filter(dto -> { List<String> enterpriseIds = list.stream().filter(dto -> {
boolean over = wxEnterpriseApiService.enterpriseIsOver(dto.getEnterpriseId()); boolean over = wxEnterpriseApiService.haobanIsStop(dto.getEnterpriseId());
return !over; return !over;
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList()); }).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 @@ ...@@ -179,7 +179,46 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </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> </dependencies>
<build> <build>
......
...@@ -36,4 +36,16 @@ public class WebBaseController { ...@@ -36,4 +36,16 @@ public class WebBaseController {
response.setErrorCode(errCode.getCode()); response.setErrorCode(errCode.getCode());
return response; 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; ...@@ -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.app.customer.service.api.service.StaffMemberRelationApiService;
import com.gic.haoban.common.anno.HttpLimit; import com.gic.haoban.common.anno.HttpLimit;
import com.gic.haoban.common.anno.IgnoreLogin; 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.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; 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.*;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.*; import com.gic.haoban.manage.api.service.*;
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil; import java.util.ArrayList;
import cn.hutool.core.convert.Convert; import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
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.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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.ClerkListDTO; import com.gic.clerk.api.dto.ClerkListDTO;
import com.gic.clerk.api.dto.ClerkStoreListDTO;
import com.gic.clerk.api.service.ClerkNewService; import com.gic.clerk.api.service.ClerkNewService;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.clerk.api.service.PowerService;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse; import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.api.dto.EnterpriseDTO; import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO; import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.enterprise.api.service.StoreWidgetService; import com.gic.enterprise.api.service.StoreWidgetService;
import com.gic.haoban.app.customer.dto.ChildrenListDTO;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService; import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService; import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.PageResult2; import com.gic.haoban.base.api.common.PageResult2;
import com.gic.haoban.base.api.common.pojo.dto.WellDoneLoginDTO;
import com.gic.haoban.common.anno.HttpLimit; import com.gic.haoban.common.anno.HttpLimit;
import com.gic.haoban.common.anno.IgnoreLogin; import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.GooglePhoneNumberUtil; import com.gic.haoban.common.utils.GooglePhoneNumberUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.AuditSettingDTO;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
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.role.HaobanRoleDTO; import com.gic.haoban.manage.api.dto.role.HaobanRoleDTO;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO; import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
import com.gic.haoban.manage.api.enums.*; import com.gic.haoban.manage.api.enums.AuditStatus;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskTypeEnum;
import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum; import com.gic.haoban.manage.api.enums.role.RoleClerkTypeEnum;
import com.gic.haoban.manage.api.service.*; import com.gic.haoban.manage.api.service.AuditApiService;
import com.gic.haoban.manage.api.service.AuditSettingApiService;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.SyncHaobanToGicApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.role.HaobanRoleApiService; import com.gic.haoban.manage.api.service.role.HaobanRoleApiService;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil; import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.web.config.Config; import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.CommonQO; import com.gic.haoban.manage.web.qo.CommonQO;
import com.gic.haoban.manage.web.vo.*; import com.gic.haoban.manage.web.vo.AuditSettingVO;
import com.gic.haoban.manage.web.vo.BindClerkVO;
import com.gic.haoban.manage.web.vo.ClerkDetailVo;
import com.gic.haoban.manage.web.vo.ClerkEditInfoVO;
import com.gic.haoban.manage.web.vo.ClerkListVO;
import com.gic.haoban.manage.web.vo.ClerkStoreVO;
import com.gic.haoban.manage.web.vo.OperationSettingVO;
import com.gic.haoban.manage.web.vo.StaffStoreVO;
import com.gic.haoban.manage.web.vo.StaffVO;
import com.gic.haoban.manage.web.vo.StoreClerkVO;
import com.gic.haoban.manage.web.vo.StoreListVO;
import com.gic.haoban.manage.web.vo.StoreRoleVO;
import com.gic.haoban.manage.web.vo.notify.CustomerFriendMemberVO; import com.gic.haoban.manage.web.vo.notify.CustomerFriendMemberVO;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService; 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.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import cn.hutool.core.collection.CollectionUtil;
import java.util.*; import cn.hutool.core.convert.Convert;
import java.util.stream.Collectors;
@RestController @RestController
public class WxStaffController extends WebBaseController { public class WxStaffController extends WebBaseController {
...@@ -100,6 +155,8 @@ public class WxStaffController extends WebBaseController { ...@@ -100,6 +155,8 @@ public class WxStaffController extends WebBaseController {
private StoreWidgetService storeWidgetService; private StoreWidgetService storeWidgetService;
@Autowired @Autowired
private HaobanRoleApiService haobanRoleApiService; private HaobanRoleApiService haobanRoleApiService;
@Autowired
private PowerService powerService ;
//选择成员列表 //选择成员列表
@RequestMapping("/staff-list") @RequestMapping("/staff-list")
...@@ -668,7 +725,7 @@ public class WxStaffController extends WebBaseController { ...@@ -668,7 +725,7 @@ public class WxStaffController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
List<String> enterpriseIdList = list.stream().filter(s -> { List<String> enterpriseIdList = list.stream().filter(s -> {
boolean over = wxEnterpriseApiService.enterpriseIsOver(s.getEnterpriseId()); boolean over = wxEnterpriseApiService.haobanIsStop(s.getEnterpriseId());
return !over; return !over;
}).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList()); }).map(EnterpriseDetailDTO::getEnterpriseId).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId); List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
...@@ -708,7 +765,7 @@ public class WxStaffController extends WebBaseController { ...@@ -708,7 +765,7 @@ public class WxStaffController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
List<String> enterpriseIdList = list.stream().filter(s -> { List<String> enterpriseIdList = list.stream().filter(s -> {
boolean over = wxEnterpriseApiService.enterpriseIsOver(s.getEnterpriseId()); boolean over = wxEnterpriseApiService.haobanIsStop(s.getEnterpriseId());
return !over; return !over;
}).map(s -> s.getEnterpriseId()).collect(Collectors.toList()); }).map(s -> s.getEnterpriseId()).collect(Collectors.toList());
List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId); List<String> storeIds = wxEnterpriseRelatedApiService.listStoreIdByWxEnterpriseId(wxEnterpriseId);
...@@ -963,7 +1020,7 @@ public class WxStaffController extends WebBaseController { ...@@ -963,7 +1020,7 @@ public class WxStaffController extends WebBaseController {
//解绑 //解绑
@RequestMapping("unbind-staff") @RequestMapping("unbind-staff")
public HaobanResponse unBindStaff(String clerkId, String clerkCode, String staffId, String storeId, String enterpriseId, Integer manageFlag) { public HaobanResponse unBindStaff(String wxEnterpriseId ,String clerkId, String clerkCode, String staffId, String storeId, String enterpriseId, Integer manageFlag) {
logger.info("解绑 操作人:{},备操作人:{},操作门店:{}", staffId, clerkId, storeId); logger.info("解绑 操作人:{},备操作人:{},操作门店:{}", staffId, clerkId, storeId);
if (StringUtils.isAnyBlank(clerkId, clerkCode, staffId)) { if (StringUtils.isAnyBlank(clerkId, clerkCode, staffId)) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
...@@ -980,7 +1037,7 @@ public class WxStaffController extends WebBaseController { ...@@ -980,7 +1037,7 @@ public class WxStaffController extends WebBaseController {
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
return resultResponse(HaoBanErrCode.ERR_111145); return resultResponse(HaoBanErrCode.ERR_111145);
} }
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId, ChannelCodeEnum.SELF_UNBIND.getCode()); staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, clerkId, ChannelCodeEnum.SELF_UNBIND.getCode(),wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
...@@ -1548,11 +1605,9 @@ public class WxStaffController extends WebBaseController { ...@@ -1548,11 +1605,9 @@ public class WxStaffController extends WebBaseController {
/** /**
* 会员关联数量 * 会员关联数量
*
* @return
*/ */
@RequestMapping("external-friend-count") @RequestMapping("external-friend-count")
public RestResponse friendCount(String staffId) { public RestResponse<Object> friendCount(String staffId) {
StaffDTO staff = staffApiService.selectById(staffId); StaffDTO staff = staffApiService.selectById(staffId);
if (staff == null) { if (staff == null) {
return RestResponse.successResult(0); return RestResponse.successResult(0);
...@@ -1561,5 +1616,163 @@ public class WxStaffController extends WebBaseController { ...@@ -1561,5 +1616,163 @@ public class WxStaffController extends WebBaseController {
int countExternalClerk = externalClerkRelatedApiService.getCountExternalClerk(staff.getWxEnterpriseId(), staffId, statusFlags); int countExternalClerk = externalClerkRelatedApiService.getCountExternalClerk(staff.getWxEnterpriseId(), staffId, statusFlags);
return RestResponse.successResult(countExternalClerk); return RestResponse.successResult(countExternalClerk);
} }
// 区经门店列表
@RequestMapping("/list-clerk-store")
public RestResponse<Object> listClerkStore(String wxEnterpriseId , String enterpriseId,String clerkId, @RequestParam(defaultValue="20")int pageSize , @RequestParam(defaultValue="1")int currentPage) {
List<String> storeIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId) ;
if (CollectionUtils.isEmpty(storeIdList)) {
return RestResponse.failure("-1", "无授权门店");
}
List<StoreListVO> voList = new ArrayList<>();
int totalCount = 0 ;
List<StoreDTO> storeDTOList = new ArrayList<>() ;
if(storeIdList.get(0).contains("-1")) {
String storeWidgetId = this.powerService.getStoreWidgetId(new Date(), clerkId);
logger.info("权限-所有门店storeWidgetId={}",storeWidgetId);
Page<Object> pageParam = new Page<Object>();
pageParam.setCurrentPage(currentPage);
pageParam.setPageSize(pageSize);
Page<StoreDTO> page = storeWidgetService.getStoreWidgetStore(storeWidgetId, null, enterpriseId, pageParam, null,null);
if (page != null) {
storeDTOList = page.getResult();
totalCount = page.getTotalCount();
}
}else {
totalCount = storeIdList.size();
int start = pageSize * (currentPage-1) ;
if(start<totalCount) {
int end = start +pageSize ;
if(end>totalCount) {
end = totalCount ;
}
List<String> subStoreIdList = storeIdList.subList(start, end) ;
if(CollectionUtils.isNotEmpty(subStoreIdList)) {
logger.info("分页当前页storeid数={}",subStoreIdList.size());
String[] arr = new String[subStoreIdList.size()] ;
List<StoreDTO> storeList = this.storeService.getStores(subStoreIdList.toArray(arr));
Map<String,StoreDTO> storeMap = storeList.stream().collect(Collectors.toMap(StoreDTO::getStoreId, o->o,(k1,k2)->k1)) ;
for(String id : subStoreIdList) {
if(null != storeMap.get(id)) {
storeDTOList.add(storeMap.get(id)) ;
}
}
}
}
}
if(CollectionUtils.isNotEmpty(storeDTOList)) {
for(StoreDTO store : storeDTOList) {
StoreListVO vo = new StoreListVO();
vo.setStoreId(store.getStoreId());
vo.setStoreName(store.getStoreName());
voList.add(vo) ;
}
}
Page<StoreListVO> page = new Page<>();
page.setResult(voList);
page.setTotalCount(totalCount);
page.setCurrentPage(currentPage);
page.setPageSize(pageSize);
return RestResponse.successResult(page);
}
//区经门店查询
@RequestMapping("search-clerk-store")
public RestResponse<Object> listClerkStoreByParams(String wxEnterpriseId, String enterpriseId, String clerkId, String storeSearchParams) {
if(StringUtils.isEmpty(storeSearchParams)) {
return RestResponse.failure("-1", "查询条件为空") ;
}
// 如果有权限控制,进行管辖门店过0滤
List<String> authStoreIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId, wxEnterpriseId);
if (CollectionUtils.isEmpty(authStoreIdList)) {
return RestResponse.failure("-1", "无授权门店");
}
StoreSearchDTO searchDTO = new StoreSearchDTO();
searchDTO.setRecycleStoreCount(0);
searchDTO.setMemberCountFlag(0);
searchDTO.setSearchName(storeSearchParams);
// 企业ID
searchDTO.setEnterpriseId(enterpriseId);
if(!authStoreIdList.contains("-1")) {
searchDTO.setAuthStoreIdList(authStoreIdList);
}
// 门店参数
Page page = new Page();
page.setPageSize(20);
page.setCurrentPage(1);
Map<String, Object> params = new HashMap<>();
params.put("searchDto", searchDTO);
page.setParams(params);
logger.info("查询条件={}", JSON.toJSONString(page));
Map<String, Object> result = storeService.getStoreListPage(page);
page = (Page) result.get("page");
List<StoreDTO> storeList = (List<StoreDTO>) result.get("list");
List<StoreListVO> retList = new ArrayList<StoreListVO>();
StoreListVO vo = null;
for (StoreDTO dto : storeList) {
vo = new StoreListVO();
vo.setStoreId(dto.getStoreId());
vo.setStoreName(dto.getStoreName());
retList.add(vo);
}
return RestResponse.successResult(retList);
}
/**
* 门店导购查询
*/
@RequestMapping("list-clerk")
public RestResponse<Object> listClerk(String enterpriseId , String wxEnterpriseId , String clerkId ,String clerkSearchParams , BasePageInfo basePageInfo) {
ClerkDTO clerk = this.clerkService.getclerkById(clerkId) ;
int clerkType = clerk.getClerkType() ;
List<ClerkListVO> resultList = null ;
if(clerkType==0) {
return RestResponse.failure("-1", "无权访问");
}else if(clerkType==1) {
List<ClerkListDTO> clerkList = clerkService.getClerkByStoreId(enterpriseId, clerk.getStoreId());
if (CollectionUtils.isNotEmpty(clerkList) && StringUtils.isNotEmpty(clerkSearchParams)) {
clerkList = clerkList.stream().filter(dto->dto.getClerkCode().contains(clerkSearchParams) || dto.getClerkName().contains(clerkSearchParams)).collect(Collectors.toList()) ;
}
if (CollectionUtils.isEmpty(clerkList)) {
return RestResponse.failure("-1", "无导购");
}
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, clerkList);
}else if(clerkType==2) {
Map<String, Object> params = new HashMap<>();
params.put("enterpriseId", enterpriseId);
// 只获取导购和店长
params.put("clerkTypeList", Arrays.asList(1));
if (StringUtils.isNotBlank(clerkSearchParams)) {
params.put("clerkSearchParams", "%" + clerkSearchParams + "%");
}
// 如果有权限控制,进行管辖门店过0滤
List<String> authStoreIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId,wxEnterpriseId);
if (CollectionUtils.isEmpty(authStoreIdList)) {
return RestResponse.failure("-1", "无授权门店");
}
if (!(authStoreIdList.size() == 1 && authStoreIdList.contains("-1"))) {
params.put("storeIdList", authStoreIdList);
}
Page<ClerkStoreListDTO> page = new Page<>();
page.setPageSize(basePageInfo.getPageSize());
page.setCurrentPage(basePageInfo.getPageNum());
page.setParams(params);
logger.info("查询条件:{}", JSON.toJSONString(params));
page = this.clerkService.listStoreClerkByPage(page);
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, page.getResult());
}
List<String> clerkIdList = resultList.stream().map(dto->dto.getClerkId()).collect(Collectors.toList()) ;
List<StaffClerkRelationDTO> relationList = this.staffClerkRelationApiService.listByClerkIdsWxEnterpriseId(clerkIdList, wxEnterpriseId) ;
List<String> retlationIdList = relationList.stream().map(dto->dto.getClerkId()).collect(Collectors.toList()) ;
resultList.removeIf(item->{
return !retlationIdList.contains(item.getClerkId()) ;
}) ;
Page<ClerkListVO> retPage = new Page<>();
retPage.setPageSize(resultList.size());
retPage.setCurrentPage(1);
retPage.setTotalCount(resultList.size());
retPage.setTotalPage(1);
retPage.setResult(resultList);
return RestResponse.successResult(retPage);
}
} }
package com.gic.haoban.manage.web.controller.marketing;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.CollectionUtil;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.StringUtil;
import com.gic.commons.web.qo.PageQo;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.ecm.api.dto.EcmPlanDTO;
import com.gic.ecm.api.dto.MemberEcmLogDTO;
import com.gic.ecm.api.service.EcmPlanService;
import com.gic.enterprise.service.CustomSettingApiService;
import com.gic.game.api.dto.GameActivityDTO;
import com.gic.game.api.service.GameService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.vo.AiMemberLogListVO;
import com.gic.integralmall.api.dto.IntegralMallExchangeLogDTO;
import com.gic.integralmall.api.service.IntegralmallService;
import com.gic.marketing.api.dto.CoupCardShelfDTO;
import com.gic.marketing.api.dto.MemberCardLogDTO;
import com.gic.marketing.api.dto.WechatCard;
import com.gic.marketing.api.dto.member.MemberSmsLogDTO;
import com.gic.marketing.api.dto.member.MemberWechatLogDTO;
import com.gic.marketing.api.service.CardExportService;
import com.gic.marketing.api.service.CouponCardService;
import com.gic.marketing.api.service.SmsService;
import com.gic.marketing.api.service.WechatMarketingService;
import com.gic.marketing.pro.api.dto.ai.AiMemberLogListDTO;
import com.gic.marketing.pro.api.dto.game.GameDTO;
import com.gic.marketing.pro.api.service.ai.AiMemberLogApiService;
import com.gic.marketing.pro.api.service.game.GameApiService;
import com.gic.member.api.dto.AchievementSystemDTO;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.AchievementService;
import com.google.common.collect.Lists;
/**
*
* @ClassName: MemberMarketingController
* @Description: 客户营销记录
* @author xugh
* @date 2022年10月28日 上午9:57:23
*
*/
@RestController
public class MemberMarketingController extends WebBaseController {
private static final org.apache.logging.log4j.Logger logger = LogManager.getLogger(MemberMarketingController.class);
@Autowired
private EcmPlanService ecmPlanService;
@Autowired
private CardExportService cardExportService;
@Autowired
private SmsService smsService;
@Autowired
private WechatMarketingService wechatMarketingService;
@Autowired
private AiMemberLogApiService aiMemberLogApiService;
@Autowired
private CustomSettingApiService customSettingApiService;
@Autowired
private CouponCardService couponCardService;
@Autowired
private GameService gameService;
@Autowired
private GameApiService gameApiService;
@Autowired
private AchievementService achievementService;
@Autowired
private IntegralmallService integralMallService;
// 会员积分商城订单数
@RequestMapping("/member/integral-order-num")
private RestResponse<Object> getIntegralOrderNum(String enterpriseId, String memberId) {
Page<IntegralMallExchangeLogDTO> page = new Page<>();
page.setCurrentPage(1);
page.setPageSize(20);
page = integralMallService.findExchangeLogFromMember(enterpriseId, memberId, null, null, "1,2,3", null, page);
return RestResponse.successResult(page.getTotalCount());
}
/**
* ECM营销日志
*
* @param memberId 会员ID
* @param search 搜索条件:计划名称
* @param marketingType 营销类型 图文-teletext 文本 text 小程序-wxa 图片-image 卡券-card 短信-message 话务-teltask 企微-qywx 群发消息 qfxx 积分 integral 会员卡升级 grade
* @param beginTime 开始时间
* @param endTime 结束时间
* @param currentPage currentPage
* @param pageSize pageSize
* @return Response
*/
@RequestMapping("/member/ecm-log-page")
@ResponseBody
public RestResponse<Object> memberEcmLogPage(@RequestParam(defaultValue = "-1") String memberId, String search,
String marketingType, Date beginTime, Date endTime, @RequestParam(defaultValue = "1") int currentPage,
@RequestParam(defaultValue = "20") int pageSize, String enterpriseId) {
Page<MemberEcmLogDTO> page = new Page<>(currentPage, pageSize);
// 时间默认一个月
if (beginTime == null || endTime == null) {
Calendar start = Calendar.getInstance();
start.add(Calendar.MONTH, -3);
beginTime = start.getTime();
endTime = new Date();
}
beginTime = DateUtil.getStartTimeOfDay(beginTime);
endTime = DateUtil.getEndTimeOfDay(endTime);
page = ecmPlanService.memberEcmLogPage(enterpriseId, memberId, search, marketingType, beginTime, endTime, page);
return RestResponse.successResult(page);
}
/**
* 卡券营销日志
*
* @param memberId 会员ID
* @param search 搜索条件:卡券代码
* @param receiveCode 投放渠道
* @param putBeginTime 投放开始时间
* @param putEndTime 投放结束时间
* @param receiveBeginTime 领取开始时间
* @param receiveEndTime 领取结束时间
* @param currentPage currentPage
* @param pageSize pageSize
* @return Response
*/
@RequestMapping("/member/card-log-page")
@ResponseBody
public RestResponse<Object> memberCardLogPage(@RequestParam(defaultValue = "-1") String memberId, String search,
String receiveCode, Date putBeginTime, Date putEndTime, Date receiveBeginTime, Date receiveEndTime,
@RequestParam(defaultValue = "1") int currentPage, @RequestParam(defaultValue = "20") int pageSize,
String enterpriseId) {
Page<MemberCardLogDTO> page = new Page<>(currentPage, pageSize);
Map<String, Object> params = new HashMap<>();
page.setPageSize(pageSize);
page.setCurrentPage(currentPage);
params.put("memberId", memberId);
params.put("enterpriseId", enterpriseId);
params.put("receiveCode", receiveCode);
params.put("receiveType", "CARD_RECEIVE_TYPE");
params.put("showCardCodeFlag", "");
params.put("search", search);
// 时间默认一个月
if (putBeginTime == null || putEndTime == null) {
Calendar start = Calendar.getInstance();
start.add(Calendar.MONTH, -3);
putBeginTime = start.getTime();
putEndTime = new Date();
}
params.put("beginTime", DateUtil.getStartTimeOfDay(putBeginTime));
params.put("endTime", DateUtil.getEndTimeOfDay(putEndTime));
if (receiveBeginTime != null) {
params.put("receiveBeginTime", DateUtil.getStartTimeOfDay(receiveBeginTime));
}
if (receiveEndTime != null) {
params.put("receiveEndTime", DateUtil.getEndTimeOfDay(receiveEndTime));
}
page.setParams(params);
page = cardExportService.getCardLogs(page);
cardReceiveTypeName(enterpriseId, page);
return RestResponse.successResult(page);
}
/**
* 短信营销日志
*
* @param memberId 会员ID
* @param smsType 模板类型:0-普通短信 1-营销短信
* @param beginTime 开始时间
* @param endTime 结束时间
* @param currentPage currentPage
* @param pageSize pageSize
* @return Response
*/
@RequestMapping("/member/sms-log-page")
@ResponseBody
public RestResponse<Object> memberSmsLogPage(@RequestParam(defaultValue = "-1") String memberId, Integer smsType,
Date beginTime, Date endTime, @RequestParam(defaultValue = "1") int currentPage,
@RequestParam(defaultValue = "20") int pageSize, @RequestParam(defaultValue = "-1") int source,
String enterpriseId) {
// 时间默认一个月
if (beginTime == null || endTime == null) {
Calendar start = Calendar.getInstance();
start.add(Calendar.MONTH, -3);
beginTime = start.getTime();
endTime = new Date();
}
beginTime = DateUtil.getStartTimeOfDay(beginTime);
endTime = DateUtil.getEndTimeOfDay(endTime);
Page<MemberSmsLogDTO> page = new Page<>(currentPage, pageSize);
Map<String, Object> params = new HashMap<>();
if (-1 != source) {
params.put("source", source);
}
page.setParams(params);
page = smsService.memberSmsLogPage(enterpriseId, memberId, smsType, beginTime, endTime, page);
return RestResponse.successResult(page);
}
/**
* 微信营销日志
*
* @param memberId 会员ID
* @param contentType 图文类型(0:图文消息,1:文本消息, 2: 图片)
* @param beginTime 开始时间
* @param endTime 结束时间
* @param currentPage currentPage
* @param pageSize pageSize
* @return ResponseZ
*/
@RequestMapping("/member/wechat-log-page")
@ResponseBody
public RestResponse<Object> memberWechatLogPage(@RequestParam(defaultValue = "-1") String memberId,
Integer contentType, Date beginTime, Date endTime, @RequestParam(defaultValue = "1") int currentPage,
@RequestParam(defaultValue = "20") int pageSize, String enterpriseId) {
Page<MemberWechatLogDTO> page = new Page<>(currentPage, pageSize);
// 时间默认一个月
if (beginTime == null || endTime == null) {
Calendar start = Calendar.getInstance();
start.add(Calendar.MONTH, -3);
beginTime = start.getTime();
endTime = new Date();
}
beginTime = DateUtil.getStartTimeOfDay(beginTime);
endTime = DateUtil.getEndTimeOfDay(endTime);
page = wechatMarketingService.memberWechatLogPage(enterpriseId, memberId, contentType, beginTime, endTime,
page);
return RestResponse.successResult(page);
}
@RequestMapping("/member/marketing-count")
@ResponseBody
public RestResponse<Map<String,Integer>> marketingCount(String memberId, String enterpriseId) {
//1 待使用 2已使用 3已过期
Page<WechatCard> page = new Page<WechatCard>();
page.setPageSize(Integer.MAX_VALUE);
page.setCurrentPage(1);
page = this.cardExportService.getMemgerCouponByStatus(memberId, 1, page);
int memberCouponCount = page.getTotalCount();
// 时间默认一个月
Calendar start = Calendar.getInstance();
Date endTime = start.getTime();
start.add(Calendar.MONTH, -3);
Date beginTime = start.getTime();
// ecm
RestResponse<Object> ecmRep = this.memberEcmLogPage(memberId, "", null, beginTime, endTime, 1, 1, enterpriseId);
Page<MemberEcmLogDTO> ecmPage = (Page<MemberEcmLogDTO>) ecmRep.getResult();
// card
RestResponse<Object> cardRep = this.memberCardLogPage(memberId, "", "", beginTime, endTime, null, null, 1, 1,
enterpriseId);
Page<MemberCardLogDTO> cardPage = (Page<MemberCardLogDTO>) cardRep.getResult();
// sms
RestResponse<Object> smsRep = this.memberSmsLogPage(memberId, null, beginTime, endTime, 1, 1, -1, enterpriseId);
Page<MemberSmsLogDTO> smsPage = (Page<MemberSmsLogDTO>) smsRep.getResult();
// wechat
RestResponse<Object> wechatRep = this.memberWechatLogPage(memberId, null, beginTime, endTime, 1, 1,
enterpriseId);
Page<MemberWechatLogDTO> wechatPage = (Page<MemberWechatLogDTO>) wechatRep.getResult();
// AI营销
ServiceResponse<Page<AiMemberLogListDTO>> aiMemberLogRes = aiMemberLogApiService.pageAiMemberMarketingLog(
memberId, null, Lists.newArrayList(0, 1, 6, 8), null, null, new BasePageInfo());
Map<String,Integer> map = new HashMap<>();
map.put("ecm", ecmPage.getTotalCount()) ;
map.put("sms", smsPage.getTotalCount()) ;
map.put("coupon", cardPage.getTotalCount()) ;
map.put("wechat", wechatPage.getTotalCount()) ;
map.put("ai", aiMemberLogRes.getResult().getTotalCount()) ;
map.put("memberCouponCount", memberCouponCount) ;
return RestResponse.successResult(map);
}
@RequestMapping("/member/page-ai-member-log")
@ResponseBody
public RestResponse<Object> pageAiMemberMarketingLog(String memberId, String planName, String aiStartTime,
String aiEndTime, @RequestParam(defaultValue = "1") int currentPage,
@RequestParam(defaultValue = "20") int pageSize) {
Calendar start = Calendar.getInstance();
Date endTime = start.getTime();
start.add(Calendar.MONTH, -3);
Date beginTime = start.getTime();
PageQo pageQo = new PageQo() ;
pageQo.setPageNum(currentPage);
pageQo.setPageSize(pageSize);
ServiceResponse<Page<AiMemberLogListDTO>> res = aiMemberLogApiService.pageAiMemberMarketingLog(memberId,
planName, Lists.newArrayList(0, 1, 6, 8), DateUtil.dateToStr(beginTime, "yyyy-MM-dd"), DateUtil.dateToStr(endTime, "yyyy-MM-dd"), pageQo.getBasePageInfo());
if (res.isSuccess()) {
Page<AiMemberLogListDTO> page = res.getResult();
List<AiMemberLogListDTO> list = page.getResult();
if (CollectionUtils.isEmpty(list)) {
return RestResponse.successResult(res.getResult());
}
Map<String, Object> param = new HashMap<>();
param.put("dict_type", "marketing_activity_scene");
ServiceResponse<Page<JSONObject>> dictRes = customSettingApiService.page("tab_business_dict", param, 1, 20);
List<JSONObject> dictList = dictRes.getResult().getResult();
Map<String, String> dictCodeMapName = new HashMap<>();
for (JSONObject jsonObject : dictList) {
dictCodeMapName.put(jsonObject.getString("dict_code"), jsonObject.getString("dict_name"));
}
Page<AiMemberLogListVO> resultPage = EntityUtil.changeEntityByJSON(Page.class, page);
List<AiMemberLogListVO> voList = new ArrayList<>();
for (AiMemberLogListDTO dto : list) {
AiMemberLogListVO vo = new AiMemberLogListVO();
vo.setAiLogId(dto.getAiLogId());
vo.setAiTime(dto.getAiTime());
vo.setPlanName(dto.getPlanName());
vo.setAiTemplateName(dto.getAiTemplateName());
Integer activityScene = dto.getActivityScene();
if (activityScene == null) {
vo.setActivityScene(null);
} else {
vo.setActivityScene(dictCodeMapName.get(activityScene.toString()));
}
voList.add(vo);
}
resultPage.setResult(voList);
return RestResponse.successResult(resultPage);
}
return RestResponse.failure("9999", res.getMessage());
}
/**
* 卡券记录-领取记录-来源明细
*
* @param page
*/
private void cardReceiveTypeName(String enterpriseId, Page<MemberCardLogDTO> page) {
List<MemberCardLogDTO> list = page.getResult();
if (CollectionUtils.isEmpty(list)) {
return;
}
Map<String, List<MemberCardLogDTO>> map = CollectionUtil.group(list, "receiveCode");
Set<String> keySet = map.keySet();
Iterator<String> it = keySet.iterator();
Map<String, List<EcmPlanDTO>> ecmMap = new HashMap<>();
Map<Long, GameDTO> newGameMap = new HashMap<>();
Map<String, List<GameActivityDTO>> gameMap = new HashMap<>();
Map<String, List<AchievementSystemDTO>> achievementMap = new HashMap<>();
Map<String, List<CoupCardShelfDTO>> shelfMap = new HashMap<>();
while (it.hasNext()) {
String key = it.next();
Set<String> ids = new HashSet<String>();
Set<Long> longIds = new HashSet<Long>();
if ("RECEIVE_003".equals(key)) {
List<MemberCardLogDTO> _list = map.get("RECEIVE_003");
for (MemberCardLogDTO _dto : _list) {
if (!StringUtil.isBlank(_dto.getRelationId())) {
ids.add(_dto.getRelationId());
}
}
if (CollectionUtils.isNotEmpty(ids)) {
List<EcmPlanDTO> ecmList = ecmPlanService.getEcmNameByIds(ids);
ecmMap = CollectionUtil.group(ecmList, "ecmPlanId");
}
}
if ("RECEIVE_004".equals(key)) {
}
if ("RECEIVE_005".equals(key)) {
List<MemberCardLogDTO> _list = map.get("RECEIVE_005");
for (MemberCardLogDTO _dto : _list) {
if (!StringUtil.isBlank(_dto.getRelationId())) {
ids.add(_dto.getRelationId());
}
}
if (CollectionUtils.isNotEmpty(ids)) {
List<CoupCardShelfDTO> shelfList = this.couponCardService.getShelfNameByIds(ids);
shelfMap = CollectionUtil.group(shelfList, "shelfId");
}
}
if ("RECEIVE_007".equals(key)) {
List<MemberCardLogDTO> _list = map.get("RECEIVE_007");
for (MemberCardLogDTO _dto : _list) {
if (!StringUtil.isBlank(_dto.getRelationId())) {
ids.add(_dto.getRelationId());
}
}
if (CollectionUtils.isNotEmpty(ids)) {
List<GameActivityDTO> gameList = gameService.listGameNameByRecordCodes(enterpriseId, ids);
gameMap = CollectionUtil.group(gameList, "gameActivityId");
}
}
if ("RECEIVE_010".equals(key)) {
List<MemberCardLogDTO> _list = map.get("RECEIVE_010");
for (MemberCardLogDTO _dto : _list) {
if (!StringUtil.isBlank(_dto.getRelationId())) {
ids.add(_dto.getRelationId());
}
}
if (CollectionUtils.isNotEmpty(ids)) {
List<AchievementSystemDTO> achievementList = achievementService.getNameByIds(ids);
achievementMap = CollectionUtil.group(achievementList, "achievementSystemId");
}
}
if ("RECEIVE_026".equals(key)) {
List<MemberCardLogDTO> _list = map.get("RECEIVE_026");
for (MemberCardLogDTO _dto : _list) {
if (!StringUtil.isBlank(_dto.getRelationId())) {
longIds.add(Long.parseLong(_dto.getRelationId()));
}
}
if (CollectionUtils.isNotEmpty(longIds)) {
ServiceResponse<List<GameDTO>> gameList = gameApiService.getGameList(Lists.newArrayList(longIds),
enterpriseId);
List<GameDTO> result = gameList.getResult();
if (CollectionUtils.isNotEmpty(result)) {
newGameMap = result.stream().collect(Collectors.toMap(GameDTO::getGameId, v -> v));
}
}
}
}
for (int i = 0; i < list.size(); i++) {
MemberCardLogDTO c = list.get(i);
if (org.apache.commons.lang3.StringUtils.isNotBlank(c.getRelationId())) {
if ("RECEIVE_003".equals(c.getReceiveCode())) {
List<EcmPlanDTO> ecmList = ecmMap.get(c.getRelationId());
if (CollectionUtils.isNotEmpty(ecmList)) {
c.setReceiveTypeExcel(ecmList.get(0).getEcmPlanName());
}
}
if ("RECEIVE_004".equals(c.getReceiveCode())) {
// 门店展架-门店名称
c.setReceiveTypeExcel(c.getStoreName());
}
if ("RECEIVE_005".equals(c.getReceiveCode())) {
List<CoupCardShelfDTO> referList = shelfMap.get(c.getRelationId());
if (CollectionUtils.isNotEmpty(referList)) {
c.setReceiveTypeExcel(referList.get(0).getShelfName());
}
}
if ("RECEIVE_007".equals(c.getReceiveCode())) {
List<GameActivityDTO> referList = gameMap.get(c.getRelationId());
if (CollectionUtils.isNotEmpty(referList)) {
c.setReceiveTypeExcel(referList.get(0).getGameName());
}
}
if ("RECEIVE_010".equals(c.getReceiveCode())) {
List<AchievementSystemDTO> referList = achievementMap.get(c.getRelationId());
if (CollectionUtils.isNotEmpty(referList)) {
c.setReceiveTypeExcel(referList.get(0).getAchievementName());
}
}
if ("RECEIVE_026".equals(c.getReceiveCode())) {
GameDTO gameDTO = newGameMap.get(Long.parseLong(c.getRelationId()));
if (gameDTO != null) {
c.setReceiveTypeExcel(gameDTO.getGameName());
}
}
}
}
}
}
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 @@ ...@@ -8,11 +8,24 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<context:component-scan base-package="com.gic.haoban"/> <context:component-scan base-package="com.gic.haoban"/>
<!-- 应用名称 --> <!-- 应用名称 -->
<dubbo:application name="haoban-manage3-wx"/> <dubbo:application name="haoban-manage3-wx"/>
<dubbo:protocol name="dubbo" port="30010"/> <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.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" <dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService"
id="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