Commit 6bb766cb by 徐高华

Merge remote-tracking branch 'origin/master_xgh_停用功能' into test_branch

Conflicts:
	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/WxEnterpriseService.java
	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/WxEnterpriseServiceImpl.java
	haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
parents e43f5fba 11027bf9
package com.gic.haoban.manage.api.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
public interface ClerkMainStoreRelatedApiService {
......@@ -7,6 +9,8 @@ public interface ClerkMainStoreRelatedApiService {
void setMainStore(String staffId, String storeId, String wxEnterpriseId);
ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId);
ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId , List<String> storeIdList);
/**
* 设置刷新好友状态为已刷新
......
......@@ -158,6 +158,17 @@ public interface ExternalClerkRelatedApiService {
@Deprecated
List<ExternalClerkRelatedShortInfoDTO> listExternalClerkByMemberId(String memberId);
/**
* 通过会员id查询好友门店id
*
* @param memberId 成员身份
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-07-06 14:39:28
*/
List<String> listStoreIdByMemberId(String memberId);
/**
* 获取该企业会员下的关联关系列表
*
......
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.*;
......@@ -53,6 +53,8 @@ public interface WxEnterpriseApiService {
* @return
*/
WxEnterpriseDTO getEnterpriseBycorpId(String corpId);
ServiceResponse<Boolean> isStopHaoban(String corpId);
/**
* 更新企业
......@@ -214,5 +216,15 @@ public interface WxEnterpriseApiService {
* @date 2022-06-27 13:44:16
*/
SecretSettingDTO getSecretSettingById(String secretId);
/**
*
* @Title: stopHaoban
* @Description: 停用好办
* @author xugh
* @param enterpriseId
* @throws
*/
void stopHaoban(String enterpriseId) ;
}
......@@ -20,7 +20,7 @@ public interface TabHaobanClerkMainStoreRelatedMapper {
int updateByPrimaryKey(TabHaobanClerkMainStoreRelated record);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId);
TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(@Param("staffId")String staffId, @Param("wxEnterpriseId")String wxEnterpriseId , @Param("storeIdList") List<String> storeIdList);
List<TabHaobanClerkMainStoreRelated> listByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
......@@ -32,6 +32,8 @@ public interface TabHaobanClerkMainStoreRelatedMapper {
* @param wxEnterpriseId
*/
void delMainStore(@Param("staffId") String staffId, @Param("storeId") String storeId, @Param("wxEnterpriseId") String wxEnterpriseId);
void delStaffMainStore(@Param("staffId") String staffId, @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 删除门店
......
......@@ -218,6 +218,16 @@ public interface TabHaobanExternalClerkRelatedMapper {
@Param("enterpriseId") String enterpriseId);
/**
* 通过会员id查询门店id
*
* @param memberId 成员身份
* @return {@link List }<{@link String }>
* @author mozhu
* @date 2022-07-06 14:40:15
*/
List<String> listStoreIdByMemberId(@Param("memberId") String memberId);
/**
* 查询会员在企业下的好友关系 根据会员id
*
* @param wxEnterpriseId
......
......@@ -89,7 +89,7 @@ public interface TabHaobanStaffClerkRelationMapper {
List<TabHaobanStaffClerkRelation>listByEnterpriseIdAndWxUserId(@Param("enterpriseId")String enterpriseId,@Param("wxUserId")String wxUserId);
List<TabHaobanStaffClerkRelation> lisByStaffId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffId")String staffId);
List<TabHaobanStaffClerkRelation> lisByStaffId(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("staffId")String staffId , @Param("storeIdList") List<String> storeIdList);
TabHaobanStaffClerkRelation getByCodeAndStoreId(@Param("clerkCode")String clerkCode, @Param("storeId")String storeId);
......
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
public interface WxEnterpriseRelatedMapper {
int deleteByPrimaryKey(String wxEnterpriseRelatedId);
int deleteByEnterpriseId(String enterpriseId) ;
int insertSelective(TabHaobanWxEnterpriseRelated record);
......@@ -17,9 +20,11 @@ public interface WxEnterpriseRelatedMapper {
List<TabHaobanWxEnterpriseRelated> listByWxenterpriseId(String wxEnterpriseId);
List<TabHaobanWxEnterpriseRelated> listByWxEnterpriseIdAndNoStatus(String wxEnterpriseId) ;
List<TabHaobanWxEnterpriseRelated> listByWxenterpriseIdList(@Param("wxEnterpriseIdList") List<String> wxEnterpriseIdList);
TabHaobanWxEnterpriseRelated findOneByEnterpriseId(String enterpriseId);
List<TabHaobanWxEnterpriseRelated> listByEnterpriseId(String enterpriseId);
List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId();
......
......@@ -19,6 +19,8 @@ public interface ClerkMainStoreRelatedService {
* @return
*/
TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId);
TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId, List<String> storeIdList);
/**
* 删除主门店 并删除主门店好友 设置新主门店
......
......@@ -83,6 +83,8 @@ public interface StaffClerkRelationService {
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId);
List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId , List<String> storeIdList);
/**
* 保存
......
......@@ -33,7 +33,6 @@ public interface WxEnterpriseService {
int unbind(String wxEnterpriseId);
@Deprecated
TabHaobanWxEnterprise getEnterpriseBycorpIdNoStatus(String corpid);
......@@ -65,4 +64,5 @@ public interface WxEnterpriseService {
* @date 2022-06-30 18:49:31
*/
int updateUseridFlagById(Integer useridFlag, String corpid, String wxEnterpriseId);
void stopHaoban(String enterpriseId);
}
......@@ -45,7 +45,7 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
@Override
public TabHaobanClerkMainStoreRelated selectByWxEnterpriseIdAndStoreId(String staffId, String wxEnterpriseId) {
return mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
return mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId,null);
}
@Override
......@@ -78,17 +78,23 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
@Override
public TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId) {
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId,null);
if (null != mainStoreRelated) {
//String storeId = mainStoreRelated.getStoreId();
//StaffClerkRelationDTO staffClerkRelationDTO = staffClerkRelationService.getOneBindByStoreId(staffId, storeId);
//if (staffClerkRelationDTO == null) {
// logger.info("该主门店无绑定关系,重新绑定,staffId:{},storeId:{}", staffId, storeId);
// return delMainStore(staffId, storeId, wxEnterpriseId);
//}
return mainStoreRelated;
}
return setStaffMainStore(staffId, wxEnterpriseId);
return setStaffMainStore(staffId, wxEnterpriseId,null);
}
@Override
public TabHaobanClerkMainStoreRelated getMainStoreByStaffId(String staffId, String wxEnterpriseId,
List<String> storeIdList) {
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId,storeIdList);
if (null != mainStoreRelated) {
return mainStoreRelated;
}
this.mapper.delStaffMainStore(staffId, wxEnterpriseId);
return setStaffMainStore(staffId, wxEnterpriseId,storeIdList);
}
/**
......@@ -98,18 +104,18 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
* @param wxEnterpriseId
* @return
*/
private TabHaobanClerkMainStoreRelated setStaffMainStore(String staffId, String wxEnterpriseId) {
List<StaffClerkRelationDTO> clerkRelationDTOS = staffClerkRelationService.listByStaffId(wxEnterpriseId, staffId);
private TabHaobanClerkMainStoreRelated setStaffMainStore(String staffId, String wxEnterpriseId,List<String> storeIdList) {
List<StaffClerkRelationDTO> clerkRelationDTOS = staffClerkRelationService.listByStaffId(wxEnterpriseId, staffId,storeIdList);
if (CollectionUtils.isEmpty(clerkRelationDTOS)) {
return null;
}
StaffClerkRelationDTO staffClerkRelationDTO = clerkRelationDTOS.get(0);
String lockKey = "set-main-store:" + staffId;
RedisUtil.lock(lockKey, 3L);
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
TabHaobanClerkMainStoreRelated mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId,null);
if (null == mainStoreRelated) {
this.setMainStore(staffId, staffClerkRelationDTO.getStoreId(), wxEnterpriseId);
mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
mainStoreRelated = mapper.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId,null);
}
RedisUtil.unlock(lockKey);
return mainStoreRelated;
......@@ -122,7 +128,7 @@ public class ClerkMainStoreRelatedServiceImpl implements ClerkMainStoreRelatedSe
//删除主门店外部联系人 好友
externalClerkRelatedService.delByStoreIdAndStaffId(storeId, staffId);
//设置主门店
return this.setStaffMainStore(staffId, wxEnterpriseId);
return this.setStaffMainStore(staffId, wxEnterpriseId,null);
}
@Override
......
......@@ -82,7 +82,7 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
}
String wxEnterpriseId = tabHaobanStaffs.get(0).getWxEnterpriseId();
String staffId = tabHaobanStaffs.get(0).getStaffId();
List<TabHaobanStaffClerkRelation> tabHaobanStaffClerkRelations = staffClerkRelationMapper.lisByStaffId(wxEnterpriseId, staffId);
List<TabHaobanStaffClerkRelation> tabHaobanStaffClerkRelations = staffClerkRelationMapper.lisByStaffId(wxEnterpriseId, staffId,null);
if (CollectionUtils.isEmpty(tabHaobanStaffClerkRelations)) {
logger.error("找不到员工导购关联关系:staffId:{},wxEnterpriseId:{}", staffId, wxEnterpriseId);
return;
......
......@@ -241,7 +241,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override
public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.lisByStaffId(wxEnterpriseId, staffId));
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.lisByStaffId(wxEnterpriseId, staffId , null));
}
@Override
public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId, List<String> storeIdList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.lisByStaffId(wxEnterpriseId, staffId , storeIdList));
}
@Override
......
package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private static org.apache.logging.log4j.Logger logger= LogManager.getLogger(WxEnterpriseService.class);
@Autowired
private WxEnterpriseMapper mapper;
@Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Override
public String add(WxEnterpriseDTO wxDTO) {
......@@ -99,4 +112,41 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
public int updateUseridFlagById(Integer useridFlag, String corpid, String wxEnterpriseId) {
return mapper.updateUseridFlagById(useridFlag, corpid, wxEnterpriseId);
}
@Override
public void stopHaoban(String enterpriseId) {
List<TabHaobanWxEnterpriseRelated> list = this.wxEnterpriseRelatedMapper.listByEnterpriseId(enterpriseId) ;
logger.info("停用好办={},list={}",enterpriseId,JSON.toJSONString(list));
if(CollectionUtils.isEmpty(list)){
return ;
}
List<String> wxEnterpriseIdList = new ArrayList<>();
for(TabHaobanWxEnterpriseRelated item : list) {
String wxEnterpriseId = item.getWxEnterpriseId() ;
wxEnterpriseIdList.add(wxEnterpriseId) ;
}
this.wxEnterpriseRelatedMapper.deleteByEnterpriseId(enterpriseId) ;
Map<String,Object> enMap = new HashMap<>();
enMap.put("enterpriseId", enterpriseId) ;
alert("删除商户企微关联告警", enMap);
for(String wxEnterpriseId : wxEnterpriseIdList) {
List<TabHaobanWxEnterpriseRelated> relationList = this.wxEnterpriseRelatedMapper.listByWxenterpriseId(wxEnterpriseId) ;
if(CollectionUtils.isEmpty(relationList)) {
// 停用企微
TabHaobanWxEnterprise tab = new TabHaobanWxEnterprise() ;
tab.setWxEnterpriseId(wxEnterpriseId);
tab.setStatusFlag(0);
tab.setUpdateTime(new Date());
this.mapper.updateByPrimaryKeySelective(tab) ;
Map<String,Object> map = new HashMap<>();
map.put("wxEnterpriseId", wxEnterpriseId) ;
alert("删除企微告警", map);
}
}
}
private void alert(String title, Map<String, Object> map) {
String msg = title + JSON.toJSONString(map);
String dingUrl = "https://oapi.dingtalk.com/robot/send?access_token=c38fdc53d26e9a019640755bdada1ce07ebd44a2555d1c8acc299de7a7b5b857";
DingUtils.send(msg, dingUrl, true);
}
}
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import static org.slf4j.LoggerFactory.getLogger;
......@@ -39,6 +40,12 @@ public class ClerkMainStoreRelatedApiServiceImpl implements ClerkMainStoreRelate
public ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId) {
return EntityUtil.changeEntityByJSON(ClerkMainStoreRelatedDTO.class, clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId));
}
@Override
public ClerkMainStoreRelatedDTO getWxEnterpriseIdAndStaffId(String wxEnterpriseId, String staffId,
List<String> storeIdList) {
return EntityUtil.changeEntityByJSON(ClerkMainStoreRelatedDTO.class, clerkMainStoreRelatedService.getMainStoreByStaffId(staffId, wxEnterpriseId,storeIdList));
}
@Override
public void setFreshFriend(String wxEnterpriseId, String staffId) {
......
......@@ -301,6 +301,14 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
}
@Override
public List<String> listStoreIdByMemberId(String memberId) {
if (StringUtils.isBlank(memberId)) {
return null;
}
return tabHaobanExternalClerkRelatedMapper.listStoreIdByMemberId(memberId);
}
@Override
public void delByMemberIdAndEnterpriseId(String memberId, String enterpriseId, String mergeMemberId) {
log.info("删除会员或者合并会员,memberId:{},enterpriseId:{},mergeMemberId:{}", memberId, enterpriseId, mergeMemberId);
if (StringUtils.isBlank(mergeMemberId)) {
......
......@@ -34,13 +34,13 @@ import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -200,7 +200,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
QywxTagDTO qywxTagDTO = new QywxTagDTO();
qywxTagDTO.setName(item.getQywxTagName());
qywxTagDTO.setOrder(item.getOrder());
qywxTagDTO.setId(item.getQywxTagKey());
return qywxTagDTO;
}).collect(Collectors.toList());
qywxTagGroupDTO.setTag(tagItems);
......@@ -495,8 +494,12 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
jsonObject.put("suiteId", wxSuiteid);
jsonObject.put("wxUserId", wxUserId);
jsonObject.put("externalUserId", externalUserId);
jsonObject.put("needSetTags", StringUtils.join(needSetTags, ","));
jsonObject.put("needDelTags", StringUtils.join(needDelTags, ","));
if (CollectionUtils.isNotEmpty(needSetTags)) {
jsonObject.put("needSetTags", StringUtils.join(needSetTags, ","));
}
if (CollectionUtils.isNotEmpty(needDelTags)) {
jsonObject.put("needDelTags", StringUtils.join(needDelTags, ","));
}
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try {
clientInstance.sendMessage("qywxMarkTagMq", jsonObject.toJSONString());
......@@ -872,7 +875,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
ret.put("描述", "企业微信标签项空:" + tabQywxTag.getQywxGroupName());
return ret;
}
Map<String, QywxTagDTO> qywxTagDTOMap = tagItems.stream().filter(dto -> dto.isDeleted() == false).collect(Collectors.toMap(dto -> dto.getId(), dto -> dto));
Map<String, QywxTagDTO> qywxTagDTOMap = tagItems.stream().collect(Collectors.toMap(dto -> dto.getId(), dto -> dto));
Set<String> qywxKeysSet = qywxTagDTOMap.keySet();
//gic没有同步的标签项
......@@ -885,7 +888,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//企业微信存在 gic不存在
Sets.SetView<String> gicUnHaves = Sets.difference(qywxKeysSet, gicQywxKeysSet);
ret.put("现企微标签项", tagItems.stream().filter(dto -> dto.isDeleted() == false).map(dto -> dto.getName()).collect(Collectors.joining("],[", "[", "]")));
ret.put("现企微标签项", tagItems.stream().map(dto -> dto.getName()).collect(Collectors.joining("],[", "[", "]")));
ret.put("现gic标签项", gicTagItems.stream().map(dto -> dto.getTagItemName()).collect(Collectors.joining("],[", "[", "]")));
//企业微信缺少
......@@ -932,7 +935,15 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.error("企微打标签超过最大次数,key:{}", key);
return;
}
QywxResponseDTO responseDTO = qywxUserApiService.markTag(corpid, suiteId, wxUserId, externalUserId, new HashSet<>(Arrays.asList(needSetTags.split(","))), new HashSet<>(Arrays.asList(needDelTags.split(","))));
List<String> needSetTagList = new ArrayList<>();
List<String> needDelTagList = new ArrayList<>();
if (StringUtils.isNotBlank(needSetTags)) {
needSetTagList = Arrays.asList(needSetTags.split(","));
}
if (StringUtils.isNotBlank(needDelTags)) {
needDelTagList = Arrays.asList(needDelTags.split(","));
}
QywxResponseDTO responseDTO = qywxUserApiService.markTag(corpid, suiteId, wxUserId, externalUserId, needSetTagList, needDelTagList);
logger.info("操作返回:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
logger.info("权限不对,重试三次:{},{}", wxUserId, externalUserId);
......
package com.gic.haoban.manage.service.util;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;
import com.gic.commons.util.DingtalkMessageUtil;
public class DingUtils {
private static boolean isDev = false;
static {
Config config = ConfigService.getConfig("COMMON.gic-properties");
String env = config.getProperty("environment.value", "");
isDev = !"prod".equals(env);
}
public static void send(String msg, String dingUrl, boolean skipDev) {
try {
if (skipDev && isDev) {
return;
}
if (isDev) {
msg = "【dev】" + msg;
}
DingtalkMessageUtil.sendAlertMessage(msg, dingUrl);
} catch (Exception e) {
}
}
}
......@@ -158,7 +158,7 @@
<dubbo:reference interface="com.gic.member.api.service.MemberTagService" id="memberTagService"/>
<dubbo:reference interface="com.gic.member.tag.api.service.MemberTagApiService" id="memberTagApiService"/>
<dubbo:reference interface="com.gic.member.tag.api.service.MemberTagItemApiService" id="memberTagItemApiService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.clerk.api.service.PowerService" id="powerService"/>
<dubbo:reference interface="com.gic.enterprise.api.service.AuthorizeService" id="authorizeService"/>
<dubbo:reference id="quartzService" interface="com.gic.quartz.api.service.QuartzService" timeout="10000"/>
......@@ -174,4 +174,5 @@
</beans>
\ No newline at end of file
......@@ -148,6 +148,12 @@
where staff_id = #{staffId,jdbcType=VARCHAR}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
<if test="null != storeIdList">
and store_id IN
<foreach collection="storeIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
limit 1
</select>
......@@ -171,7 +177,18 @@
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</update>
<update id="delStaffMainStore">
update tab_haoban_clerk_main_store_related
set
status_flag = 0,
update_time = now()
where
staff_id=#{staffId}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</update>
<update id="delByStoreIds">
update tab_haoban_clerk_main_store_related
set
......
......@@ -552,7 +552,14 @@
<if test="enterpriseId != null and enterpriseId != ''">
and enterprise_id = #{enterpriseId}
</if>
group by enterprise_id,wx_enterprise_id
</select>
<select id="listStoreIdByMemberId" resultType="string">
select
store_id
from tab_haoban_external_clerk_related
where member_id = #{memberId}
and status_flag = 1
</select>
<select id="listByExternalUserId" resultMap="BaseResultMap">
......
......@@ -268,7 +268,7 @@
and wx_user_id = #{wxUserId}
</select>
<select id="lisByStaffId" resultMap="BaseResultMap" parameterType="java.lang.String">
<select id="lisByStaffId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff_clerk_relation
......@@ -276,6 +276,12 @@
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and staff_id = #{staffId}
and status_flag = 1
<if test="null != storeIdList">
and store_id in
<foreach collection="storeIdList" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by create_time desc
</select>
......
......@@ -32,6 +32,11 @@
from tab_haoban_wx_enterprise_related
where wx_enterprise_related_id = #{wxEnterpriseRelatedId,jdbcType=VARCHAR}
</delete>
<update id="deleteByEnterpriseId">
update tab_haoban_wx_enterprise_related set status_flag = 0 , update_time=now() where enterprise_id=#{enterpriseId} and status_flag=1
</update>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated">
insert into tab_haoban_wx_enterprise_related
......@@ -173,6 +178,13 @@
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select id="listByWxEnterpriseIdAndNoStatus" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise_related
where wx_enterprise_id = #{wxEnterpriseId}
</select>
<select id="listByWxenterpriseIdList" resultMap="BaseResultMap">
select
......@@ -185,7 +197,7 @@
and status_flag = 1
</select>
<select id="findOneByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
<select id="listByEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise_related
......
package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
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.RestController;
import com.alibaba.dubbo.common.utils.CollectionUtils;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
......@@ -14,31 +27,39 @@ import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StorePhotoDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.common.anno.IgnoreLogin;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.data.api.dto.HaobanDataDTO;
import com.gic.haoban.data.api.service.HaobanDataApiService;
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.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseRelationDetailDTO;
import com.gic.haoban.manage.api.enums.StoreFieldEnum;
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.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.StaffStoreVO;
import com.gic.haoban.manage.web.vo.StoreDetailVO;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
@RestController
public class StoreController extends WebBaseController {
private static final Logger logger = LoggerFactory.getLogger(StoreController.class);
private static org.apache.logging.log4j.Logger logger= LogManager.getLogger(StoreController.class);
@Autowired
private ClerkService clerkService;
......@@ -64,6 +85,8 @@ public class StoreController extends WebBaseController {
private StaffApiService staffApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService ;
/**
* 会员小程序-门店列表
......@@ -93,24 +116,40 @@ public class StoreController extends WebBaseController {
logger.info("没有关联任何商户导购:{}", wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
//主门店
ClerkMainStoreRelatedDTO mainDTO = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(wxEnterpriseId, staffId);
String storeId = mainDTO == null ? "" : mainDTO.getStoreId();
Map<String,Boolean> map = new HashMap<>();
for (StaffClerkRelationDTO staffClerkRelationDTO : bindRelationList) {
boolean enterpriseOver = isEnterpriseOver(staffClerkRelationDTO.getStoreId());
if (enterpriseOver) {
logger.info("该企业过期了:{},{},{}", staffId, staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getStoreId());
String storeId = staffClerkRelationDTO.getStoreId() ;
StoreDTO store = storeService.getStore(storeId);
if (store == null) {
continue;
}
String enterprsieId = store.getEnterpriseId() ;
if(null != map.get(enterprsieId)) {
if(Boolean.FALSE.equals(map.get(enterprsieId))) {
logger.info("该企业过期,{}", enterprsieId);
continue ;
}
}else {
boolean enterpriseOver = isEnterpriseOver(enterprsieId);
if (enterpriseOver) {
logger.info("该企业过期,{}", staffId, enterprsieId);
map.put(enterprsieId, false) ;
continue;
}
Integer code = this.enterpriseUseForbidService.selectPermissionStatus(enterprsieId, "haoban-3") ;
logger.info("是否停用={},{}",enterprsieId,code);
// 不能用
if(!(code ==0 || code==1)) {
logger.info("该企业过期,{}", staffId, enterprsieId);
map.put(enterprsieId, false) ;
continue;
}
}
map.put(enterprsieId, true) ;
ClerkDTO clerk = clerkService.getClerkByClerkCode(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getClerkCode());
if (clerk == null) {
continue;
}
StoreDTO store = storeService.getStore(clerk.getStoreId());
if (store == null) {
continue;
}
StaffDTO staffDTO = staffApiService.selectById(staffId);
if (staffDTO == null) {
continue;
......@@ -126,9 +165,6 @@ public class StoreController extends WebBaseController {
}
//主门店标志
int mainStoreFlag = 0;
if (storeId.equals(store.getStoreId())) {
mainStoreFlag = 1;
}
EnterpriseDetailDTO enterpriseDetailDTO = enterpriseTypeMap.get(enterpriseId);
staffDepartmentRelatedApiService.listByStaffId(staffId);
StaffStoreVO vo = new StaffStoreVO();
......@@ -152,6 +188,20 @@ public class StoreController extends WebBaseController {
vo.setCorpName(wxEnterpriseDTO.getCorpName());
list.add(vo);
}
if(org.apache.commons.collections.CollectionUtils.isEmpty(list)) {
return resultResponse(HaoBanErrCode.ERR_1, list);
}
List<String> storeIdList = list.stream().map(dto->dto.getStoreId()).collect(Collectors.toList()) ;
// 处理主门店
ClerkMainStoreRelatedDTO mainDTO = clerkMainStoreRelatedApiService.getWxEnterpriseIdAndStaffId(wxEnterpriseId, staffId,storeIdList);
String mainStoreId = mainDTO == null ? "" : mainDTO.getStoreId();
if(null != mainStoreId) {
list.forEach(item->{
if(item.getStoreId().equals(mainStoreId)) {
item.setMainStoreFlag(1);
}
});
}
return resultResponse(HaoBanErrCode.ERR_1, list);
}
......@@ -330,13 +380,9 @@ public class StoreController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_1, vo);
}
//获取门店详情
public boolean isEnterpriseOver(String storeId) {
StoreDTO store = storeService.getStore(storeId);
if (store == null) {
return true;
}
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(store.getEnterpriseId());
public boolean isEnterpriseOver(String enterpriseId) {
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(enterpriseId);
if (enterprise == null || enterprise.getStatus() != 1) {
return true;
}
......
package com.gic.haoban.manage.web.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -12,7 +32,11 @@ import com.gic.dict.api.service.ManagerDictService;
import com.gic.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.app.customer.dto.*;
import com.gic.haoban.app.customer.dto.ChildDTO;
import com.gic.haoban.app.customer.dto.CustomerDTO;
import com.gic.haoban.app.customer.dto.FilterListDTO;
import com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO;
import com.gic.haoban.app.customer.dto.StaffOpenRelatedDTO;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.app.customer.service.api.service.StaffMemberRelationApiService;
import com.gic.haoban.common.anno.HttpLimit;
......@@ -21,9 +45,30 @@ import com.gic.haoban.common.utils.AuthRequestWellDoneUtil;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.JwtUtil;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.ClerkMainStoreRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalUserDTO;
import com.gic.haoban.manage.api.dto.MemberStoreDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.api.dto.MiniprogramSettingDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO;
import com.gic.haoban.manage.api.dto.UserLoginLogDTO;
import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseRelationDetailDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.GetUserByMemberCodeQo;
......@@ -38,21 +83,9 @@ import com.gic.member.api.service.MemberOpenCardBusinessService;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
@RestController
public class WxEnterpriseInfoController extends WebBaseController {
......@@ -116,6 +149,14 @@ public class WxEnterpriseInfoController extends WebBaseController {
}
String userId = user.getUserid();
String corpId = user.getCorpid();
// 判断好办是否到期
ServiceResponse<Boolean> resp = this.wxEnterpriseApiService.isStopHaoban(corpId) ;
if(!resp.isSuccess()) {
HaobanResponse response = new HaobanResponse() ;
response.setErrorCode(-888);
response.setMessage(resp.getMessage());
return response ;
}
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId);
StaffDTO loginStaff = null;
if (enterprise != null) {
......
......@@ -18,6 +18,8 @@
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService" id="staffDepartmentRelatedApiService"/>
<dubbo:reference interface="com.gic.clerk.api.service.ClerkService" id="clerkService"/>
<dubbo:reference interface="com.gic.haoban.data.api.service.HaobanDataApiService" id="haobanDataApiService"/>
......
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