Commit f4f843be by 徐高华

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

Feature/xgh/202506迭代

See merge request !3071
parents dc5d1309 d5b66f7d
......@@ -21,6 +21,8 @@ public class HmLinkChatDTO implements Serializable {
private String filterJson;
/**群活码ID*/
private Long chatHmId;
private Integer otherFlag ;
private String enterpriseId;
/**会员类型(0:会员筛选,1:会员分组)*/
private Integer memberType;
......@@ -38,6 +40,14 @@ public class HmLinkChatDTO implements Serializable {
// 用于人群回显
private String searchJson;
public Integer getOtherFlag() {
return otherFlag;
}
public void setOtherFlag(Integer otherFlag) {
this.otherFlag = otherFlag;
}
public String getSearchJson() {
return searchJson;
}
......
......@@ -23,6 +23,8 @@ public interface QwMomentPlanMapper {
TabQwMomentPlan getById(@Param("planId") Long planId) ;
TabQwMomentPlan getByIdNoStatus(@Param("planId") Long planId) ;
void updateClerkNum(@Param("planId")Long planId, @Param("totalNum")int totalNum , @Param("taskClerkNum")int taskClerkNum , @Param("doneNum")int doneNum);
List<TabQwMomentPlan> list(QwMomentPlanQDTO qdto);
......
......@@ -22,6 +22,8 @@ public interface WxEnterpriseService {
* @throws
*/
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
void deleteQwInfoCache(String wxEnterpriseId) ;
/**
......
......@@ -39,6 +39,7 @@ public class SecretSettingServiceImpl implements SecretSettingService {
if (secretSetting.getSecretId() != null) {
secretSetting.setUpdateTime(new Date());
secretSettingMapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabSecretSetting.class, secretSetting));
this.wxEnterpriseService.deleteQwInfoCache(secretSetting.getWxEnterpriseId());
return true;
} else {
secretSetting.setSecretId(ToolUtil.randomUUID());
......@@ -46,6 +47,7 @@ public class SecretSettingServiceImpl implements SecretSettingService {
secretSetting.setUpdateTime(new Date());
secretSetting.setStatusFlag(1);
secretSettingMapper.insert(EntityUtil.changeEntityByJSON(TabSecretSetting.class, secretSetting));
this.wxEnterpriseService.deleteQwInfoCache(secretSetting.getWxEnterpriseId());
return true;
}
}
......@@ -57,6 +59,11 @@ public class SecretSettingServiceImpl implements SecretSettingService {
tabSecretSetting.setStatusFlag(0);
tabSecretSetting.setUpdateTime(new Date());
int i = secretSettingMapper.updateByPrimaryKeySelective(tabSecretSetting);
TabSecretSetting s = this.secretSettingMapper.selectByPrimaryKey(secretId) ;
if(null != s && null !=s.getWxEnterpriseId()) {
this.wxEnterpriseService.deleteQwInfoCache(s.getWxEnterpriseId());
}
return i > 0;
}
......
......@@ -2,8 +2,11 @@ package com.gic.haoban.manage.service.service.impl;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.WxApplicationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -14,6 +17,10 @@ public class WxApplicationServiceImpl implements WxApplicationService {
@Autowired
private WxApplicationMapper mapper;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Override
public TabHaobanWxApplication selectBySiteIdAndWxEnterpriseId(String siteId, String wxEnterpriseId) {
......@@ -29,14 +36,14 @@ public class WxApplicationServiceImpl implements WxApplicationService {
tab.setStatusFlag(1);
tab.setWxApplicationId(StringUtil.randomUUID());
mapper.insertSelective(tab);
this.wxEnterpriseService.deleteQwInfoCache(tab.getWxEnterpriseId());
}
@Override
public void update(TabHaobanWxApplication tab) {
tab.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(tab);
this.wxEnterpriseService.deleteQwInfoCache(tab.getWxEnterpriseId());
}
@Override
......@@ -46,7 +53,12 @@ public class WxApplicationServiceImpl implements WxApplicationService {
@Override
public int cancalWxApplication(String corpId, String suiteId) {
return this.mapper.cancelWxApplication(corpId, suiteId);
int i= this.mapper.cancelWxApplication(corpId, suiteId);
TabHaobanWxEnterprise tab = this.wxEnterpriseMapper.getEnterpriseBycorpId(corpId,1) ;
if(null != tab) {
this.wxEnterpriseService.deleteQwInfoCache(tab.getWxEnterpriseId());
}
return i;
}
@Override
......
......@@ -6,6 +6,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import cn.hutool.core.collection.CollUtil;
import com.gic.redis.data.util.RedisUtil;
......@@ -83,9 +84,32 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
}
return EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, mapper.selectByPrimaryKey(wxEnterpriseId));
}
private String getKey(String wxEnterpriseId) {
return "getQwInfo"+wxEnterpriseId ;
}
private WxEnterpriseQwDTO getQwInfoCache(String wxEnterpriseId) {
String key = this.getKey(wxEnterpriseId) ;
Object o = RedisUtil.getCache(key) ;
if(null != o) {
return (WxEnterpriseQwDTO) o ;
}
return null ;
}
public void deleteQwInfoCache(String wxEnterpriseId) {
String key = this.getKey(wxEnterpriseId) ;
RedisUtil.delCache(key) ;
}
@Override
public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
WxEnterpriseQwDTO qwInfoCache = this.getQwInfoCache(wxEnterpriseId) ;
if(null != qwInfoCache) {
return qwInfoCache ;
}
TabHaobanWxEnterprise wxEnterprise = this.mapper.selectByPrimaryKey(wxEnterpriseId) ;
if(null == wxEnterprise) {
return null ;
......@@ -149,10 +173,10 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
qw.setAgentId(app.getAgentId());
qw.setAgentName(app.getAgentName());
}
}
qw.setHbWxaAppid(this.getHbAppid(qw, config.getAppid()));
logger.info("企微所有corpid信息={}",JSON.toJSON(qw));
RedisUtil.setCache(getKey(wxEnterpriseId),qw,2L, TimeUnit.MINUTES) ;
return qw;
}
......
......@@ -18,6 +18,7 @@ public interface QwMomentPlanService {
ServiceResponse<Void> stop(Long planId) ;
void cancelQw(Long planId) ;
ServiceResponse<QwMomentPlanDTO> detail(Long planId) ;
ServiceResponse<Page<QwMomentPlanDTO>> planList(QwMomentPlanQDTO qdto) ;
......
......@@ -255,17 +255,39 @@ public class QwMomentPlanServiceImpl implements QwMomentPlanService {
this.qwMomentPlanMapper.stop(planId);
// 删除定时
this.addOrDelTimer(planId, new Date(), 0);
if(plan.getExecType()==0 && StringUtils.isNotBlank(plan.getMomentId())) {
String wxEnterpriseId = plan.getWxEnterpriseId() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
logger.info("取消发送={},{}",planId,plan.getMomentId());
this.qywxExternalUserService.cancelMomentTask(qwDTO.getThirdCorpid(),
qwDTO.getSelf3thSecret(), plan.getMomentId() ,qwDTO.isSelf(),qwDTO.getUrlHost()) ;
if(plan.getExecType()==0) {
if(StringUtils.isNotBlank(plan.getMomentId())){
String wxEnterpriseId = plan.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
logger.info("取消发送={},{}", planId, plan.getMomentId());
this.qywxExternalUserService.cancelMomentTask(qwDTO.getThirdCorpid(),
qwDTO.getSelf3thSecret(), plan.getMomentId(), qwDTO.isSelf(), qwDTO.getUrlHost());
}else {
CommonMQDTO mq = new CommonMQDTO() ;
mq.setType(12) ;
Map<String,String> map = new HashMap<>() ;
map.put("planId",planId+"") ;
mq.setParams(map);
this.haobanCommonMQApiService.putCommonDelayMessage(mq, 60*5);
}
}
return ServiceResponse.success();
}
@Override
public void cancelQw(Long planId) {
TabQwMomentPlan plan = this.qwMomentPlanMapper.getByIdNoStatus(planId) ;
if(null == plan) {
return ;
}
String wxEnterpriseId = plan.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
logger.info("取消发送={},{}", planId, plan.getMomentId());
this.qywxExternalUserService.cancelMomentTask(qwDTO.getThirdCorpid(),
qwDTO.getSelf3thSecret(), plan.getMomentId(), qwDTO.isSelf(), qwDTO.getUrlHost());
}
@Override
public ServiceResponse<QwMomentPlanDTO> detail(Long planId) {
TabQwMomentPlan plan = this.qwMomentPlanMapper.getById(planId);
if(null == plan) {
......
......@@ -185,6 +185,10 @@ public class HaobanCommonMQApiServiceImpl implements HaobanCommonMQApiService {
String staffId11 = map.get("staffId") ;
this.groupChatService.initStaffGroupChat(staffId11);
break;
case 12 :
Long momentPlanId12 = Long.valueOf(map.get("planId")) ;
this.qwMomentPlanService.cancelQw(momentPlanId12);
break;
default:
break;
}
......
......@@ -240,7 +240,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
for(int i=0;i< arr.size();i++) {
JSONObject json = arr.getJSONObject(i) ;
int open = json.getIntValue("open") ;
if(open == 1) {
if(open == 1 && StringUtils.isNotBlank(memberId)) {
int type = json.getIntValue("type") ;
if(type==1) {
log.info("服务门店");
......@@ -251,7 +251,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
hmId = hmBOList.get(sort).getChatHmId() ;
break;
}
}else if(type==2) {
}else if(type==2 && StringUtils.isNotBlank(memberId)) {
log.info("协管门店");
List<GroupChatHmBO> hmBOList = joinRuleManager.handleOtherStore(hmQDTO);
if(CollectionUtils.isNotEmpty(hmBOList)) {
......@@ -304,12 +304,20 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
List<HmLinkChatDTO> hmList = this.hmLinkChatService.listByLinkId(wxEnterpriseId, enterpriseId, linkId);
if (CollectionUtils.isNotEmpty(hmList)) {
for (HmLinkChatDTO item : hmList) {
boolean flag = this.memberCondition(enterpriseId, memberId, item, link.getCreatorId(),
link.getUpdateTime());
if (flag) {
log.info("使用特殊群活码={}", item.getChatHmId());
hmId = item.getChatHmId();
break;
if(StringUtils.isBlank(memberId)) {
if(item.getOtherFlag() == 1) {
log.info("使用特殊群活码={}", item.getChatHmId());
hmId = item.getChatHmId();
break;
}
}else {
boolean flag = this.memberCondition(enterpriseId, memberId, item, link.getCreatorId(),
link.getUpdateTime());
if (flag) {
log.info("使用特殊群活码={}", item.getChatHmId());
hmId = item.getChatHmId();
break;
}
}
}
}
......@@ -979,7 +987,9 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
if(CollectionUtils.isNotEmpty(hmBOList)) {
int sort = new Random().nextInt(hmBOList.size()) ;
GroupChatHmBO bo = hmBOList.get(sort) ;
return ServiceResponse.success(EntityUtil.changeEntityByJSON(StoreGroupChatHmDTO.class,bo)) ;
StoreGroupChatHmDTO dto = EntityUtil.changeEntityByJSON(StoreGroupChatHmDTO.class,bo);
dto.setChatHmCode(bo.getWxQrCode());
return ServiceResponse.success(dto) ;
}
return ServiceResponse.failure("-1","无群活码");
}
......
package com.gic.haoban.manage.service.service.out.impl.role;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.clerk.api.service.RightService;
import com.gic.commons.util.EntityUtil;
......@@ -143,6 +144,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
@Override
@Transactional(rollbackFor = Exception.class)
public ServiceResponse edit(HaobanRoleQDTO haobanRoleQDTO, WebLoginDTO login) {
logger.info("编辑权限={},{}",login.getWxEnterpriseId(), JSONObject.toJSONString(haobanRoleQDTO));
HaobanRoleMenuQDTO clerkMenus = haobanRoleQDTO.getClerkMenus();
HaobanRoleMenuQDTO manegeClerkMenus = haobanRoleQDTO.getManegeClerkMenus();
HaobanRoleMenuQDTO managerMenus = haobanRoleQDTO.getManagerMenus();
......
......@@ -93,7 +93,7 @@
link_chat_id linkChatId ,
filter_json filterJson ,
chat_hm_id chatHmId,
member_type memberType
member_type memberType , other_flag otherFlag
from tab_haoban_hm_link_chat where link_id = #{linkId} and wx_enterprise_id = #{wxEnterpriseId} and enterprise_id = #{enterpriseId} and other_flag = 0
and delete_flag = 0
</select>
......
......@@ -182,6 +182,10 @@
select <include refid="Base_Column_List" /> from tab_haoban_qw_moment_plan where plan_id =#{planId} and delete_flag = 0
</select>
<select id="getByIdNoStatus" resultMap="result-map-tabHaobanQwMomentPlan">
select <include refid="Base_Column_List" /> from tab_haoban_qw_moment_plan where plan_id =#{planId}
</select>
<select id="planListWxa" resultType="com.gic.haoban.manage.api.dto.moment.QwMomentPlanWxaDTO"
parameterType="com.gic.haoban.manage.api.qdto.moment.PlanListWxaQDTO">
select a.plan_id planId ,
......
......@@ -25,6 +25,7 @@ import com.gic.haoban.manage.web.vo.moment.PlanListVO;
import com.gic.haoban.manage.web.vo.moment.TaskDetailVO;
import com.gic.haoban.manage.web.vo.moment.TaskMaterialVO;
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.factory.annotation.Autowired;
......@@ -97,6 +98,9 @@ public class QwMomentController {
@RequestMapping("task-list")
public RestResponse<Page<PlanClerkListVO>> taskList(@RequestBody PlanClerkListQO qo) {
logger.info("活动下任务列表={}", JSONObject.toJSONString(qo));
if(StringUtils.isEmpty(qo.getClerkId())) {
return RestResponse.failure("9999","导购参数为空") ;
}
TaskListWxaQDTO qdto = EntityUtil.changeEntityByJSON(TaskListWxaQDTO.class,qo) ;
ClerkDTO clerk = this.clerkService.getclerkById(qo.getClerkId()) ;
if(0 != clerk.getClerkType()) {
......
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