Commit 43184165 by songyinghui

feat: 欢迎语相关

parent fa417e17
package com.gic.haoban.manage.api.dto.welcome.dto;
import java.io.Serializable;
/**
* @Author MUSI
* @Date 2022/7/8 9:07 AM
* @Description
* @Version
* 活码删除失败时返回对象
**/
public class WelcomeRemoveDTO implements Serializable {
/**
* 活码引用数量
*/
private Integer qrCodeReferNum;
/**
* 链接引用次数
*/
private Integer linkReferNum;
public Integer getQrCodeReferNum() {
return qrCodeReferNum;
}
public void setQrCodeReferNum(Integer qrCodeReferNum) {
this.qrCodeReferNum = qrCodeReferNum;
}
public Integer getLinkReferNum() {
return linkReferNum;
}
public void setLinkReferNum(Integer linkReferNum) {
this.linkReferNum = linkReferNum;
}
}
......@@ -10,13 +10,13 @@ import com.gic.haoban.base.api.common.BasePageInfo;
**/
public class QueryWelcomeRelationQDTO extends BasePageInfo {
private Long welcomeId ;
private String welcomeId ;
public Long getWelcomeId() {
public String getWelcomeId() {
return welcomeId;
}
public void setWelcomeId(Long welcomeId) {
public void setWelcomeId(String welcomeId) {
this.welcomeId = welcomeId;
}
}
......@@ -5,6 +5,7 @@ import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.welcome.dto.FriendSettingDetailDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeDetailDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeListDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.SaveFriendSettingQDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.SaveWelcomeQDTO;
......@@ -117,4 +118,11 @@ public interface WelcomeApiService {
*/
ServiceResponse<Page<WelcomeListDTO>> listWelcomeWithCondition(QueryWelcomeQDTO queryWelcomeQDTO);
/**
* 删除欢迎语,带欢迎语校验
* @param welcomeId
* @return
*/
ServiceResponse<WelcomeRemoveDTO> removeWelcomeWithErrorInfo(String welcomeId);
}
......@@ -10,13 +10,13 @@ import com.gic.haoban.base.api.common.BasePageInfo;
**/
public class WelcomeRelationQO extends BasePageInfo {
private Long welcomeId ;
private String welcomeId ;
public Long getWelcomeId() {
public String getWelcomeId() {
return welcomeId;
}
public void setWelcomeId(Long welcomeId) {
public void setWelcomeId(String welcomeId) {
this.welcomeId = welcomeId;
}
}
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.service.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
import com.gic.haoban.manage.service.pojo.bo.welcome.*;
......@@ -135,4 +136,11 @@ public interface WelcomeService {
* @return
*/
WelcomeDetailBO getMatchWelcomeWithReferId(String staffId, String wxEnterpriseId, String referId);
/**
* 删除欢迎语
* @param welcomeId
* @return
*/
WelcomeRemoveDTO removeWithErrorInfo(String welcomeId);
}
package com.gic.haoban.manage.service.service.hm;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import java.util.List;
/**
* @Author MUSI
......@@ -17,4 +20,11 @@ public interface WelcomeRelationService {
* @return
*/
TabHaobanWelcomeTemplateRelation queryWelcomeRelation(String referId, Integer status);
/**
* 条件查询 欢迎语引用列表
* @param welcomeRelationQo
* @return
*/
List<TabHaobanWelcomeTemplateRelation> queryWelcomeRelationList(WelcomeRelationQO welcomeRelationQo);
}
......@@ -2,10 +2,13 @@ package com.gic.haoban.manage.service.service.hm.impl;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author MUSI
* @Date 2022/7/4 5:50 PM
......@@ -29,4 +32,15 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
public TabHaobanWelcomeTemplateRelation queryWelcomeRelation(String referId, Integer status) {
return welcomeTemplateRelationMapper.queryWelTemplateRelation(null, referId, status);
}
/**
* 条件查询 欢迎语引用列表
*
* @param welcomeRelationQo
* @return
*/
@Override
public List<TabHaobanWelcomeTemplateRelation> queryWelcomeRelationList(WelcomeRelationQO welcomeRelationQo) {
return welcomeTemplateRelationMapper.queryWelcomeTemplate(welcomeRelationQo);
}
}
......@@ -3,17 +3,20 @@ package com.gic.haoban.manage.service.service.impl;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
import com.gic.haoban.manage.api.enums.FriendSettingTypeEnum;
import com.gic.haoban.manage.api.enums.WelcomeMediaTypeEnum;
import com.gic.haoban.manage.api.enums.WelcomeRelationStatusEnum;
import com.gic.haoban.manage.api.enums.WelcomeSuitTypeEnum;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeReferType;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeType;
import com.gic.haoban.manage.service.dao.mapper.*;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.bo.welcome.*;
import com.gic.haoban.manage.service.pojo.qo.WelcomeInfoQO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.WelcomeSuitRangService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
......@@ -643,4 +646,42 @@ public class WelcomeServiceImpl implements WelcomeService {
return convertWelcomeToBo(tabWelcome);
}
/**
* 删除欢迎语
*
* @param welcomeId
* @return
* 删除成功时 直接return null
* 不可删除时 返回具体的关联数量
*/
@Override
public WelcomeRemoveDTO removeWithErrorInfo(String welcomeId) {
// 1、查询欢迎语
// 2、根据欢迎语类型 区分
// 3、特殊类型 查询欢迎语引用的数量
// 4、判断是否可删除
TabWelcome tabWelcome = welcomeMapper.selectByPrimaryKey(welcomeId);
if (tabWelcome == null){
return null;
}
if (HmWelcomeType.NORMAL.getCode().equals(tabWelcome.getType())){
this.removeWelcome(welcomeId);
return null;
}
WelcomeRelationQO welcomeRelationQo = new WelcomeRelationQO();
welcomeRelationQo.setWelcomeId(welcomeId);
List<TabHaobanWelcomeTemplateRelation> tabHaobanWelcomeTemplateRelations = welcomeRelationService.queryWelcomeRelationList(welcomeRelationQo);
if (CollectionUtils.isEmpty(tabHaobanWelcomeTemplateRelations)){
this.removeWelcome(welcomeId);
return null;
}
Map<Integer, List<TabHaobanWelcomeTemplateRelation>> welcomeGroupByType = tabHaobanWelcomeTemplateRelations.stream()
.collect(Collectors.groupingBy(TabHaobanWelcomeTemplateRelation::getType));
WelcomeRemoveDTO welcomeRemoveDTO = new WelcomeRemoveDTO();
welcomeRemoveDTO.setQrCodeReferNum(Optional.ofNullable(welcomeGroupByType.get(HmWelcomeReferType.HM.getCode()))
.map(List::size).orElse(0));
welcomeRemoveDTO.setLinkReferNum(Optional.ofNullable(welcomeGroupByType.get(HmWelcomeReferType.LINK.getCode()))
.map(List::size).orElse(0));
return welcomeRemoveDTO;
}
}
......@@ -3,16 +3,15 @@ package com.gic.haoban.manage.service.service.out.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.haoban.manage.api.dto.welcome.dto.FriendSettingDetailDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeDetailDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeListDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeMediaDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeRemoveDTO;
import com.gic.haoban.manage.api.dto.welcome.dto.WelcomeSuitDepartmentDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeQDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.SaveFriendSettingQDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.SaveWelcomeQDTO;
import com.gic.haoban.manage.api.enums.hm.HmWelcomeType;
import com.gic.haoban.manage.api.service.out.WelcomeApiService;
import com.gic.haoban.manage.service.pojo.bo.welcome.FriendSettingDetailBO;
import com.gic.haoban.manage.service.pojo.bo.welcome.SaveFriendSettingBO;
......@@ -182,4 +181,15 @@ public class WelcomeApiServiceImpl implements WelcomeApiService {
serviceResponse.setResult(page);
return serviceResponse;
}
/**
* 删除欢迎语,带欢迎语校验
*
* @param welcomeId
* @return
*/
@Override
public ServiceResponse<WelcomeRemoveDTO> removeWelcomeWithErrorInfo(String welcomeId) {
return ServiceResponse.success(welcomeService.removeWithErrorInfo(welcomeId));
}
}
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