Commit 5e1288ac by songyinghui

feat: 命名规范

parent 83f2038c
package com.gic.haoban.manage.api.dto.hm; package com.gic.haoban.manage.api.dto.hm;
import com.gic.haoban.manage.api.enums.hm.HmPageType;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -40,7 +42,7 @@ public class HmPageRelationDTO implements Serializable { ...@@ -40,7 +42,7 @@ public class HmPageRelationDTO implements Serializable {
/** /**
* 引用方来源 * 引用方来源
* *
* @see com.gic.haoban.manage.api.enums.hm.HmPageTemplateType * @see HmPageType
*/ */
private Integer type; private Integer type;
......
...@@ -6,7 +6,7 @@ package com.gic.haoban.manage.api.enums.hm; ...@@ -6,7 +6,7 @@ package com.gic.haoban.manage.api.enums.hm;
* @Description * @Description
* @Version * @Version
**/ **/
public enum HmPageTemplateStatus { public enum HmPageStatus {
/** /**
...@@ -18,7 +18,7 @@ public enum HmPageTemplateStatus { ...@@ -18,7 +18,7 @@ public enum HmPageTemplateStatus {
* 删除 * 删除
*/ */
DISABLE(0, "禁用"); DISABLE(0, "禁用");
HmPageTemplateStatus(Integer code, String desc){ HmPageStatus(Integer code, String desc){
this.code = code; this.code = code;
this.desc = desc; this.desc = desc;
} }
......
...@@ -6,11 +6,11 @@ package com.gic.haoban.manage.api.enums.hm; ...@@ -6,11 +6,11 @@ package com.gic.haoban.manage.api.enums.hm;
* @Description * @Description
* @Version * @Version
**/ **/
public enum HmPageTemplateType { public enum HmPageType {
LINK(1, "引流链接"); LINK(1, "引流链接");
HmPageTemplateType(Integer code, String desc){ HmPageType(Integer code, String desc){
this.code = code; this.code = code;
this.desc = desc; this.desc = desc;
} }
......
...@@ -44,5 +44,5 @@ public interface HmGroupApiService { ...@@ -44,5 +44,5 @@ public interface HmGroupApiService {
* @param wxEnterpriseId * @param wxEnterpriseId
* @return * @return
*/ */
ServiceResponse<Integer> queryGroupReferCount(String enterpriseId, String wxEnterpriseId); ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.pojo.bo.hm;
import java.io.Serializable;
import java.util.Date;
/**
* @Author MUSI
* @Date 2022/7/9 6:39 AM
* @Description
* @Version
**/
public class HmGroupSettingBO implements Serializable {
private static final long serialVersionUID = 8357992629261773954L;
private Long groupId;
private String groupName;
private String enterpriseId;
private String wxEnterpriseId;
private Integer referNum;
private Integer status;
private Integer sort;
private String creatorId;
private String creatorName;
private String modifierId;
private Date createTime;
private Date updateTime;
private String modifierName;
/**
* 是否为默认分组
*/
private Integer defaultFlag;
public Long getGroupId() {
return groupId;
}
public void setGroupId(Long groupId) {
this.groupId = groupId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public Integer getReferNum() {
return referNum;
}
public void setReferNum(Integer referNum) {
this.referNum = referNum;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getCreatorId() {
return creatorId;
}
public void setCreatorId(String creatorId) {
this.creatorId = creatorId;
}
public String getCreatorName() {
return creatorName;
}
public void setCreatorName(String creatorName) {
this.creatorName = creatorName;
}
public String getModifierId() {
return modifierId;
}
public void setModifierId(String modifierId) {
this.modifierId = modifierId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getModifierName() {
return modifierName;
}
public void setModifierName(String modifierName) {
this.modifierName = modifierName;
}
public Integer getDefaultFlag() {
return defaultFlag;
}
public void setDefaultFlag(Integer defaultFlag) {
this.defaultFlag = defaultFlag;
}
}
package com.gic.haoban.manage.service.pojo.bo.hm; package com.gic.haoban.manage.service.pojo.bo.hm;
import com.gic.haoban.manage.api.enums.hm.HmPageStatus;
import com.gic.haoban.manage.api.enums.hm.HmPageType;
import java.io.Serializable; import java.io.Serializable;
/** /**
...@@ -40,13 +43,13 @@ public class HmPageRelationBO implements Serializable { ...@@ -40,13 +43,13 @@ public class HmPageRelationBO implements Serializable {
/** /**
* 引用方来源 * 引用方来源
* *
* @see com.gic.haoban.manage.api.enums.hm.HmPageTemplateType * @see HmPageType
*/ */
private Integer type; private Integer type;
/** /**
* 关联状态 * 关联状态
* @see com.gic.haoban.manage.api.enums.hm.HmPageTemplateStatus * @see HmPageStatus
* *
*/ */
private Integer status; private Integer status;
......
package com.gic.haoban.manage.service.pojo.qo; package com.gic.haoban.manage.service.pojo.qo;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.manage.api.enums.hm.HmPageStatus;
import java.util.Date; import java.util.Date;
...@@ -37,7 +38,7 @@ public class HmPageTemplateQO extends BasePageInfo { ...@@ -37,7 +38,7 @@ public class HmPageTemplateQO extends BasePageInfo {
private Date endTime; private Date endTime;
/** /**
* @see com.gic.haoban.manage.api.enums.hm.HmPageTemplateStatus * @see HmPageStatus
*/ */
private Integer status; private Integer status;
......
package com.gic.haoban.manage.service.service.hm; package com.gic.haoban.manage.service.service.hm;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.hm.HmGroupDTO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupRelationBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupSettingBO;
import com.gic.haoban.manage.service.pojo.qo.HmGroupInfoQO;
import java.util.List; import java.util.List;
...@@ -28,4 +32,40 @@ public interface HmGroupService { ...@@ -28,4 +32,40 @@ public interface HmGroupService {
*/ */
Boolean batchUpdateGroupRelationCount(List<HmGroupRelationBO> groupRelations); Boolean batchUpdateGroupRelationCount(List<HmGroupRelationBO> groupRelations);
/**
* 查询分组被引用的次数
* @param enterpriseId
* @param wxEnterpriseId
* @return
*/
Integer queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId);
/**
* 删除分组
* @param groupDTO
*/
void deleteGroupSetting(HmGroupDTO groupDTO);
/**
* 查询分组详情
* @param groupId
* @return
*/
HmGroupSettingBO queryGroupSettingDetail(Long groupId);
/**
* 条件查询分组列表
* @param groupInfoQo
* @return
*/
Page<HmGroupSettingBO> queryGroupSettingList(HmGroupInfoQO groupInfoQo);
/**
* 保存分组
* @param groupDTO
* @return
*/
Long saveOrUpdateGroupSetting(HmGroupDTO groupDTO);
} }
...@@ -38,14 +38,14 @@ public interface HmPageService { ...@@ -38,14 +38,14 @@ public interface HmPageService {
/** /**
* 删除落地页模板 * 删除落地页模板
* @param pageTemplateDTO * @param pageDTO
*/ */
void deleteHmPageTemplate(HmPageDTO pageTemplateDTO); void deleteHmPage(HmPageDTO pageDTO);
/** /**
* 保存 * 保存
* @param pageTemplateDTO * @param pageDTO
* @return * @return
*/ */
Long saveOrUpdateHmPageTemplate(HmPageDTO pageTemplateDTO); Long saveOrUpdateHmPage(HmPageDTO pageDTO);
} }
package com.gic.haoban.manage.service.service.hm; package com.gic.haoban.manage.service.service.hm;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO; import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
...@@ -27,4 +28,11 @@ public interface WelcomeRelationService { ...@@ -27,4 +28,11 @@ public interface WelcomeRelationService {
* @return * @return
*/ */
List<HmWelcomeRelationBO> queryWelcomeRelationList(WelcomeRelationQO welcomeRelationQo); List<HmWelcomeRelationBO> queryWelcomeRelationList(WelcomeRelationQO welcomeRelationQo);
/**
* 分页查询 欢迎语关联列表
* @param welcomeRelationQo
* @return
*/
Page<HmWelcomeRelationBO> queryWelcomeRelationPage(WelcomeRelationQO welcomeRelationQo);
} }
package com.gic.haoban.manage.service.service.hm.impl; package com.gic.haoban.manage.service.service.hm.impl;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.hm.HmGroupDTO;
import com.gic.haoban.manage.api.enums.hm.HmGroupStatus; import com.gic.haoban.manage.api.enums.hm.HmGroupStatus;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmGroupSettingMapper; import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmGroupSettingMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmGroupSetting; import com.gic.haoban.manage.service.entity.hm.TabHaobanHmGroupSetting;
import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupRelationBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupSettingBO;
import com.gic.haoban.manage.service.pojo.qo.HmGroupInfoQO;
import com.gic.haoban.manage.service.service.hm.HmGroupService; import com.gic.haoban.manage.service.service.hm.HmGroupService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -24,6 +36,9 @@ public class HmGroupServiceImpl implements HmGroupService { ...@@ -24,6 +36,9 @@ public class HmGroupServiceImpl implements HmGroupService {
private static final Logger log = LoggerFactory.getLogger(HmGroupServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(HmGroupServiceImpl.class);
private static final Long DEFAULT_GROUP_ID = NumberUtils.LONG_ZERO;
private static final String DEFAULT_GROUP_NAME = "默认分组";
@Autowired @Autowired
private TabHaobanHmGroupSettingMapper haobanHmGroupSettingMapper; private TabHaobanHmGroupSettingMapper haobanHmGroupSettingMapper;
...@@ -45,4 +60,95 @@ public class HmGroupServiceImpl implements HmGroupService { ...@@ -45,4 +60,95 @@ public class HmGroupServiceImpl implements HmGroupService {
}); });
return null; return null;
} }
/**
* 查询分组被引用的次数
*
* @param enterpriseId
* @param wxEnterpriseId
* @return
*/
@Override
public Integer queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId) {
return 0;
}
/**
* 删除分组
*
* @param groupDTO
*/
@Override
public void deleteGroupSetting(HmGroupDTO groupDTO) {
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting();
tempGroupSetting.setGroupId(groupDTO.getGroupId());
tempGroupSetting.setStatus(HmGroupStatus.DISABLE.getCode());
tempGroupSetting.setModifierId(groupDTO.getModifierId());
tempGroupSetting.setModifierName(groupDTO.getModifierName());
tempGroupSetting.setUpdateTime(new Date());
haobanHmGroupSettingMapper.updateByPrimaryKeySelective(tempGroupSetting);
}
/**
* 查询分组详情
*
* @param groupId
* @return
*/
@Override
public HmGroupSettingBO queryGroupSettingDetail(Long groupId) {
TabHaobanHmGroupSetting tabHaobanHmGroupSetting = haobanHmGroupSettingMapper.selectByPrimaryKey(groupId);
if (tabHaobanHmGroupSetting == null){
return null;
}
HmGroupSettingBO groupSettingBo = new HmGroupSettingBO();
BeanUtils.copyProperties(tabHaobanHmGroupSetting, groupSettingBo);
return groupSettingBo;
}
/**
* 条件查询分组列表
*
* @param groupInfoQo
* @return
*/
@Override
public Page<HmGroupSettingBO> queryGroupSettingList(HmGroupInfoQO groupInfoQo) {
PageHelper.startPage(groupInfoQo.getPageNum(), groupInfoQo.getPageSize());
com.github.pagehelper.Page<TabHaobanHmGroupSetting> tabHaobanHmGroupSettings =
(com.github.pagehelper.Page<TabHaobanHmGroupSetting>) haobanHmGroupSettingMapper.queryHmGroupSettingList(groupInfoQo);
return PageUtil.changePageHelperToCurrentPage(tabHaobanHmGroupSettings, HmGroupSettingBO.class);
}
/**
* 保存分组
*
* @param groupDTO
* @return
*/
@Override
public Long saveOrUpdateGroupSetting(HmGroupDTO groupDTO) {
if (groupDTO.getGroupId() == null) {
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting();
tempGroupSetting.setGroupId(UniqueIdUtils.uniqueLong());
tempGroupSetting.setGroupName(groupDTO.getGroupName());
tempGroupSetting.setCreatorId(groupDTO.getCreatorId());
tempGroupSetting.setCreatorName(groupDTO.getCreatorName());
tempGroupSetting.setCreateTime(new Date());
tempGroupSetting.setStatus(HmGroupStatus.ENABLE.getCode());
tempGroupSetting.setEnterpriseId(groupDTO.getEnterpriseId());
tempGroupSetting.setWxEnterpriseId(groupDTO.getWxEnterpriseId());
haobanHmGroupSettingMapper.insertSelective(tempGroupSetting);
return tempGroupSetting.getGroupId();
}else {
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting();
tempGroupSetting.setGroupId(groupDTO.getGroupId());
tempGroupSetting.setGroupName(groupDTO.getGroupName());
tempGroupSetting.setModifierId(groupDTO.getModifierId());
tempGroupSetting.setModifierName(groupDTO.getModifierName());
tempGroupSetting.setUpdateTime(new Date());
haobanHmGroupSettingMapper.updateByPrimaryKeySelective(tempGroupSetting);
return tempGroupSetting.getGroupId();
}
}
} }
...@@ -2,8 +2,8 @@ package com.gic.haoban.manage.service.service.hm.impl; ...@@ -2,8 +2,8 @@ package com.gic.haoban.manage.service.service.hm.impl;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.enums.hm.HmPageTemplateStatus; import com.gic.haoban.manage.api.enums.hm.HmPageStatus;
import com.gic.haoban.manage.api.enums.hm.HmPageTemplateType; import com.gic.haoban.manage.api.enums.hm.HmPageType;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmPageRelationMapper; import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmPageRelationMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmPageRelation; import com.gic.haoban.manage.service.entity.hm.TabHaobanHmPageRelation;
import com.gic.haoban.manage.service.pojo.bo.hm.HmPageRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmPageRelationBO;
...@@ -47,8 +47,8 @@ public class HmPageRelationServiceImpl implements HmPageRelationService { ...@@ -47,8 +47,8 @@ public class HmPageRelationServiceImpl implements HmPageRelationService {
pageRelation.setReferName(hmPageRelationBO.getReferName()); pageRelation.setReferName(hmPageRelationBO.getReferName());
pageRelation.setCreateTime(new Date()); pageRelation.setCreateTime(new Date());
pageRelation.setUpdateTime(new Date()); pageRelation.setUpdateTime(new Date());
pageRelation.setType(HmPageTemplateType.LINK.getCode()); pageRelation.setType(HmPageType.LINK.getCode());
pageRelation.setStatus(HmPageTemplateStatus.ENABLE.getCode()); pageRelation.setStatus(HmPageStatus.ENABLE.getCode());
return haobanHmPageRelationMapper.insertSelective(pageRelation) == 1; return haobanHmPageRelationMapper.insertSelective(pageRelation) == 1;
} }
...@@ -61,7 +61,7 @@ public class HmPageRelationServiceImpl implements HmPageRelationService { ...@@ -61,7 +61,7 @@ public class HmPageRelationServiceImpl implements HmPageRelationService {
public List<HmPageRelationBO> queryPageTemplateRelation(String pageCode) { public List<HmPageRelationBO> queryPageTemplateRelation(String pageCode) {
HmPageRelationQO hmPageRelationQo = new HmPageRelationQO(); HmPageRelationQO hmPageRelationQo = new HmPageRelationQO();
hmPageRelationQo.setPageCode(pageCode); hmPageRelationQo.setPageCode(pageCode);
hmPageRelationQo.setStatus(HmPageTemplateStatus.ENABLE.getCode()); hmPageRelationQo.setStatus(HmPageStatus.ENABLE.getCode());
hmPageRelationQo.setPageSize(1); hmPageRelationQo.setPageSize(1);
PageHelper.startPage(hmPageRelationQo.getPageNum(), hmPageRelationQo.getPageSize()); PageHelper.startPage(hmPageRelationQo.getPageNum(), hmPageRelationQo.getPageSize());
List<TabHaobanHmPageRelation> tabHaobanHmPageRelations = List<TabHaobanHmPageRelation> tabHaobanHmPageRelations =
......
...@@ -5,7 +5,7 @@ import com.gic.api.base.commons.Page; ...@@ -5,7 +5,7 @@ import com.gic.api.base.commons.Page;
import com.gic.commons.util.UniqueIdUtils; import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.hm.HmPageDTO; import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.enums.hm.HmPageTemplateStatus; import com.gic.haoban.manage.api.enums.hm.HmPageStatus;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmPageMapper; import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmPageMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmPage; import com.gic.haoban.manage.service.entity.hm.TabHaobanHmPage;
import com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO;
...@@ -80,16 +80,16 @@ public class HmPageServiceImpl implements HmPageService { ...@@ -80,16 +80,16 @@ public class HmPageServiceImpl implements HmPageService {
/** /**
* 删除落地页模板 * 删除落地页模板
* *
* @param pageTemplateDTO * @param pageDTO
*/ */
@Override @Override
public void deleteHmPageTemplate(HmPageDTO pageTemplateDTO) { public void deleteHmPage(HmPageDTO pageDTO) {
TabHaobanHmPage tempHmPage = new TabHaobanHmPage(); TabHaobanHmPage tempHmPage = new TabHaobanHmPage();
tempHmPage.setPageId(pageTemplateDTO.getPageId()); tempHmPage.setPageId(pageDTO.getPageId());
tempHmPage.setStatus(HmPageTemplateStatus.DISABLE.getCode()); tempHmPage.setStatus(HmPageStatus.DISABLE.getCode());
tempHmPage.setUpdateTime(new Date()); tempHmPage.setUpdateTime(new Date());
tempHmPage.setModifierId(pageTemplateDTO.getClerkId()); tempHmPage.setModifierId(pageDTO.getClerkId());
tempHmPage.setModifierName(pageTemplateDTO.getClerkName()); tempHmPage.setModifierName(pageDTO.getClerkName());
log.info("[deleteHmPageTemplate] params:{}", JSON.toJSONString(tempHmPage)); log.info("[deleteHmPageTemplate] params:{}", JSON.toJSONString(tempHmPage));
haobanHmPageMapper.updateByPrimaryKeySelective(tempHmPage); haobanHmPageMapper.updateByPrimaryKeySelective(tempHmPage);
} }
...@@ -97,37 +97,37 @@ public class HmPageServiceImpl implements HmPageService { ...@@ -97,37 +97,37 @@ public class HmPageServiceImpl implements HmPageService {
/** /**
* 保存 * 保存
* *
* @param pageTemplateDTO * @param pageDTO
* @return * @return
*/ */
@Override @Override
public Long saveOrUpdateHmPageTemplate(HmPageDTO pageTemplateDTO) { public Long saveOrUpdateHmPage(HmPageDTO pageDTO) {
log.info("[saveOrUpdateHmPageTemplate] params:{}", JSON.toJSONString(pageTemplateDTO)); log.info("[saveOrUpdateHmPageTemplate] params:{}", JSON.toJSONString(pageDTO));
Date now = new Date(); Date now = new Date();
if (Objects.isNull(pageTemplateDTO.getPageId())) { if (Objects.isNull(pageDTO.getPageId())) {
// save // save
TabHaobanHmPage haobanHmPage = new TabHaobanHmPage(); TabHaobanHmPage haobanHmPage = new TabHaobanHmPage();
BeanUtils.copyProperties(pageTemplateDTO, haobanHmPage); BeanUtils.copyProperties(pageDTO, haobanHmPage);
haobanHmPage.setPageId(UniqueIdUtils.uniqueLong()); haobanHmPage.setPageId(UniqueIdUtils.uniqueLong());
haobanHmPage.setPageCode(this.generatorTemplateCode(haobanHmPage.getPageId())); haobanHmPage.setPageCode(this.generatorTemplateCode(haobanHmPage.getPageId()));
haobanHmPage.setCreateorId(pageTemplateDTO.getClerkId()); haobanHmPage.setCreateorId(pageDTO.getClerkId());
haobanHmPage.setCreateorName(pageTemplateDTO.getClerkName()); haobanHmPage.setCreateorName(pageDTO.getClerkName());
haobanHmPage.setCreateTime(now); haobanHmPage.setCreateTime(now);
haobanHmPage.setModifierId(pageTemplateDTO.getClerkId()); haobanHmPage.setModifierId(pageDTO.getClerkId());
haobanHmPage.setModifierName(pageTemplateDTO.getClerkName()); haobanHmPage.setModifierName(pageDTO.getClerkName());
haobanHmPage.setUpdateTime(now); haobanHmPage.setUpdateTime(now);
haobanHmPage.setStatus(HmPageTemplateStatus.ENABLE.getCode()); haobanHmPage.setStatus(HmPageStatus.ENABLE.getCode());
haobanHmPageMapper.insertSelective(haobanHmPage); haobanHmPageMapper.insertSelective(haobanHmPage);
return haobanHmPage.getPageId(); return haobanHmPage.getPageId();
} else { } else {
// update // update
TabHaobanHmPage haobanHmPage = new TabHaobanHmPage(); TabHaobanHmPage haobanHmPage = new TabHaobanHmPage();
BeanUtils.copyProperties(pageTemplateDTO, haobanHmPage); BeanUtils.copyProperties(pageDTO, haobanHmPage);
haobanHmPage.setPageId(pageTemplateDTO.getPageId()); haobanHmPage.setPageId(pageDTO.getPageId());
haobanHmPage.setPageCode(null); haobanHmPage.setPageCode(null);
haobanHmPage.setUpdateTime(now); haobanHmPage.setUpdateTime(now);
haobanHmPage.setModifierId(pageTemplateDTO.getClerkId()); haobanHmPage.setModifierId(pageDTO.getClerkId());
haobanHmPage.setModifierName(pageTemplateDTO.getClerkName()); haobanHmPage.setModifierName(pageDTO.getClerkName());
haobanHmPageMapper.updateByPrimaryKeySelective(haobanHmPage); haobanHmPageMapper.updateByPrimaryKeySelective(haobanHmPage);
return haobanHmPage.getPageId(); return haobanHmPage.getPageId();
} }
......
package com.gic.haoban.manage.service.service.hm.impl; package com.gic.haoban.manage.service.service.hm.impl;
import com.gic.api.base.commons.Page;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation; import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO; import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService; import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.github.pagehelper.PageHelper;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -63,4 +66,18 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService { ...@@ -63,4 +66,18 @@ public class WelcomeRelationServiceImpl implements WelcomeRelationService {
return welcomeRelationBo; return welcomeRelationBo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 分页查询 欢迎语关联列表
*
* @param welcomeRelationQo
* @return
*/
@Override
public Page<HmWelcomeRelationBO> queryWelcomeRelationPage(WelcomeRelationQO welcomeRelationQo) {
PageHelper.startPage(welcomeRelationQo.getPageNum(), welcomeRelationQo.getPageSize());
com.github.pagehelper.Page<TabHaobanWelcomeTemplateRelation> tabHaobanWelcomeTemplateRelations =
(com.github.pagehelper.Page<TabHaobanWelcomeTemplateRelation>) welcomeTemplateRelationMapper.queryWelcomeTemplate(welcomeRelationQo);
return PageUtil.changePageHelperToCurrentPage(tabHaobanWelcomeTemplateRelations, HmWelcomeRelationBO.class);
}
} }
...@@ -3,17 +3,15 @@ package com.gic.haoban.manage.service.service.out.impl.hm; ...@@ -3,17 +3,15 @@ package com.gic.haoban.manage.service.service.out.impl.hm;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon; import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.hm.HmGroupDTO; import com.gic.haoban.manage.api.dto.hm.HmGroupDTO;
import com.gic.haoban.manage.api.dto.hm.HmGroupQueryDTO; import com.gic.haoban.manage.api.dto.hm.HmGroupQueryDTO;
import com.gic.haoban.manage.api.enums.hm.HmGroupStatus; import com.gic.haoban.manage.api.enums.hm.HmGroupStatus;
import com.gic.haoban.manage.api.service.hm.HmGroupApiService; import com.gic.haoban.manage.api.service.hm.HmGroupApiService;
import com.gic.haoban.manage.service.dao.mapper.hm.TabHaobanHmGroupSettingMapper; import com.gic.haoban.manage.service.pojo.bo.hm.HmGroupSettingBO;
import com.gic.haoban.manage.service.entity.hm.TabHaobanHmGroupSetting;
import com.gic.haoban.manage.service.pojo.qo.HmGroupInfoQO; import com.gic.haoban.manage.service.pojo.qo.HmGroupInfoQO;
import com.github.pagehelper.PageHelper; import com.gic.haoban.manage.service.service.hm.HmGroupService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
...@@ -24,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -24,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -42,68 +39,51 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -42,68 +39,51 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
private static final String DEFAULT_GROUP_NAME = "默认分组"; private static final String DEFAULT_GROUP_NAME = "默认分组";
@Autowired @Autowired
private TabHaobanHmGroupSettingMapper haobanHmGroupSettingMapper; private HmGroupService groupService;
@Override @Override
public ServiceResponse<Long> saveOrUpdateHmGroupSetting(HmGroupDTO hmGroupDTO) { public ServiceResponse<Long> saveOrUpdateHmGroupSetting(HmGroupDTO hmGroupDTO) {
if (StringUtils.isBlank(hmGroupDTO.getGroupName())) { if (StringUtils.isBlank(hmGroupDTO.getGroupName())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
if (StringUtils.equals(DEFAULT_GROUP_NAME, hmGroupDTO.getGroupName())){ if (StringUtils.equals(DEFAULT_GROUP_NAME, hmGroupDTO.getGroupName())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
HmGroupInfoQO groupInfoQo = new HmGroupInfoQO(); HmGroupInfoQO groupInfoQo = new HmGroupInfoQO();
groupInfoQo.setGroupName(hmGroupDTO.getGroupName()); groupInfoQo.setGroupName(hmGroupDTO.getGroupName());
groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode()); groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode());
groupInfoQo.setEnterpriseId(hmGroupDTO.getEnterpriseId()); groupInfoQo.setEnterpriseId(hmGroupDTO.getEnterpriseId());
groupInfoQo.setWxEnterpriseId(groupInfoQo.getWxEnterpriseId()); groupInfoQo.setWxEnterpriseId(groupInfoQo.getWxEnterpriseId());
List<TabHaobanHmGroupSetting> tabHaobanHmGroupSettings = haobanHmGroupSettingMapper.queryHmGroupSettingList(groupInfoQo); Page<HmGroupSettingBO> hmGroupSettingPage = groupService.queryGroupSettingList(groupInfoQo);
if (hmGroupDTO.getGroupId() == null) { if (hmGroupDTO.getGroupId() == null) {
// insert // insert
// check groupName unique // check groupName unique
if (CollectionUtils.isNotEmpty(tabHaobanHmGroupSettings)) { if (CollectionUtils.isNotEmpty(hmGroupSettingPage.getResult())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting();
tempGroupSetting.setGroupId(UniqueIdUtils.uniqueLong());
tempGroupSetting.setGroupName(hmGroupDTO.getGroupName());
tempGroupSetting.setCreatorId(hmGroupDTO.getCreatorId());
tempGroupSetting.setCreatorName(hmGroupDTO.getCreatorName());
tempGroupSetting.setCreateTime(new Date());
tempGroupSetting.setStatus(HmGroupStatus.ENABLE.getCode());
tempGroupSetting.setEnterpriseId(hmGroupDTO.getEnterpriseId());
tempGroupSetting.setWxEnterpriseId(hmGroupDTO.getWxEnterpriseId());
haobanHmGroupSettingMapper.insertSelective(tempGroupSetting);
return ServiceResponse.success(tempGroupSetting.getGroupId());
} else { } else {
// update // update
if (CollectionUtils.isNotEmpty(tabHaobanHmGroupSettings) if (CollectionUtils.isNotEmpty(hmGroupSettingPage.getResult())
&& tabHaobanHmGroupSettings.size() > 1) { && hmGroupSettingPage.getTotalCount() > 1) {
// 名称重复 // 名称重复
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
if (CollectionUtils.isNotEmpty(tabHaobanHmGroupSettings) if (CollectionUtils.isNotEmpty(hmGroupSettingPage.getResult())
&& !tabHaobanHmGroupSettings.get(0).getGroupId().equals(hmGroupDTO.getGroupId())) { && !hmGroupSettingPage.getResult().get(0).getGroupId().equals(hmGroupDTO.getGroupId())) {
// 名称重复 // 名称重复
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
TabHaobanHmGroupSetting tabHaobanHmGroupSetting = haobanHmGroupSettingMapper.selectByPrimaryKey(hmGroupDTO.getGroupId()); HmGroupSettingBO groupSettingBo = groupService.queryGroupSettingDetail(hmGroupDTO.getGroupId());
if (tabHaobanHmGroupSetting == null) { if (groupSettingBo == null) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode()+"", HaoBanErrCodeCommon.ERR_8.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
} }
if (!StringUtils.equals(tabHaobanHmGroupSetting.getEnterpriseId(), hmGroupDTO.getEnterpriseId())) { if (!StringUtils.equals(groupSettingBo.getEnterpriseId(), hmGroupDTO.getEnterpriseId())) {
// 无权限 // 无权限
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode()+"", HaoBanErrCodeCommon.ERR_9.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode() + "", HaoBanErrCodeCommon.ERR_9.getMsg());
} }
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting();
tempGroupSetting.setGroupId(tabHaobanHmGroupSetting.getGroupId());
tempGroupSetting.setGroupName(hmGroupDTO.getGroupName());
tempGroupSetting.setModifierId(hmGroupDTO.getModifierId());
tempGroupSetting.setModifierName(hmGroupDTO.getModifierName());
tempGroupSetting.setUpdateTime(new Date());
haobanHmGroupSettingMapper.updateByPrimaryKeySelective(tempGroupSetting);
return ServiceResponse.success(tempGroupSetting.getGroupId());
} }
Long groupId = groupService.saveOrUpdateGroupSetting(hmGroupDTO);
return ServiceResponse.success(groupId);
} }
@Override @Override
...@@ -112,52 +92,46 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -112,52 +92,46 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
HmGroupInfoQO groupInfoQo = new HmGroupInfoQO(); HmGroupInfoQO groupInfoQo = new HmGroupInfoQO();
BeanUtils.copyProperties(groupQueryDTO, groupInfoQo); BeanUtils.copyProperties(groupQueryDTO, groupInfoQo);
groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode()); groupInfoQo.setStatus(HmGroupStatus.ENABLE.getCode());
PageHelper.startPage(groupInfoQo.getPageNum(), groupInfoQo.getPageSize()); Page<HmGroupSettingBO> groupSettingPage = groupService.queryGroupSettingList(groupInfoQo);
com.github.pagehelper.Page<TabHaobanHmGroupSetting> tabHaobanHmGroupSettings =
(com.github.pagehelper.Page<TabHaobanHmGroupSetting>) haobanHmGroupSettingMapper.queryHmGroupSettingList(groupInfoQo);
Page<HmGroupDTO> hmGroupInfoPage = PageUtil.changePageHelperToCurrentPage(tabHaobanHmGroupSettings, HmGroupDTO.class);
// todo query 活码 默认分组的总数 Page<HmGroupDTO> groupDtoPage = PageUtil.changeToCurrentPage(groupSettingPage, HmGroupDTO.class);
List<HmGroupDTO> result = new ArrayList<>(); List<HmGroupDTO> result = new ArrayList<>();
// todo query 活码 默认分组的总数
result.add(buildDefault(null)); result.add(buildDefault(null));
if (CollectionUtils.isNotEmpty(hmGroupInfoPage.getResult())){ if (CollectionUtils.isNotEmpty(groupDtoPage.getResult())) {
hmGroupInfoPage.getResult().forEach(item -> item.setDefaultFlag(0)); groupDtoPage.getResult().forEach(item -> item.setDefaultFlag(0));
result.addAll(hmGroupInfoPage.getResult()); result.addAll(groupDtoPage.getResult());
} }
hmGroupInfoPage.setResult(result); groupDtoPage.setResult(result);
return ServiceResponse.success(hmGroupInfoPage); return ServiceResponse.success(groupDtoPage);
} }
private HmGroupDTO buildDefault(Integer num){ private HmGroupDTO buildDefault(Integer num) {
HmGroupDTO hmGroupDTO = new HmGroupDTO(); HmGroupDTO groupSettingDTO = new HmGroupDTO();
hmGroupDTO.setGroupId(DEFAULT_GROUP_ID); groupSettingDTO.setGroupId(DEFAULT_GROUP_ID);
hmGroupDTO.setGroupName(DEFAULT_GROUP_NAME); groupSettingDTO.setGroupName(DEFAULT_GROUP_NAME);
hmGroupDTO.setDefaultFlag(1); groupSettingDTO.setDefaultFlag(1);
hmGroupDTO.setReferNum(num); groupSettingDTO.setReferNum(num);
return hmGroupDTO; return groupSettingDTO;
} }
@Override @Override
public ServiceResponse<Boolean> deleteGroupSetting(HmGroupDTO groupDTO) { public ServiceResponse<Boolean> deleteGroupSetting(HmGroupDTO groupDTO) {
log.info("[deleteGroupSetting] 删除分组, params:{}", JSON.toJSONString(groupDTO)); log.info("[deleteGroupSetting] 删除分组, params:{}", JSON.toJSONString(groupDTO));
if (groupDTO.getGroupId() == null) { if (groupDTO.getGroupId() == null) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_2.getCode()+"", HaoBanErrCodeCommon.ERR_2.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_2.getCode() + "", HaoBanErrCodeCommon.ERR_2.getMsg());
} }
if (DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())){ if (DEFAULT_GROUP_ID.equals(groupDTO.getGroupId())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
TabHaobanHmGroupSetting tabHaobanHmGroupSetting = haobanHmGroupSettingMapper.selectByPrimaryKey(groupDTO.getGroupId()); HmGroupSettingBO groupSettingBo = groupService.queryGroupSettingDetail(groupDTO.getGroupId());
if (tabHaobanHmGroupSetting == null || !HmGroupStatus.ENABLE.getCode().equals(tabHaobanHmGroupSetting.getStatus())) { if (groupSettingBo == null
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode()+"", HaoBanErrCodeCommon.ERR_5.getMsg()); || !HmGroupStatus.ENABLE.getCode().equals(groupSettingBo.getStatus())
|| groupSettingBo.getReferNum() != 0) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_5.getCode() + "", HaoBanErrCodeCommon.ERR_5.getMsg());
} }
// todo query hm 校验分组是否被引用 groupService.deleteGroupSetting(groupDTO);
TabHaobanHmGroupSetting tempGroupSetting = new TabHaobanHmGroupSetting(); return ServiceResponse.success(Boolean.TRUE);
tempGroupSetting.setGroupId(tabHaobanHmGroupSetting.getGroupId());
tempGroupSetting.setStatus(HmGroupStatus.DISABLE.getCode());
tempGroupSetting.setModifierId(groupDTO.getModifierId());
tempGroupSetting.setModifierName(groupDTO.getModifierName());
tempGroupSetting.setUpdateTime(new Date());
return ServiceResponse.success(haobanHmGroupSettingMapper.updateByPrimaryKeySelective(tempGroupSetting) == 1);
} }
/** /**
...@@ -168,8 +142,8 @@ public class HmGroupApiServiceImpl implements HmGroupApiService { ...@@ -168,8 +142,8 @@ public class HmGroupApiServiceImpl implements HmGroupApiService {
* @return * @return
*/ */
@Override @Override
public ServiceResponse<Integer> queryGroupReferCount(String enterpriseId, String wxEnterpriseId) { public ServiceResponse<Integer> queryGroupTotalReferCount(String enterpriseId, String wxEnterpriseId) {
// todo query 分组引用的总数 Integer referCount = groupService.queryGroupTotalReferCount(enterpriseId, wxEnterpriseId);
return ServiceResponse.success(0); return ServiceResponse.success(referCount);
} }
} }
...@@ -8,7 +8,7 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO; ...@@ -8,7 +8,7 @@ import com.gic.haoban.manage.api.dto.hm.HmPageDTO;
import com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO; import com.gic.haoban.manage.api.dto.hm.HmPageRelationDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmPageQDTO;
import com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO; import com.gic.haoban.manage.api.dto.qdto.hm.HmPageRelationQDTO;
import com.gic.haoban.manage.api.enums.hm.HmPageTemplateStatus; import com.gic.haoban.manage.api.enums.hm.HmPageStatus;
import com.gic.haoban.manage.api.service.hm.HmPageApiService; import com.gic.haoban.manage.api.service.hm.HmPageApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmPageBO;
import com.gic.haoban.manage.service.pojo.bo.hm.HmPageRelationBO; import com.gic.haoban.manage.service.pojo.bo.hm.HmPageRelationBO;
...@@ -37,8 +37,6 @@ import java.util.Objects; ...@@ -37,8 +37,6 @@ import java.util.Objects;
public class HmPageApiServiceImpl implements HmPageApiService { public class HmPageApiServiceImpl implements HmPageApiService {
private static final Logger log = LoggerFactory.getLogger(HmPageApiServiceImpl.class); private static final Logger log = LoggerFactory.getLogger(HmPageApiServiceImpl.class);
private static final String TEMPLATE_CODE_PREFIX = "MB01";
@Autowired @Autowired
private HmPageRelationService pageRelationService; private HmPageRelationService pageRelationService;
...@@ -64,7 +62,7 @@ public class HmPageApiServiceImpl implements HmPageApiService { ...@@ -64,7 +62,7 @@ public class HmPageApiServiceImpl implements HmPageApiService {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode() + "", HaoBanErrCodeCommon.ERR_9.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode() + "", HaoBanErrCodeCommon.ERR_9.getMsg());
} }
} }
return ServiceResponse.success(haobanHmPageService.saveOrUpdateHmPageTemplate(pageDTO)); return ServiceResponse.success(haobanHmPageService.saveOrUpdateHmPage(pageDTO));
} }
@Override @Override
...@@ -72,13 +70,13 @@ public class HmPageApiServiceImpl implements HmPageApiService { ...@@ -72,13 +70,13 @@ public class HmPageApiServiceImpl implements HmPageApiService {
public ServiceResponse<Boolean> deleteHmPage(HmPageDTO pageDTO) { public ServiceResponse<Boolean> deleteHmPage(HmPageDTO pageDTO) {
HmPageBO pageBo = haobanHmPageService.queryHmPageDetail(pageDTO.getPageId()); HmPageBO pageBo = haobanHmPageService.queryHmPageDetail(pageDTO.getPageId());
if (Objects.isNull(pageBo) || !Objects.equals(HmPageTemplateStatus.ENABLE.getCode(), pageBo.getStatus())) { if (Objects.isNull(pageBo) || !Objects.equals(HmPageStatus.ENABLE.getCode(), pageBo.getStatus())) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_8.getCode() + "", HaoBanErrCodeCommon.ERR_8.getMsg());
} }
if (this.checkPageIsBeQuoted(pageBo.getPageCode()) > 0) { if (this.checkPageIsBeQuoted(pageBo.getPageCode()) > 0) {
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode() + "", HaoBanErrCodeCommon.ERR_9.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_9.getCode() + "", HaoBanErrCodeCommon.ERR_9.getMsg());
} }
haobanHmPageService.deleteHmPageTemplate(pageDTO); haobanHmPageService.deleteHmPage(pageDTO);
return ServiceResponse.success(Boolean.TRUE); return ServiceResponse.success(Boolean.TRUE);
} }
...@@ -86,7 +84,7 @@ public class HmPageApiServiceImpl implements HmPageApiService { ...@@ -86,7 +84,7 @@ public class HmPageApiServiceImpl implements HmPageApiService {
public ServiceResponse<Page<HmPageDTO>> queryPageList(HmPageQDTO pageQueryDTO) { public ServiceResponse<Page<HmPageDTO>> queryPageList(HmPageQDTO pageQueryDTO) {
HmPageTemplateQO pageTemplateQo = new HmPageTemplateQO(); HmPageTemplateQO pageTemplateQo = new HmPageTemplateQO();
BeanUtils.copyProperties(pageQueryDTO, pageTemplateQo); BeanUtils.copyProperties(pageQueryDTO, pageTemplateQo);
pageTemplateQo.setStatus(HmPageTemplateStatus.ENABLE.getCode()); pageTemplateQo.setStatus(HmPageStatus.ENABLE.getCode());
Page<HmPageBO> hmPageBoPages = haobanHmPageService.queryPageList(pageTemplateQo); Page<HmPageBO> hmPageBoPages = haobanHmPageService.queryPageList(pageTemplateQo);
Page<HmPageDTO> pageRespVos = PageUtil.changeToCurrentPage(hmPageBoPages, HmPageDTO.class); Page<HmPageDTO> pageRespVos = PageUtil.changeToCurrentPage(hmPageBoPages, HmPageDTO.class);
return ServiceResponse.success(pageRespVos); return ServiceResponse.success(pageRespVos);
......
...@@ -7,10 +7,9 @@ import com.gic.haoban.common.utils.PageUtil; ...@@ -7,10 +7,9 @@ import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.hm.HmWelcomeRelationDTO; import com.gic.haoban.manage.api.dto.hm.HmWelcomeRelationDTO;
import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeRelationQDTO; import com.gic.haoban.manage.api.dto.welcome.qdto.QueryWelcomeRelationQDTO;
import com.gic.haoban.manage.api.service.hm.HmWelcomeRelationApiService; import com.gic.haoban.manage.api.service.hm.HmWelcomeRelationApiService;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeTemplateRelationMapper; import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.entity.hm.TabHaobanWelcomeTemplateRelation;
import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO; import com.gic.haoban.manage.service.pojo.qo.WelcomeRelationQO;
import com.github.pagehelper.PageHelper; import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,24 +23,23 @@ import org.springframework.stereotype.Component; ...@@ -24,24 +23,23 @@ import org.springframework.stereotype.Component;
public class HmWelcomeRelationApiServiceImpl implements HmWelcomeRelationApiService { public class HmWelcomeRelationApiServiceImpl implements HmWelcomeRelationApiService {
@Autowired @Autowired
private TabHaobanWelcomeTemplateRelationMapper welcomeTemplateRelationMapper; private WelcomeRelationService welcomeRelationService;
/** /**
* 条件查询 欢迎语关联关系 * 条件查询 欢迎语关联关系
* *
* @param queryWelcomeRelationQDTO * @param queryWelcomeRelationQdto
* @return * @return
*/ */
@Override @Override
public ServiceResponse<Page<HmWelcomeRelationDTO>> queryWelcomeRelation(QueryWelcomeRelationQDTO queryWelcomeRelationQDTO) { public ServiceResponse<Page<HmWelcomeRelationDTO>> queryWelcomeRelation(QueryWelcomeRelationQDTO queryWelcomeRelationQdto) {
if (queryWelcomeRelationQDTO.getWelcomeId() == null){ if (queryWelcomeRelationQdto.getWelcomeId() == null){
return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_2.getCode()+"", HaoBanErrCodeCommon.ERR_2.getMsg()); return ServiceResponse.failure(HaoBanErrCodeCommon.ERR_2.getCode()+"", HaoBanErrCodeCommon.ERR_2.getMsg());
} }
WelcomeRelationQO welcomeRelationQo = new WelcomeRelationQO(); WelcomeRelationQO welcomeRelationQo = new WelcomeRelationQO();
welcomeRelationQo.setWelcomeId(queryWelcomeRelationQDTO.getWelcomeId()); welcomeRelationQo.setWelcomeId(queryWelcomeRelationQdto.getWelcomeId());
PageHelper.startPage(queryWelcomeRelationQDTO.getPageNum(), queryWelcomeRelationQDTO.getPageSize()); Page<HmWelcomeRelationBO> welcomeRelationPage = welcomeRelationService.queryWelcomeRelationPage(welcomeRelationQo);
com.github.pagehelper.Page<TabHaobanWelcomeTemplateRelation> tabHaobanWelcomeTemplateRelations = Page<HmWelcomeRelationDTO> welcomeRelationDTOPage = PageUtil.changeToCurrentPage(welcomeRelationPage, HmWelcomeRelationDTO.class);
(com.github.pagehelper.Page<TabHaobanWelcomeTemplateRelation>) welcomeTemplateRelationMapper.queryWelcomeTemplate(welcomeRelationQo); return ServiceResponse.success(welcomeRelationDTOPage);
Page<HmWelcomeRelationDTO> hmWelcomeRelationDTOPage = PageUtil.changePageHelperToCurrentPage(tabHaobanWelcomeTemplateRelations, HmWelcomeRelationDTO.class);
return ServiceResponse.success(hmWelcomeRelationDTOPage);
} }
} }
...@@ -103,7 +103,7 @@ public class HmGroupController extends WebBaseController { ...@@ -103,7 +103,7 @@ public class HmGroupController extends WebBaseController {
@RequestMapping(path = "/refer/count") @RequestMapping(path = "/refer/count")
public RestResponse<?> queryGroupTotalReferCount(){ public RestResponse<?> queryGroupTotalReferCount(){
WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser(); WebLoginDTO loginUser = AuthWebRequestUtil.getLoginUser();
ServiceResponse<Integer> serviceResponse = groupApiService.queryGroupReferCount(loginUser.getEnterpriseId(), loginUser.getWxEnterpriseId()); ServiceResponse<Integer> serviceResponse = groupApiService.queryGroupTotalReferCount(loginUser.getEnterpriseId(), loginUser.getWxEnterpriseId());
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
} }
...@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
**/ **/
@RestController @RestController
@RequestMapping(path = "/hm/guide") @RequestMapping(path = "/hm/guide")
public class HmPageTemplateController { public class HmPageController {
@Autowired @Autowired
private HmPageApiService pageApiService; private HmPageApiService pageApiService;
...@@ -50,7 +50,7 @@ public class HmPageTemplateController { ...@@ -50,7 +50,7 @@ public class HmPageTemplateController {
if (serviceResponse.isSuccess()){ if (serviceResponse.isSuccess()){
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
return RestResponse.failure(serviceResponse.getCode()+"", serviceResponse.getMessage()); return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
} }
...@@ -74,7 +74,7 @@ public class HmPageTemplateController { ...@@ -74,7 +74,7 @@ public class HmPageTemplateController {
if (serviceResponse.isSuccess()){ if (serviceResponse.isSuccess()){
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
return RestResponse.failure(serviceResponse.getCode()+"", serviceResponse.getMessage()); return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
} }
@RequestMapping(path = "/page/list") @RequestMapping(path = "/page/list")
...@@ -105,7 +105,7 @@ public class HmPageTemplateController { ...@@ -105,7 +105,7 @@ public class HmPageTemplateController {
if (serviceResponse.isSuccess()){ if (serviceResponse.isSuccess()){
return RestResponse.successResult(serviceResponse.getResult()); return RestResponse.successResult(serviceResponse.getResult());
} }
return RestResponse.failure(serviceResponse.getCode()+"", serviceResponse.getMessage()); return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
} }
@RequestMapping(path = "/page/detail") @RequestMapping(path = "/page/detail")
......
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