Commit e8dddca6 by guojx

Merge remote-tracking branch 'origin/developer' into developer

parents 603c17aa fc471a56
package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.dto.*;
......@@ -214,5 +213,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) ;
}
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);
......@@ -19,7 +22,7 @@ public interface WxEnterpriseRelatedMapper {
List<TabHaobanWxEnterpriseRelated> listByWxenterpriseIdList(@Param("wxEnterpriseIdList") List<String> wxEnterpriseIdList);
TabHaobanWxEnterpriseRelated findOneByEnterpriseId(String enterpriseId);
List<TabHaobanWxEnterpriseRelated> listByEnterpriseId(String enterpriseId);
List<TabHaobanWxEnterpriseRelated> queryAllHasGicEnterpriseId();
......
......@@ -65,4 +65,7 @@ public interface WxEnterpriseService {
* @date 2022-06-30 18:49:31
*/
int updateUseridFlagById(Integer useridFlag, String corpid, String wxEnterpriseId);
void stopHaoban(String enterpriseId);
}
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) {
......@@ -95,8 +108,46 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
return mapper.listAll();
}
@Override
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);
}
}
package com.gic.haoban.manage.service.service.out.impl;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
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.enterprise.api.dto.EnterpriseDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
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.api.dto.MiniprogramSettingDTO;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffPrivacyUseLogDTO;
import com.gic.haoban.manage.api.dto.WelcomeDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
......@@ -18,18 +41,13 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.entity.TabWelcome;
import com.gic.haoban.manage.service.pojo.bo.StaffPrivacyUseLogBO;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import com.gic.haoban.manage.service.service.WxApplicationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
......@@ -54,6 +72,8 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Autowired
private Config config;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService ;
@Override
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
......@@ -219,6 +239,17 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
@Override
public boolean enterpriseIsOver(String enterpriseId) {
try {
log.info("是否停用查询={}",enterpriseId);
Integer code = this.enterpriseUseForbidService.selectPermissionStatus(enterpriseId, "haoban-3") ;
log.info("是否停用={},{}",enterpriseId,code);
// 不能用
if(!(code ==0 || code==1)) {
return true ;
}
}catch(Exception e) {
e.printStackTrace();
}
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(enterpriseId);
if (enterprise == null || enterprise.getStatus() != 1) {
return true;
......@@ -376,4 +407,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
public SecretSettingDTO getSecretSettingById(String secretId) {
return secretSettingService.getSecretSettingById(secretId);
}
@Override
public void stopHaoban(String enterpriseId) {
this.wxEnterpriseService.stopHaoban(enterpriseId) ;
}
}
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) {
}
}
}
......@@ -178,7 +178,8 @@
<dubbo:reference id="storeWidgetService"
interface="com.gic.enterprise.api.service.StoreWidgetService" timeout="10000"
retries="0" check="false"/>
<dubbo:reference interface="com.gic.enterprise.api.service.EnterpriseUseForbidService" id="enterpriseUseForbidService"/>
</beans>
\ No newline at end of file
......@@ -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
......@@ -185,7 +190,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
......
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