Commit e43400a9 by 徐高华

Merge branch 'feature/xgh/202506迭代' into 'master'

门店活码

See merge request !3065
parents 55294af3 0b1ce1b2
package com.gic.haoban.manage.api.dto.chat;
import java.io.Serializable;
import java.util.List;
/**
*
* @ClassName: StoreGroupChatHmDTO
* @Description: TODO
* @Author 徐高华
* @Date 2022年11月25日 15:30:48
* @Modify
* @CopyRight
*/
public class StoreGroupChatHmDTO implements Serializable {
private Long chatHmId;
private String chatHmCode;
private String wxEnterpriseId;
private String enterpriseId;
public Long getChatHmId() {
return chatHmId;
}
public void setChatHmId(Long chatHmId) {
this.chatHmId = chatHmId;
}
public String getChatHmCode() {
return chatHmCode;
}
public void setChatHmCode(String chatHmCode) {
this.chatHmCode = chatHmCode;
}
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;
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.gic.haoban.manage.api.service.hm;
import java.util.List;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.chat.StoreGroupChatHmDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkWxaDTO;
import com.gic.haoban.manage.api.qdto.chat.LinkHmFromWxaQDTO;
......@@ -71,4 +72,12 @@ public interface HmLinkApiService {
* @throws
*/
public ServiceResponse<HmLinkWxaDTO> getMemberClerkHm(String enterpriseId , String memberId , String unionid , Long linkId) ;
/**
* 获取门店详情活码
* @param enterpriseId
* @param storeId
* @return
*/
public ServiceResponse<StoreGroupChatHmDTO> getStoreGroupChatHm(String enterpriseId, String storeId);
}
......@@ -30,6 +30,8 @@ public interface TabHaobanStoreRelationMapper {
*/
List<TabStoreRelation> listStoreRange(@Param("enterpriseId") String enterpriseId);
List<TabStoreRelation> listStoreRangeByStorId(@Param("enterpriseId") String enterpriseId , @Param("storeId") String storeId);
/**
* 删除门店
*
......
......@@ -13,9 +13,14 @@ import com.gic.api.base.commons.BusinessException;
import com.gic.api.base.commons.Page;
import com.gic.enterprise.api.service.WechatStoreService;
import com.gic.haoban.manage.api.dto.chat.GroupChatActivityDTO;
import com.gic.haoban.manage.api.dto.chat.StoreGroupChatHmDTO;
import com.gic.haoban.manage.api.qdto.chat.GroupChatActivityHmQDTO;
import com.gic.haoban.manage.api.qdto.chat.LinkHmFromWxaQDTO;
import com.gic.haoban.manage.service.context.chat.JoinRuleManager;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStoreRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.entity.TabStoreRelation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -132,6 +137,10 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
private JoinRuleManager joinRuleManager ;
@Autowired
private WechatStoreService wechatStoreService;
@Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Autowired
private TabHaobanStoreRelationMapper tabHaobanStoreRelationMapper ;
@Override
......@@ -940,4 +949,38 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
log.info("活码数据返回={}", JSON.toJSONString(retDTO));
return ServiceResponse.success(retDTO);
}
@Override
public ServiceResponse<StoreGroupChatHmDTO> getStoreGroupChatHm(String enterpriseId, String inStoreId) {
List< TabHaobanWxEnterpriseRelated> enList = this.wxEnterpriseRelatedMapper.listByEnterpriseId(enterpriseId) ;
if(CollectionUtils.isEmpty(enList)) {
return ServiceResponse.failure("-1", "未关联好办") ;
}
String wxEnterpriseId = null ;
if(enList.size() == 1) {
log.info("只关联1个好办={}",enterpriseId);
wxEnterpriseId = enList.get(0).getWxEnterpriseId() ;
}else {
log.info("关联多个个好办={}",enterpriseId);
List<TabStoreRelation> storeList = this.tabHaobanStoreRelationMapper.listStoreRangeByStorId(enterpriseId, inStoreId) ;
if(CollectionUtils.isEmpty(storeList) || storeList.size()>1) {
return ServiceResponse.failure("-1", "绑定门店查询不到") ;
}
wxEnterpriseId = storeList.get(0).getWxEnterpriseId() ;
}
GroupChatActivityHmQDTO hmQDTO = new GroupChatActivityHmQDTO() ;
hmQDTO.setEnterpriseId(enterpriseId);
GroupChatActivityDTO chatActivity = new GroupChatActivityDTO() ;
chatActivity.setWxEnterpriseId(wxEnterpriseId);
hmQDTO.setChatActivity(chatActivity);
log.info("指定门店={},wxEnterpriseId={}",inStoreId,wxEnterpriseId);
hmQDTO.setInStoreId(inStoreId);
List<GroupChatHmBO> hmBOList = joinRuleManager.handleMainStore(hmQDTO);
if(CollectionUtils.isNotEmpty(hmBOList)) {
int sort = new Random().nextInt(hmBOList.size()) ;
GroupChatHmBO bo = hmBOList.get(sort) ;
return ServiceResponse.success(EntityUtil.changeEntityByJSON(StoreGroupChatHmDTO.class,bo)) ;
}
return ServiceResponse.failure("-1","无群活码");
}
}
......@@ -71,6 +71,14 @@
and status_flag=1
</select>
<select id="listStoreRangeByStorId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_store_relation
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and store_id = #{storeId}
and status_flag=1
</select>
<update id="deleteStoreRalationByStoreIds">
update tab_haoban_store_relation
set
......
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