Commit d90be39e by fudahua

授权绑定,授权门店列表,binlog

parent 648e8cd4
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created 2021/4/14.
*
* @author hua
*/
public class BindStoreInfoDTO implements Serializable {
private String storeId;
private String storeCode;
private String enterpriseId;
private String storeName;
private String storeGroupName;
private String storeGroupId;
private Date createTime;
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStoreGroupName() {
return storeGroupName;
}
public void setStoreGroupName(String storeGroupName) {
this.storeGroupName = storeGroupName;
}
public String getStoreGroupId() {
return storeGroupId;
}
public void setStoreGroupId(String storeGroupId) {
this.storeGroupId = storeGroupId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
...@@ -41,8 +41,18 @@ public class MaterialDTO implements Serializable{ ...@@ -41,8 +41,18 @@ public class MaterialDTO implements Serializable{
private Date updateTime; private Date updateTime;
private String fromMaterialId = "-1";
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getFromMaterialId() {
return fromMaterialId;
}
public void setFromMaterialId(String fromMaterialId) {
this.fromMaterialId = fromMaterialId;
}
public String getMaterialId() { public String getMaterialId() {
return materialId; return materialId;
} }
......
package com.gic.haoban.manage.api.dto;
/**
* Created 2021/4/13.
*
* @author hua
*/
public class StoreOrGroupInfoDTO {
private String relationId;
private int relationType;
private String relationName;
public String getRelationId() {
return relationId;
}
public void setRelationId(String relationId) {
this.relationId = relationId;
}
public int getRelationType() {
return relationType;
}
public void setRelationType(int relationType) {
this.relationType = relationType;
}
public String getRelationName() {
return relationName;
}
public void setRelationName(String relationName) {
this.relationName = relationName;
}
}
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.List;
/**
* Created 2021/4/13.
*
* @author hua
*/
public class WxEnterpriseRelationDetailDTO implements Serializable {
private String wxEnterpriseId;
private String enterpriseId;
private String enterpriseName;
private String version;
private String staffId;
private String staffName;
private int wxEnterpriseType;
private int memberOpenCardFlag;
private List<StoreOrGroupInfoDTO> relations;
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public List<StoreOrGroupInfoDTO> getRelations() {
return relations;
}
public void setRelations(List<StoreOrGroupInfoDTO> relations) {
this.relations = relations;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public int getWxEnterpriseType() {
return wxEnterpriseType;
}
public void setWxEnterpriseType(int wxEnterpriseType) {
this.wxEnterpriseType = wxEnterpriseType;
}
public int getMemberOpenCardFlag() {
return memberOpenCardFlag;
}
public void setMemberOpenCardFlag(int memberOpenCardFlag) {
this.memberOpenCardFlag = memberOpenCardFlag;
}
}
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
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.manage.api.dto.MaterialCategoryDTO; import com.gic.haoban.manage.api.dto.MaterialCategoryDTO;
import com.gic.haoban.manage.api.dto.MaterialDTO; import com.gic.haoban.manage.api.dto.MaterialDTO;
...@@ -33,4 +34,13 @@ public interface MaterialApiService { ...@@ -33,4 +34,13 @@ public interface MaterialApiService {
List<MaterialCategoryDTO> listByParentCategory(String categoryId); List<MaterialCategoryDTO> listByParentCategory(String categoryId);
/**
* 分析素材
*
* @param toWxEnterpriseId
* @param wxEnterpriseId
* @param materialId
*/
ServiceResponse<Void> shareMaterial(String wxEnterpriseId, String toWxEnterpriseId, String materialId);
} }
...@@ -3,7 +3,9 @@ package com.gic.haoban.manage.api.service; ...@@ -3,7 +3,9 @@ package com.gic.haoban.manage.api.service;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO; import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.*;
public interface WxEnterpriseRelatedApiService { public interface WxEnterpriseRelatedApiService {
List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId); List<EnterpriseDetailDTO> listEnterpriseByWxEnterpriseId(String wxEnterpriseId);
...@@ -26,6 +28,50 @@ public interface WxEnterpriseRelatedApiService { ...@@ -26,6 +28,50 @@ public interface WxEnterpriseRelatedApiService {
*/ */
List<EnterpriseDetailDTO> queryBindGicEnterpriseByTime(String seqTime); List<EnterpriseDetailDTO> queryBindGicEnterpriseByTime(String seqTime);
@Deprecated
int wxEnterpriseBind(String enterpriseId, String wxEnterpriseId, String version, String staffId, String staffName); int wxEnterpriseBind(String enterpriseId, String wxEnterpriseId, String version, String staffId, String staffName);
/**
* 企业绑定
*
* @param detailDTO
* @return
*/
int wxEnterpriseBind(WxEnterpriseRelationDetailDTO detailDTO);
/**
* 刷新企业门店
*
* @param enterpriseId
* @param wxEnterpriseId
* @param staffId
* @return
*/
public boolean flushBindStoreByEnterpriseId(String enterpriseId, String wxEnterpriseId, String staffId);
/**
* 获取企业绑定详情
*
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
public WxEnterpriseRelationDetailDTO getEnterpriseBindInfo(String wxEnterpriseId, String enterpriseId);
/**
* 根据商户id 获取关联的微信企业列表
*
* @param enterpriseId
* @return
*/
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId);
/**
* @param enterpriseId
* @param search
* @param pageInfo
* @return
*/
public Page<BindStoreInfoDTO> pageBindStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId, String search, BasePageInfo pageInfo);
} }
...@@ -23,4 +23,8 @@ public interface TabHaobanMaterialMapper { ...@@ -23,4 +23,8 @@ public interface TabHaobanMaterialMapper {
List<TabHaobanMaterial> listMaterialByCategoryId(String categoryId); List<TabHaobanMaterial> listMaterialByCategoryId(String categoryId);
Page<TabHaobanMaterial> listMaterial(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword, @Param("categoryId")String categoryId, @Param("materialType")Integer materialType); Page<TabHaobanMaterial> listMaterial(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("keyword")String keyword, @Param("categoryId")String categoryId, @Param("materialType")Integer materialType);
TabHaobanMaterial selectByfromMaterialId(@Param("fromMaterialId") String fromMaterialId, @Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanMaterial> listByfromMaterialId(@Param("fromMaterialId") String fromMaterialId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabStoreRange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface TabHaobanStoreRangeMapper {
/**
*/
int deleteByPrimaryKey(String storeRangeId);
/**
*/
int insert(TabStoreRange record);
/**
*/
int insertSelective(TabStoreRange record);
/**
*/
TabStoreRange selectByPrimaryKey(String storeRangeId);
/**
*/
int updateByPrimaryKeySelective(TabStoreRange record);
/**
*/
int updateByPrimaryKey(TabStoreRange record);
/**
* 查询关联的所有分组信息
*
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
List<TabStoreRange> queryByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
/**
* 删除关联关系
*
* @param wxEnterpriseId
* @param enterpriseId
* @return
*/
int deleteByEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId);
/**
* 删除关联关系
*
* @param relationId
* @param enterpriseId
* @return
*/
int delStoreRangeByRelationId(@Param("relationId") String relationId, @Param("enterpriseId") String enterpriseId);
/**
* 批量插入
*/
int insertBatch(@Param("list") List<TabStoreRange> list);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabStoreRelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface TabHaobanStoreRelationMapper {
/**
*/
int deleteByPrimaryKey(String storeRelationId);
/**
*/
int insert(TabStoreRelation record);
/**
*/
int insertSelective(TabStoreRelation record);
/**
*/
TabStoreRelation selectByPrimaryKey(String storeRelationId);
/**
*/
int updateByPrimaryKeySelective(TabStoreRelation record);
/**
*/
int updateByPrimaryKey(TabStoreRelation record);
/**
* 删除门店
*
* @param enterpriseId
* @param storeId
* @return
*/
public int deleteStoreRalation(@Param("enterpriseId") String enterpriseId, @Param("storeId") String storeId);
/**
*/
List<TabStoreRelation> searchStoreRange(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("enterpriseId") String enterpriseId, @Param("search") String search);
}
\ No newline at end of file
...@@ -30,7 +30,7 @@ public interface WxEnterpriseMapper { ...@@ -30,7 +30,7 @@ public interface WxEnterpriseMapper {
List<TabHaobanWxEnterprise> listAll(); List<TabHaobanWxEnterprise> listAll();
List<TabHaobanWxEnterprise> listByIds(@Param("enterpriseIds")Set<String> enterpriseIds); List<TabHaobanWxEnterprise> listByIds(@Param("enterpriseIds") Set<String> wxEnterpriseIds);
List<TabHaobanWxEnterprise> getEnterpriseBycorpIdNoStatus(@Param("corpId")String corpId); List<TabHaobanWxEnterprise> getEnterpriseBycorpIdNoStatus(@Param("corpId")String corpId);
} }
\ No newline at end of file
...@@ -29,4 +29,13 @@ public interface WxEnterpriseRelatedMapper { ...@@ -29,4 +29,13 @@ public interface WxEnterpriseRelatedMapper {
List<TabHaobanWxEnterpriseRelated> listEnterpriseByEnterpriseIds(@Param("enterpriseIds")List<String> enterpriseIds); List<TabHaobanWxEnterpriseRelated> listEnterpriseByEnterpriseIds(@Param("enterpriseIds")List<String> enterpriseIds);
List<TabHaobanWxEnterpriseRelated> listEnterpriseByTime(@Param("time")String time); List<TabHaobanWxEnterpriseRelated> listEnterpriseByTime(@Param("time")String time);
/**
* 查询企业下唯一商户
*
* @param enterpriseId
* @param wxEnterpriseId
* @return
*/
TabHaobanWxEnterpriseRelated findOneByEIdAndWxEid(@Param("enterpriseId") String enterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -38,6 +38,16 @@ public class TabHaobanMaterial implements Serializable { ...@@ -38,6 +38,16 @@ public class TabHaobanMaterial implements Serializable {
private Date updateTime; private Date updateTime;
private String fromMaterialId;
public String getFromMaterialId() {
return fromMaterialId;
}
public void setFromMaterialId(String fromMaterialId) {
this.fromMaterialId = fromMaterialId;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public String getMaterialId() { public String getMaterialId() {
......
...@@ -22,8 +22,40 @@ public class TabHaobanWxEnterpriseRelated implements Serializable { ...@@ -22,8 +22,40 @@ public class TabHaobanWxEnterpriseRelated implements Serializable {
private String staffName; private String staffName;
private Integer wxEnterpriseType;
private Integer memberOpenCardFlag;
private Integer rangeType;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Integer getRangeType() {
return rangeType;
}
public void setRangeType(Integer rangeType) {
this.rangeType = rangeType;
}
public Integer getWxEnterpriseType() {
return wxEnterpriseType;
}
public void setWxEnterpriseType(Integer wxEnterpriseType) {
this.wxEnterpriseType = wxEnterpriseType;
}
public Integer getMemberOpenCardFlag() {
return memberOpenCardFlag;
}
public void setMemberOpenCardFlag(Integer memberOpenCardFlag) {
this.memberOpenCardFlag = memberOpenCardFlag;
}
public String getWxEnterpriseRelatedId() { public String getWxEnterpriseRelatedId() {
return wxEnterpriseRelatedId; return wxEnterpriseRelatedId;
} }
......
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 门店选择器
*
* @author fdh
*/
public class TabStoreRange implements Serializable {
/**
*
*/
private String storeRangeId;
/**
*
*/
private String wxEnterpriseId;
/**
* 商户id
*/
private String enterpriseId;
/**
* 关联id 默认0
*/
private String relationId;
/**
* 0所有门店 1分组 2门店
*/
private Integer relationType;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_store_range.store_range_id
*
* @return the value of tab_haoban_store_range.store_range_id
*/
public String getStoreRangeId() {
return storeRangeId;
}
/**
* This method sets the value of the database column tab_haoban_store_range.store_range_id
*
* @param storeRangeId the value for tab_haoban_store_range.store_range_id
*/
public void setStoreRangeId(String storeRangeId) {
this.storeRangeId = storeRangeId;
}
/**
* This method returns the value of the database column tab_haoban_store_range.wx_enterprise_id
*
* @return the value of tab_haoban_store_range.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_store_range.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_store_range.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_store_range.enterprise_id
*
* @return the value of tab_haoban_store_range.enterprise_id
*/
public String getEnterpriseId() {
return enterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_store_range.enterprise_id
*
* @param enterpriseId the value for tab_haoban_store_range.enterprise_id
*/
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_store_range.relation_id
*
* @return the value of tab_haoban_store_range.relation_id
*/
public String getRelationId() {
return relationId;
}
/**
* This method sets the value of the database column tab_haoban_store_range.relation_id
*
* @param relationId the value for tab_haoban_store_range.relation_id
*/
public void setRelationId(String relationId) {
this.relationId = relationId;
}
/**
* This method returns the value of the database column tab_haoban_store_range.relation_type
*
* @return the value of tab_haoban_store_range.relation_type
*/
public Integer getRelationType() {
return relationType;
}
/**
* This method sets the value of the database column tab_haoban_store_range.relation_type
*
* @param relationType the value for tab_haoban_store_range.relation_type
*/
public void setRelationType(Integer relationType) {
this.relationType = relationType;
}
/**
* This method returns the value of the database column tab_haoban_store_range.status_flag
*
* @return the value of tab_haoban_store_range.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_store_range.status_flag
*
* @param statusFlag the value for tab_haoban_store_range.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_store_range.create_time
*
* @return the value of tab_haoban_store_range.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_store_range.create_time
*
* @param createTime the value for tab_haoban_store_range.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_store_range.update_time
*
* @return the value of tab_haoban_store_range.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_store_range.update_time
*
* @param updateTime the value for tab_haoban_store_range.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 好办门店权限
*
* @author fdh
*/
public class TabStoreRelation implements Serializable {
/**
* 关联id
*/
private String storeRelationId;
/**
* 企业id
*/
private String wxEnterpriseId;
/**
* 门店id
*/
private String storeId;
/**
* 门店名称
*/
private String storeName;
/**
* 分组id
*/
private String storeGroupId;
/**
* 企业id
*/
private String enterpriseId;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.store_relation_id
*
* @return the value of tab_haoban_store_relation.store_relation_id
*/
public String getStoreRelationId() {
return storeRelationId;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.store_relation_id
*
* @param storeRelationId the value for tab_haoban_store_relation.store_relation_id
*/
public void setStoreRelationId(String storeRelationId) {
this.storeRelationId = storeRelationId;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.wx_enterprise_id
*
* @return the value of tab_haoban_store_relation.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_store_relation.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.store_id
*
* @return the value of tab_haoban_store_relation.store_id
*/
public String getStoreId() {
return storeId;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.store_id
*
* @param storeId the value for tab_haoban_store_relation.store_id
*/
public void setStoreId(String storeId) {
this.storeId = storeId;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.store_group_id
*
* @return the value of tab_haoban_store_relation.store_group_id
*/
public String getStoreGroupId() {
return storeGroupId;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.store_group_id
*
* @param storeGroupId the value for tab_haoban_store_relation.store_group_id
*/
public void setStoreGroupId(String storeGroupId) {
this.storeGroupId = storeGroupId;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.enterprise_id
*
* @return the value of tab_haoban_store_relation.enterprise_id
*/
public String getEnterpriseId() {
return enterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.enterprise_id
*
* @param enterpriseId the value for tab_haoban_store_relation.enterprise_id
*/
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.status_flag
*
* @return the value of tab_haoban_store_relation.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.status_flag
*
* @param statusFlag the value for tab_haoban_store_relation.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.create_time
*
* @return the value of tab_haoban_store_relation.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.create_time
*
* @param createTime the value for tab_haoban_store_relation.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_store_relation.update_time
*
* @return the value of tab_haoban_store_relation.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_store_relation.update_time
*
* @param updateTime the value for tab_haoban_store_relation.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.pojo;
import com.alibaba.fastjson.annotation.JSONField;
/**
* Created 2020/5/27.
*
* @author hua
*/
public class GroupSyncPojo extends BinlogBasePojo {
@JSONField(name = "store_group_chain")
private String storeGroupChain;
@JSONField(name = "store_group_id")
private String storeGroupId;
@JSONField(name = "enterprise_id")
private String enterpriseId;
private Integer status;
private Integer oldStatus;
public String getStoreGroupChain() {
return storeGroupChain;
}
public void setStoreGroupChain(String storeGroupChain) {
this.storeGroupChain = storeGroupChain;
}
public String getStoreGroupId() {
return storeGroupId;
}
public void setStoreGroupId(String storeGroupId) {
this.storeGroupId = storeGroupId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOldStatus() {
return oldStatus;
}
public void setOldStatus(Integer oldStatus) {
this.oldStatus = oldStatus;
}
}
package com.gic.haoban.manage.service.pojo;
import com.alibaba.fastjson.annotation.JSONField;
/**
* Created 2020/5/27.
*
* @author hua
*/
public class StoreSyncPojo extends BinlogBasePojo {
@JSONField(name = "store_group_id")
private String storeGroupId;
@JSONField(name = "storeId")
private String storeId;
@JSONField(name = "store_code")
private String storeCode;
@JSONField(name = "enterprise_id")
private String enterpriseId;
private Integer status;
private Integer oldStatus;
public String getStoreGroupId() {
return storeGroupId;
}
public void setStoreGroupId(String storeGroupId) {
this.storeGroupId = storeGroupId;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOldStatus() {
return oldStatus;
}
public void setOldStatus(Integer oldStatus) {
this.oldStatus = oldStatus;
}
}
...@@ -17,4 +17,6 @@ public interface MaterialService { ...@@ -17,4 +17,6 @@ public interface MaterialService {
com.github.pagehelper.Page listMaterial(String wxEnterpriseId, String keyword, String categoryId, com.github.pagehelper.Page listMaterial(String wxEnterpriseId, String keyword, String categoryId,
Integer materialType); Integer materialType);
MaterialDTO getMaterialByFromMaterialId(String fromMaterialId, String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.StoreOrGroupInfoDTO;
import com.gic.haoban.manage.service.entity.TabStoreRange;
import com.gic.haoban.manage.service.entity.TabStoreRelation;
import java.util.List;
/**
* Created 2021/4/9.
*
* @author hua
*/
public interface StoreRangeService {
/**
* 保存企业的关联关系
*
* @param relations
* @param enterpriseId
* @param wxEnterpriseId
* @return
*/
public boolean saveStoreRange(List<StoreOrGroupInfoDTO> relations, String enterpriseId, String wxEnterpriseId);
/**
* 绑定列表
*
* @param enterpriseId
* @param wxEnterpriseId
* @return
*/
public List<StoreOrGroupInfoDTO> queryBindStoreRange(String enterpriseId, String wxEnterpriseId);
/**
* 获取商户所有绑定列表
*
* @param enterpriseId
* @return
*/
public List<TabStoreRange> queryAllBindRangeByEnterpriseId(String enterpriseId);
/**
* 删除分组id
*
* @param enterpriseId
* @param relationId
* @return
*/
public boolean delStoreRangeByRelationId(String enterpriseId, String relationId);
/**
* 删除门店
*
* @param enterpriseId
* @param storeId
* @return
*/
public boolean delStoreRelationByStoreId(String enterpriseId, String storeId);
/**
* 获取商户所有绑定列表 搜索
*
* @param enterpriseId
* @param wxEnterpriseId
* @param search
* @param pageInfo
* @return
*/
public Page<TabStoreRelation> pageStoreRelation(String enterpriseId, String wxEnterpriseId, String search, BasePageInfo pageInfo);
}
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import java.util.List; import java.util.List;
...@@ -8,7 +9,16 @@ public interface WxEnterpriseRelatedService { ...@@ -8,7 +9,16 @@ public interface WxEnterpriseRelatedService {
TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId); TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId);
@Deprecated
TabHaobanWxEnterpriseRelated getEnterpriseByGicEnterpriseId(String gicEnterpriseId); TabHaobanWxEnterpriseRelated getEnterpriseByGicEnterpriseId(String gicEnterpriseId);
List<TabHaobanWxEnterpriseRelated> getByWxEnterpriseId(String wxEnterpriseId); List<TabHaobanWxEnterpriseRelated> getByWxEnterpriseId(String wxEnterpriseId);
/**
* 获取企业关联列表 根据商户id
*
* @param enterpriseId
* @return
*/
List<TabHaobanWxEnterprise> listByEnterpriseId(String enterpriseId);
} }
...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.impl; ...@@ -3,6 +3,7 @@ package com.gic.haoban.manage.service.service.impl;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -44,6 +45,13 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -44,6 +45,13 @@ public class MaterialServiceImpl implements MaterialService {
public void edit(MaterialDTO materialDTO) { public void edit(MaterialDTO materialDTO) {
materialDTO.setUpdateTime(new Date()); materialDTO.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanMaterial.class, materialDTO)); mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanMaterial.class, materialDTO));
List<TabHaobanMaterial> materials = mapper.listByfromMaterialId(materialDTO.getMaterialId());
if (CollectionUtils.isEmpty(materials)) {
return;
}
} }
@Override @Override
...@@ -51,4 +59,9 @@ public class MaterialServiceImpl implements MaterialService { ...@@ -51,4 +59,9 @@ public class MaterialServiceImpl implements MaterialService {
return mapper.listMaterial(wxEnterpriseId,keyword,categoryId,materialType); return mapper.listMaterial(wxEnterpriseId,keyword,categoryId,materialType);
} }
@Override
public MaterialDTO getMaterialByFromMaterialId(String fromMaterialId, String wxEnterpriseId) {
TabHaobanMaterial tabHaobanMaterial = mapper.selectByfromMaterialId(fromMaterialId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(MaterialDTO.class, tabHaobanMaterial);
}
} }
package com.gic.haoban.manage.service.service.impl;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StoreOrGroupInfoDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRangeMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRelationMapper;
import com.gic.haoban.manage.service.entity.TabStoreRange;
import com.gic.haoban.manage.service.entity.TabStoreRelation;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created 2021/4/9.
*
* @author hua
*/
public class StoreRangeServiceImpl implements StoreRangeService {
@Autowired
private TabHaobanStoreRangeMapper tabHaobanStoreRangeMapper;
@Autowired
private TabHaobanStoreRelationMapper tabHaobanStoreRelationMapper;
@Override
public boolean saveStoreRange(List<StoreOrGroupInfoDTO> relations, String enterpriseId, String wxEnterpriseId) {
tabHaobanStoreRangeMapper.deleteByEnterpriseId(wxEnterpriseId, enterpriseId);
List<TabStoreRange> ranges = relations.stream().map(dto -> {
TabStoreRange tabStoreRange = new TabStoreRange();
tabStoreRange.setEnterpriseId(enterpriseId);
tabStoreRange.setWxEnterpriseId(wxEnterpriseId);
tabStoreRange.setRelationId(dto.getRelationId());
tabStoreRange.setRelationType(dto.getRelationType());
tabStoreRange.setStoreRangeId(ToolUtil.randomUUID());
return tabStoreRange;
}).collect(Collectors.toList());
tabHaobanStoreRangeMapper.insertBatch(ranges);
return true;
}
@Override
public List<StoreOrGroupInfoDTO> queryBindStoreRange(String enterpriseId, String wxEnterpriseId) {
List<TabStoreRange> tabStoreRanges = tabHaobanStoreRangeMapper.queryByEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(tabStoreRanges)) {
return null;
}
return tabStoreRanges.stream().map(tab -> {
StoreOrGroupInfoDTO infoDTO = new StoreOrGroupInfoDTO();
infoDTO.setRelationId(tab.getRelationId());
infoDTO.setRelationType(tab.getRelationType());
return infoDTO;
}).collect(Collectors.toList());
}
@Override
public List<TabStoreRange> queryAllBindRangeByEnterpriseId(String enterpriseId) {
List<TabStoreRange> tabStoreRanges = tabHaobanStoreRangeMapper.queryByEnterpriseId(null, enterpriseId);
if (CollectionUtils.isEmpty(tabStoreRanges)) {
return null;
}
return tabStoreRanges;
}
@Override
public boolean delStoreRangeByRelationId(String enterpriseId, String relationId) {
tabHaobanStoreRangeMapper.delStoreRangeByRelationId(relationId, enterpriseId);
return true;
}
@Override
public boolean delStoreRelationByStoreId(String enterpriseId, String storeId) {
tabHaobanStoreRelationMapper.deleteStoreRalation(enterpriseId, storeId);
return true;
}
@Override
public Page<TabStoreRelation> pageStoreRelation(String enterpriseId, String wxEnterpriseId, String search, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo);
List<TabStoreRelation> storeRelations = tabHaobanStoreRelationMapper.searchStoreRange(wxEnterpriseId, enterpriseId, search);
Page<TabStoreRelation> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(storeRelations));
return retPage;
}
}
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -8,13 +12,24 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; ...@@ -8,13 +12,24 @@ import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService; import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
@Service @Service
public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedService { public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedService {
private static final Logger logger = getLogger(WxEnterpriseRelatedServiceImpl.class);
@Autowired @Autowired
private WxEnterpriseRelatedMapper mapper; private WxEnterpriseRelatedMapper mapper;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Override @Override
public TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId) { public TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId) {
...@@ -23,6 +38,7 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic ...@@ -23,6 +38,7 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
@Override @Override
public TabHaobanWxEnterpriseRelated getEnterpriseByGicEnterpriseId(String gicEnterpriseId) { public TabHaobanWxEnterpriseRelated getEnterpriseByGicEnterpriseId(String gicEnterpriseId) {
//todo 销售线索-不能根据eid查询微信企业 因为目前一对多 需要改
TabHaobanWxEnterpriseRelated tab = mapper.findOneByEnterpriseId(gicEnterpriseId); TabHaobanWxEnterpriseRelated tab = mapper.findOneByEnterpriseId(gicEnterpriseId);
return tab; return tab;
} }
...@@ -33,4 +49,15 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic ...@@ -33,4 +49,15 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
return list; return list;
} }
@Override
public List<TabHaobanWxEnterprise> listByEnterpriseId(String enterpriseId) {
List<String> eids = new ArrayList<>();
eids.add(enterpriseId);
List<TabHaobanWxEnterpriseRelated> relateds = mapper.listEnterpriseByEnterpriseIds(eids);
if (CollectionUtils.isEmpty(relateds)) {
return null;
}
Set<String> wxEnterpriseIds = relateds.stream().map(tab -> tab.getWxEnterpriseId()).collect(Collectors.toSet());
return wxEnterpriseMapper.listByIds(wxEnterpriseIds);
}
} }
...@@ -5,6 +5,7 @@ import java.net.URL; ...@@ -5,6 +5,7 @@ import java.net.URL;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.gic.haoban.base.api.common.ServiceResponse;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -89,6 +90,7 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -89,6 +90,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
public void editCategory(MaterialCategoryDTO materialCategoryDTO) { public void editCategory(MaterialCategoryDTO materialCategoryDTO) {
materialCategoryService.editCategory(materialCategoryDTO); materialCategoryService.editCategory(materialCategoryDTO);
} }
@Override @Override
...@@ -272,4 +274,32 @@ public class MaterialApiServiceImpl implements MaterialApiService { ...@@ -272,4 +274,32 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return materialCategoryService.listByParentCategory(categoryId); return materialCategoryService.listByParentCategory(categoryId);
} }
@Override
public ServiceResponse<Void> shareMaterial(String wxEnterpriseId, String toWxEnterpriseId, String materialId) {
ServiceResponse<Void> res = new ServiceResponse<>();
MaterialDTO materialDTO = materialService.selectMaterialById(materialId);
if (null == materialDTO) {
logger.info("不存在该素材");
res.setCode(2);
res.setMessage("不存在该素材");
return res;
}
if (!materialDTO.getFromMaterialId().equals("-1")) {
logger.info("该素材不允许分享");
res.setCode(3);
res.setMessage("该素材不允许分享");
return res;
}
MaterialDTO fromMaterialDTO = materialService.getMaterialByFromMaterialId(materialId, toWxEnterpriseId);
if (fromMaterialDTO != null) {
logger.info("已经存在素材,不能重复分享");
res.setCode(4);
res.setMessage("已经存在素材,不能重复分享");
return res;
}
materialDTO.setWxEnterpriseId(toWxEnterpriseId);
materialDTO.setFromMaterialId(materialId);
materialService.insertMaterial(materialDTO);
return res;
}
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.dto.*;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.StoreRangeService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.GicTreeDTO;
import com.gic.enterprise.api.service.EnterpriseService; import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreGroupService; import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService; import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.DepartmentService; import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService; import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApiService { public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApiService {
...@@ -45,6 +50,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -45,6 +50,12 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
@Autowired @Autowired
private EnterpriseService enterpriseService; private EnterpriseService enterpriseService;
@Autowired
private StoreRangeService storeRangeService;
@Autowired
private StoreService storeService;
//获取门店详情 //获取门店详情
public boolean isEnterpriseOver(String eid) { public boolean isEnterpriseOver(String eid) {
...@@ -213,4 +224,109 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi ...@@ -213,4 +224,109 @@ public class WxEnterpriseRelatedApiServiceImpl implements WxEnterpriseRelatedApi
} }
return 0; return 0;
} }
@Transactional(rollbackFor = Exception.class)
@Override
public int wxEnterpriseBind(WxEnterpriseRelationDetailDTO detailDTO) {
TabHaobanWxEnterpriseRelated tab = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(detailDTO.getEnterpriseId(), detailDTO.getWxEnterpriseId());
if (tab == null) {
logger.info("该gicEnterpriseId已经绑定过了:{}", JSONObject.toJSONString(detailDTO));
//保存企业关联关系
tab = EntityUtil.changeEntityNew(TabHaobanWxEnterpriseRelated.class, detailDTO);
tab.setStatusFlag(1);
tab.setCreateTime(new Date());
tab.setUpdateTime(new Date());
tab.setWxEnterpriseRelatedId(UuidUtil.randomUUID());
wxEnterpriseRelatedMapper.insertSelective(tab);
}
//保存门店范围
storeRangeService.saveStoreRange(detailDTO.getRelations(), detailDTO.getEnterpriseId(), detailDTO.getWxEnterpriseId());
//超级管理员新增
TabHaobanStaff sStaff = staffMapper.selectSuperByWxEnterpriseId(detailDTO.getWxEnterpriseId());
if (sStaff == null) {
TabHaobanStaff staff = new TabHaobanStaff();
staff.setStaffName("超级管理员");
staff.setWxEnterpriseId(detailDTO.getWxEnterpriseId());
staff.setSuperManagerFlag(1);
staffService.add(staff);
}
return 0;
}
@Override
public boolean flushBindStoreByEnterpriseId(String enterpriseId, String wxEnterpriseId, String staffId) {
logger.info("刷新绑定门店:eid:{},staffid:{}", enterpriseId, staffId);
List<TabStoreRange> groupInfoDTOS = storeRangeService.queryAllBindRangeByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(groupInfoDTOS)) {
logger.info("无需刷新:{}", enterpriseId);
return true;
}
//根据微信企业分组 wxEnterpriseId->(List)groupId
Map<String, Set<String>> relationMapByWxEid = groupInfoDTOS.stream().filter(tab -> tab.getRelationType() == 1)
.collect(Collectors.groupingBy(tab -> tab.getWxEnterpriseId(), Collectors.mapping(tab -> tab.getRelationId(), Collectors.toSet())));
//分组所在的企业map groupId->wxEnterpriseId
Map<String, String> groupMap = groupInfoDTOS.stream().filter(tab -> tab.getRelationType() == 1)
.collect(Collectors.toMap(tab -> tab.getRelationId(), tab -> tab.getWxEnterpriseId()));
// 获取所有门店信息
List<StoreSimpleDTO> storeDtos = storeService.listSimpleStore(enterpriseId, null, null);
Map<String, List<String>> storeMapByGroupId = storeDtos.stream().collect(Collectors.groupingBy(dto -> dto.getStoreGroupId(), Collectors.mapping(dto -> dto.getStoreId(), Collectors.toList())));
//获取所有门店分组
List<PowerStoreGroupDTO> storeGroupList = storeGroupService.getStoreGroupList(enterpriseId, null);
Map<String, Set<String>> storeGroupChainMap = storeGroupList.stream().collect(Collectors.toMap(dto -> dto.getStoreGroupId(),
dto -> Arrays.stream(dto.getStoreGroupChain().split("-")).filter(str -> StringUtils.isNotBlank(str)).collect(Collectors.toSet())));
return false;
}
@Override
public WxEnterpriseRelationDetailDTO getEnterpriseBindInfo(String wxEnterpriseId, String enterpriseId) {
TabHaobanWxEnterpriseRelated wxEnterpriseRelated = wxEnterpriseRelatedMapper.findOneByEIdAndWxEid(enterpriseId, wxEnterpriseId);
if (null == wxEnterpriseRelated) {
logger.info("企业未绑定:eid:{},weid:{}", enterpriseId, wxEnterpriseId);
return null;
}
List<StoreOrGroupInfoDTO> infoDTOS = storeRangeService.queryBindStoreRange(enterpriseId, wxEnterpriseId);
WxEnterpriseRelationDetailDTO detailDTO = new WxEnterpriseRelationDetailDTO();
detailDTO.setRelations(infoDTOS);
detailDTO.setEnterpriseId(enterpriseId);
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(enterpriseId);
if (null == enterpriseDTO) {
detailDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName());
}
detailDTO.setMemberOpenCardFlag(wxEnterpriseRelated.getMemberOpenCardFlag());
detailDTO.setWxEnterpriseType(wxEnterpriseRelated.getWxEnterpriseType());
return detailDTO;
}
@Override
public List<WxEnterpriseDTO> listWxEnterpriseByEid(String enterpriseId) {
List<TabHaobanWxEnterprise> wxEnterprises = wxEnterpriseRelatedService.listByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(wxEnterprises)) {
logger.info("没有关联企业");
return null;
}
List<WxEnterpriseDTO> ret = EntityUtil.changeEntityListNew(WxEnterpriseDTO.class, wxEnterprises);
return ret;
}
@Override
public Page<BindStoreInfoDTO> pageBindStoreByEnterpriseId(String wxEnterpriseId, String enterpriseId, String search, BasePageInfo pageInfo) {
Page<TabStoreRelation> relationPage = storeRangeService.pageStoreRelation(enterpriseId, wxEnterpriseId, search, pageInfo);
if (CollectionUtils.isEmpty(relationPage.getResult())) {
return null;
}
Page<BindStoreInfoDTO> retPage = PageUtil.changeToCurrentPage(relationPage, BindStoreInfoDTO.class);
List<String> storeIds = relationPage.getResult().stream().map(tab -> tab.getStoreId()).collect(Collectors.toList());
List<StoreDTO> dtoList = storeService.queryStore(storeIds);
retPage.setResult(EntityUtil.changeEntityListNew(BindStoreInfoDTO.class, dtoList));
return retPage;
}
} }
...@@ -17,8 +17,11 @@ import com.gic.haoban.manage.api.enums.ChannelCodeEnum; ...@@ -17,8 +17,11 @@ import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService; import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.pojo.BinlogBasePojo; import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
import com.gic.haoban.manage.service.pojo.ClerkSyncPojo; import com.gic.haoban.manage.service.pojo.ClerkSyncPojo;
import com.gic.haoban.manage.service.pojo.GroupSyncPojo;
import com.gic.haoban.manage.service.pojo.StoreSyncPojo;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService; import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.task.api.dto.MqMessageQo; import com.gic.haoban.task.api.dto.MqMessageQo;
import com.gic.mq.sdk.exception.RouterException; import com.gic.mq.sdk.exception.RouterException;
import com.gic.qcloud.cmq.CMQClientException; import com.gic.qcloud.cmq.CMQClientException;
...@@ -47,6 +50,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -47,6 +50,8 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
private final String CLERK = "tab_gic_clerk"; private final String CLERK = "tab_gic_clerk";
private final String GROUP = "tab_gic_store_group";
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
...@@ -59,6 +64,9 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -59,6 +64,9 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired @Autowired
private ClerkService clerkService; private ClerkService clerkService;
@Autowired
private StoreRangeService storeRangeService;
@Override @Override
public void onMessage(ConsumerRecord<String, GicRecord> record) { public void onMessage(ConsumerRecord<String, GicRecord> record) {
...@@ -98,6 +106,12 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -98,6 +106,12 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
} }
} }
} }
//分组
} else if (record.value().getTableName().equals(GROUP)) {
dealStoreGroup((GroupSyncPojo) pojo);
//门店
} else if (record.value().getTableName().equals(STORE)) {
dealStore((StoreSyncPojo) pojo);
} }
} }
...@@ -169,8 +183,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -169,8 +183,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
if(record.getTableName().equals(CLERK)) { if(record.getTableName().equals(CLERK)) {
return binlogMap(record.getFieldList(),record.getRecordType(),ClerkSyncPojo.class); return binlogMap(record.getFieldList(),record.getRecordType(),ClerkSyncPojo.class);
}else if (record.getTableName().equals(STORE)) { }else if (record.getTableName().equals(STORE)) {
return binlogMap(record.getFieldList(),record.getRecordType(),ClerkSyncPojo.class); return binlogMap(record.getFieldList(), record.getRecordType(), StoreSyncPojo.class);
}else{ } else if (record.getTableName().equals(GROUP)) {
return binlogMap(record.getFieldList(), record.getRecordType(), GroupSyncPojo.class);
} else {
return null; return null;
} }
} }
...@@ -192,5 +208,32 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor ...@@ -192,5 +208,32 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
} }
/**
* 门店的处理
*
* @param syncPojo
*/
private void dealStore(StoreSyncPojo syncPojo) {
//删除门店 删除门店关联门店
if (syncPojo.getStatus() == 0) {
storeRangeService.delStoreRangeByRelationId(syncPojo.getEnterpriseId(), syncPojo.getStoreId());
//删除门店
storeRangeService.delStoreRelationByStoreId(syncPojo.getEnterpriseId(), syncPojo.getStoreId());
}
}
/**
* 门店分组的处理
*
* @param syncPojo
*/
private void dealStoreGroup(GroupSyncPojo syncPojo) {
//删除
if (syncPojo.getOldStatus() == 1 && syncPojo.getStatus() == 0) {
storeRangeService.delStoreRangeByRelationId(syncPojo.getEnterpriseId(), syncPojo.getStoreGroupId());
}
}
} }
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<list> <list>
<value>haoban_gic_clerk</value> <value>haoban_gic_clerk</value>
<value>haoban_gic_store</value> <value>haoban_gic_store</value>
<value>haoban_gic_store_group</value>
</list> </list>
</constructor-arg> </constructor-arg>
<property name="messageListener" ref="kafkaConsumerService"/> <property name="messageListener" ref="kafkaConsumerService"/>
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanMaterial" > <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanMaterial" >
<id column="material_id" property="materialId" jdbcType="VARCHAR" /> <id column="material_id" property="materialId" jdbcType="VARCHAR" />
<result column="material_title" property="materialTitle" jdbcType="VARCHAR" /> <result column="material_title" property="materialTitle" jdbcType="VARCHAR" />
<result column="from_material_id" property="fromMaterialId" jdbcType="VARCHAR"/>
<result column="material_type" property="materialType" jdbcType="INTEGER" /> <result column="material_type" property="materialType" jdbcType="INTEGER" />
<result column="category_id" property="categoryId" jdbcType="VARCHAR" /> <result column="category_id" property="categoryId" jdbcType="VARCHAR" />
<result column="material_content" property="materialContent" jdbcType="VARCHAR" /> <result column="material_content" property="materialContent" jdbcType="VARCHAR" />
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
material_id, material_title, material_type, category_id, material_content, wx_last_upload_time, material_id,from_material_id, material_title, material_type, category_id, material_content, wx_last_upload_time,
media_id, wx_enterprise_id, staff_id, staff_name, img_url, material_desc, status_flag, media_id, wx_enterprise_id, staff_id, staff_name, img_url, material_desc, status_flag,
link, create_time, update_time,wx_img_url link, create_time, update_time,wx_img_url
</sql> </sql>
...@@ -36,13 +37,14 @@ ...@@ -36,13 +37,14 @@
where material_id = #{materialId,jdbcType=VARCHAR} where material_id = #{materialId,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaterial" > <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaterial" >
insert into tab_haoban_material (material_id, material_title, material_type, insert into tab_haoban_material (material_id, from_material_id, material_title, material_type,
category_id, material_content, wx_last_upload_time, category_id, material_content, wx_last_upload_time,
media_id, wx_enterprise_id, staff_id, media_id, wx_enterprise_id, staff_id,
staff_name, img_url,wx_img_url, material_desc, staff_name, img_url,wx_img_url, material_desc,
status_flag, link, create_time, status_flag, link, create_time,
update_time) update_time)
values (#{materialId,jdbcType=VARCHAR}, #{materialTitle,jdbcType=VARCHAR}, #{materialType,jdbcType=INTEGER}, values (#{materialId,jdbcType=VARCHAR},#{fromMaterialId}, #{materialTitle,jdbcType=VARCHAR},
#{materialType,jdbcType=INTEGER},
#{categoryId,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=TIMESTAMP}, #{categoryId,jdbcType=VARCHAR}, #{materialContent,jdbcType=VARCHAR}, #{wxLastUploadTime,jdbcType=TIMESTAMP},
#{mediaId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR}, #{mediaId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{staffName,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{wxImgUrl,jdbcType=VARCHAR}, #{materialDesc,jdbcType=VARCHAR}, #{staffName,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR},#{wxImgUrl,jdbcType=VARCHAR}, #{materialDesc,jdbcType=VARCHAR},
...@@ -260,4 +262,21 @@ ...@@ -260,4 +262,21 @@
order by update_time desc order by update_time desc
</select> </select>
<select id="selectByfromMaterialId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_material
where from_material_id = #{materialId,jdbcType=VARCHAR}
and status_flag=1
and wx_enterprise_id=#{wxEnterpriseId}
</select>
<select id="listByfromMaterialId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_material
where from_material_id = #{materialId,jdbcType=VARCHAR}
and status_flag=1
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRangeMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabStoreRange">
<id column="store_range_id" jdbcType="VARCHAR" property="storeRangeId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId"/>
<result column="relation_id" jdbcType="VARCHAR" property="relationId"/>
<result column="relation_type" jdbcType="INTEGER" property="relationType"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
store_range_id, wx_enterprise_id, enterprise_id, relation_id, relation_type, status_flag,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_store_range
where store_range_id = #{storeRangeId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_store_range
where store_range_id = #{storeRangeId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabStoreRange">
insert into tab_haoban_store_range (store_range_id, wx_enterprise_id, enterprise_id,
relation_id, relation_type, status_flag,
create_time, update_time)
values (#{storeRangeId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{relationId,jdbcType=VARCHAR}, #{relationType,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabStoreRange">
insert into tab_haoban_store_range
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeRangeId != null">
store_range_id,
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="relationId != null">
relation_id,
</if>
<if test="relationType != null">
relation_type,
</if>
<if test="statusFlag != null">
status_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeRangeId != null">
#{storeRangeId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="relationId != null">
#{relationId,jdbcType=VARCHAR},
</if>
<if test="relationType != null">
#{relationType,jdbcType=INTEGER},
</if>
<if test="statusFlag != null">
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabStoreRange">
update tab_haoban_store_range
<set>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="relationId != null">
relation_id = #{relationId,jdbcType=VARCHAR},
</if>
<if test="relationType != null">
relation_type = #{relationType,jdbcType=INTEGER},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where store_range_id = #{storeRangeId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabStoreRange">
update tab_haoban_store_range
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
relation_id = #{relationId,jdbcType=VARCHAR},
relation_type = #{relationType,jdbcType=INTEGER},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where store_range_id = #{storeRangeId,jdbcType=VARCHAR}
</update>
<select id="queryByEnterpriseId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_store_range
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
<if test="wxEnterpriseId!=null">
and wx_enterprise_id=#{wxEnterpriseId}
</if>
and status_flag =1
</select>
<update id="deleteByEnterpriseId">
update tab_haoban_store_range
SET
status_flag = 0,
update_time = now()
where
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and wx_enterprise_id=#{wxEnterpriseId}
and status_flag =1
</update>
<update id="delStoreRangeByRelationId">
update tab_haoban_store_range
SET
status_flag = 0,
update_time = now()
where
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and relation_id=#{relationId}
and status_flag =1
</update>
<insert id="insertBatch">
insert into tab_haoban_store_range (store_range_id, wx_enterprise_id, enterprise_id,
relation_id, relation_type, status_flag,
create_time, update_time)
values
<foreach collection="list" item="item" open="(" close=")" separator=",">
(#{storeRangeId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{relationId,jdbcType=VARCHAR}, #{relationType,jdbcType=INTEGER}, 1,
now(), now())
</foreach>
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRelationMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabStoreRelation">
<id column="store_relation_id" jdbcType="VARCHAR" property="storeRelationId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="store_id" jdbcType="VARCHAR" property="storeId"/>
<result column="store_group_id" jdbcType="VARCHAR" property="storeGroupId"/>
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
store_relation_id, wx_enterprise_id, store_id, store_group_id, enterprise_id, status_flag,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_store_relation
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_store_relation
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
insert into tab_haoban_store_relation (store_relation_id, wx_enterprise_id,
store_id, store_group_id, enterprise_id,
status_flag, create_time, update_time
)
values (#{storeRelationId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR},
#{storeId,jdbcType=VARCHAR}, #{storeGroupId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR},
#{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
insert into tab_haoban_store_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeRelationId != null">
store_relation_id,
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id,
</if>
<if test="storeId != null">
store_id,
</if>
<if test="storeGroupId != null">
store_group_id,
</if>
<if test="enterpriseId != null">
enterprise_id,
</if>
<if test="statusFlag != null">
status_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeRelationId != null">
#{storeRelationId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null">
#{storeId,jdbcType=VARCHAR},
</if>
<if test="storeGroupId != null">
#{storeGroupId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
#{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
update tab_haoban_store_relation
<set>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="storeId != null">
store_id = #{storeId,jdbcType=VARCHAR},
</if>
<if test="storeGroupId != null">
store_group_id = #{storeGroupId,jdbcType=VARCHAR},
</if>
<if test="enterpriseId != null">
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabStoreRelation">
update tab_haoban_store_relation
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
store_id = #{storeId,jdbcType=VARCHAR},
store_group_id = #{storeGroupId,jdbcType=VARCHAR},
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where store_relation_id = #{storeRelationId,jdbcType=VARCHAR}
</update>
<update id="deleteStoreRalation">
update tab_haoban_store_relation
set
status_flag = 0,
update_time = now()
where store_id = #{storeId,jdbcType=VARCHAR}
and enterprise_id=#{enterpriseId}
and status_flag=1
</update>
<select id="searchStoreRange" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_store_relation
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and store_name like concat("%",#{search},"%")
and status_flag=1
</select>
</mapper>
\ No newline at end of file
...@@ -9,11 +9,14 @@ ...@@ -9,11 +9,14 @@
<result column="staff_id" property="staffId" jdbcType="VARCHAR" /> <result column="staff_id" property="staffId" jdbcType="VARCHAR" />
<result column="staff_name" property="staffName" jdbcType="VARCHAR" /> <result column="staff_name" property="staffName" jdbcType="VARCHAR" />
<result column="status_flag" property="statusFlag" jdbcType="INTEGER" /> <result column="status_flag" property="statusFlag" jdbcType="INTEGER" />
<result column="wx_enterprise_type" property="wxEnterpriseType" jdbcType="INTEGER"/>
<result column="member_open_card_flag" property="memberOpenCardFlag" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
wx_enterprise_related_id, wx_enterprise_id, enterprise_id, version, status_flag, wx_enterprise_related_id, wx_enterprise_id, enterprise_id, version, status_flag, wx_enterprise_type,
member_open_card_flag,
create_time, update_time,staff_id,staff_name create_time, update_time,staff_id,staff_name
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
...@@ -52,6 +55,12 @@ ...@@ -52,6 +55,12 @@
<if test="statusFlag != null" > <if test="statusFlag != null" >
status_flag, status_flag,
</if> </if>
<if test="wxEnterpriseType != null">
wx_enterprise_type,
</if>
<if test="memberOpenCardFlag != null">
member_open_card_flag,
</if>
<if test="createTime != null" > <if test="createTime != null" >
create_time, create_time,
</if> </if>
...@@ -81,6 +90,12 @@ ...@@ -81,6 +90,12 @@
<if test="statusFlag != null" > <if test="statusFlag != null" >
#{statusFlag,jdbcType=INTEGER}, #{statusFlag,jdbcType=INTEGER},
</if> </if>
<if test="wxEnterpriseType != null">
#{wxEnterpriseType,jdbcType=INTEGER},
</if>
<if test="memberOpenCardFlag != null">
#{memberOpenCardFlag,jdbcType=INTEGER},
</if>
<if test="createTime != null" > <if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
...@@ -179,4 +194,11 @@ ...@@ -179,4 +194,11 @@
AND DATE_FORMAT(update_time,'%Y-%m-%d') = #{time} AND DATE_FORMAT(update_time,'%Y-%m-%d') = #{time}
</select> </select>
<select id="findOneByEIdAndWxEid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise_related
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and status_flag = 1 and wx_enterprise_id=#{wxEnterpriseId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -211,12 +211,25 @@ public class ServiceTest { ...@@ -211,12 +211,25 @@ public class ServiceTest {
// } // }
// //
// //
// @Test @Test
// public void extensionList() { public void extensionList() {
//
// String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "de2c33f2e8924ff884e0073ca2f2f711"); {
// System.out.println(JSONObject.toJSONString(s)); String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "01YQ-pcdYzF3K0So8uCFfkB5i8D5EBW7KcVB4qA8Ktk", "9ae4c4f1277340a186b16a17d937c72c");
// } System.out.println("============客户联系========");
System.out.println(JSONObject.toJSONString(s));
}
{
String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "65zze159pYb4ofbFsIREZ5X7d7iaZ-bWsVIQk2y5kTU", "9ae4c4f1277340a186b16a17d937c72c");
System.out.println("============好办助手========");
System.out.println(JSONObject.toJSONString(s));
}
{
String s = qywxUserApiService.listSelfExternalUserid("ww9ede832a84b7ae5f", "IOJJKhQYu7SDjb9T8W8fBOUjpszI0b73XDQ-9eqlHmE", "9ae4c4f1277340a186b16a17d937c72c");
System.out.println("============会员小程序========");
System.out.println(JSONObject.toJSONString(s));
}
}
// @Test // @Test
// public void extensionList1() { // public void extensionList1() {
// UserDTO selfWorkWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "65zze159pYb4ofbFsIREZ5X7d7iaZ-bWsVIQk2y5kTU", "de2c33f2e8924ff884e0073ca2f2f711"); // UserDTO selfWorkWxUser = qywxUserApiService.getSelfWorkWxUser("ww9ede832a84b7ae5f", "65zze159pYb4ofbFsIREZ5X7d7iaZ-bWsVIQk2y5kTU", "de2c33f2e8924ff884e0073ca2f2f711");
......
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import 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.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.MaterialCategoryDTO; 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.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
...@@ -19,6 +12,12 @@ import com.gic.haoban.manage.api.service.MaterialApiService; ...@@ -19,6 +12,12 @@ import com.gic.haoban.manage.api.service.MaterialApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController @RestController
public class MaterialController extends WebBaseController{ public class MaterialController extends WebBaseController{
...@@ -212,4 +211,21 @@ public class MaterialController extends WebBaseController{ ...@@ -212,4 +211,21 @@ public class MaterialController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1); return resultResponse(HaoBanErrCode.ERR_1);
} }
/**
* 分析素材
*
* @return
*/
@RequestMapping("/material-share")
public HaobanResponse materialShare(String materialId, String toWxEnterpriseId) {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
ServiceResponse<Void> response = materialApiService.shareMaterial(login.getWxEnterpriseId(), toWxEnterpriseId, materialId);
if (response.getCode() == 1) {
return resultResponse(HaoBanErrCode.ERR_1);
} else {
HaoBanErrCode.ERR_DEFINE.setMsg(response.getMessage());
return resultResponse(HaoBanErrCode.ERR_DEFINE);
}
}
} }
...@@ -3,7 +3,6 @@ package com.gic.haoban.manage.web.controller; ...@@ -3,7 +3,6 @@ package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil; import com.gic.commons.util.DateUtil;
import com.gic.enterprise.api.dto.EnterpriseAndUserDTO; import com.gic.enterprise.api.dto.EnterpriseAndUserDTO;
...@@ -15,21 +14,14 @@ import com.gic.enterprise.api.service.StoreService; ...@@ -15,21 +14,14 @@ import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
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.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService; import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.anno.IgnoreLogin; import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
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.WxEnterpriseBindQo;
import com.gic.haoban.manage.web.vo.EnterpriseSearchVO; import com.gic.haoban.manage.web.vo.EnterpriseSearchVO;
import com.gic.haoban.manage.web.vo.LoginVO; import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.haoban.manage.web.vo.SecretSettingVO; import com.gic.haoban.manage.web.vo.SecretSettingVO;
...@@ -48,7 +40,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -48,7 +40,10 @@ 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 org.springframework.web.bind.annotation.RestController;
import java.util.*; import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@RestController @RestController
...@@ -167,16 +162,24 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -167,16 +162,24 @@ public class WxEnterpriseController extends WebBaseController{
//微信企业绑定接口 //微信企业绑定接口
@IgnoreLogin @IgnoreLogin
@RequestMapping("wx-enterprise-bind") @RequestMapping("wx-enterprise-bind")
public HaobanResponse wxEnterpriseBind(String enterpriseId,String wxEnterpriseId,String version) { public HaobanResponse wxEnterpriseBind(WxEnterpriseBindQo bindQo) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(enterpriseId,version)){ if (org.apache.commons.lang3.StringUtils.isAnyBlank(bindQo.getEnterpriseId(), bindQo.getVersion())) {
return resultResponse(HaoBanErrCode.ERR_2); return resultResponse(HaoBanErrCode.ERR_2);
} }
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
StaffDTO staff = login.getStaffDTO(); StaffDTO staff = login.getStaffDTO();
String staffId = staff.getStaffId(); String staffId = staff.getStaffId();
String staffName = staff.getStaffName(); String staffName = staff.getStaffName();
int i = wxEnterpriseRelatedApiService.wxEnterpriseBind(enterpriseId,wxEnterpriseId,version,staffId,staffName);
WxEnterpriseRelationDetailDTO detailDTO = EntityUtil.changeEntityByOrika(WxEnterpriseRelationDetailDTO.class, bindQo);
detailDTO.setEnterpriseId(bindQo.getEnterpriseId());
detailDTO.setWxEnterpriseId(wxEnterpriseId);
detailDTO.setStaffId(staffId);
detailDTO.setStaffName(staffName);
List<StoreOrGroupInfoDTO> storeOrGroupInfoDTOS = EntityUtil.changeEntityListByJSON(StoreOrGroupInfoDTO.class, bindQo.getRelations());
detailDTO.setRelations(storeOrGroupInfoDTOS);
int i = wxEnterpriseRelatedApiService.wxEnterpriseBind(detailDTO);
if(i==1){ if(i==1){
return resultResponse(HaoBanErrCode.ERR_10006); return resultResponse(HaoBanErrCode.ERR_10006);
} }
...@@ -568,20 +571,38 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -568,20 +571,38 @@ public class WxEnterpriseController extends WebBaseController{
} }
/** /**
* 获取刷新好友开关接口 * 微信企业绑定详情
*
* @param enterpriseId
* @return * @return
*/ */
@RequestMapping("/get-fresh-on-off") @IgnoreLogin
public HaobanResponse getFreshOnOff(){ @RequestMapping("wx-enterprise-bind-detail")
public HaobanResponse wxEnterpriseBindDetail(String enterpriseId) {
if (org.apache.commons.lang3.StringUtils.isAnyBlank(enterpriseId)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser(); LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
String dateKey = "haoban_fresh-wx-friend-enterprise";
Object value = RedisUtil.getCache(dateKey); WxEnterpriseRelationDetailDTO bindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId);
if(value != null){ return resultResponse(HaoBanErrCode.ERR_1, bindInfo);
String valueStr = value.toString();
return resultResponse(HaoBanErrCode.ERR_1,valueStr.contains(wxEnterpriseId));
} }
return resultResponse(HaoBanErrCode.ERR_1,false);
/**
* 绑定门店列表
*
* @param enterpriseId
* @return
*/
@IgnoreLogin
@RequestMapping("bind-store-list")
public HaobanResponse bindStoreList(String enterpriseId, String search, BasePageInfo basePageInfo) {
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
Page<BindStoreInfoDTO> retPage = wxEnterpriseRelatedApiService.pageBindStoreByEnterpriseId(wxEnterpriseId, enterpriseId, search, basePageInfo);
return resultResponse(HaoBanErrCode.ERR_1, retPage);
} }
} }
package com.gic.haoban.manage.web.qo;
import java.io.Serializable;
/**
* Created 2021/4/13.
*
* @author hua
*/
public class WxEnterpriseBindQo implements Serializable {
private String wxEnterpriseId;
private String enterpriseId;
private String version;
private int rangeType = 1;
private String relations;
/**
* 0 自动开卡同一开平 1加好友不开卡
*/
private int memberOpenCardFlag;
/**
* 企业微信类型 0 总部 1代理
*/
private int wxEnterpriseType;
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public int getRangeType() {
return rangeType;
}
public void setRangeType(int rangeType) {
this.rangeType = rangeType;
}
public String getRelations() {
return relations;
}
public void setRelations(String relations) {
this.relations = relations;
}
public int getMemberOpenCardFlag() {
return memberOpenCardFlag;
}
public void setMemberOpenCardFlag(int memberOpenCardFlag) {
this.memberOpenCardFlag = memberOpenCardFlag;
}
public int getWxEnterpriseType() {
return wxEnterpriseType;
}
public void setWxEnterpriseType(int wxEnterpriseType) {
this.wxEnterpriseType = wxEnterpriseType;
}
}
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