Browse Source

标签记录orgIdPath

dev
yinzuomei 3 years ago
parent
commit
52f195a0a2
  1. 16
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagCustomerDTO.java
  2. 2
      epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TagCustomerFormDTO.java
  3. 1
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java
  4. 5
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagScopeDao.java
  5. 13
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java
  6. 28
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java
  7. 11
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml
  8. 12
      epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagScopeDao.xml

16
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/TagCustomerDTO.java

@ -18,12 +18,14 @@
package com.epmet.dto;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -54,6 +56,10 @@ public class TagCustomerDTO implements Serializable {
* 标签名称
*/
private String tagName;
/**
* 标签颜色
*/
private String tagColor;
/**
* 使用计数
@ -69,31 +75,41 @@ public class TagCustomerDTO implements Serializable {
/**
* 删除标识 0.未删除 1.已删除
*/
@JsonIgnore
private Integer delFlag;
/**
* 乐观锁
*/
@JsonIgnore
private Integer revision;
/**
* 创建人
*/
@JsonIgnore
private String createdBy;
/**
* 创建时间
*/
@JsonIgnore
private Date createdTime;
/**
* 更新人
*/
@JsonIgnore
private String updatedBy;
/**
* 更新时间
*/
@JsonIgnore
private Date updatedTime;
/**
* 应用范围
*/
private List<TagScopeDTO> agencyList;
}

2
epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/TagCustomerFormDTO.java

@ -47,7 +47,7 @@ public class TagCustomerFormDTO implements Serializable {
/**
* 应用范围,只能选社区
*/
private List<TagScopeDTO> agencyIds;
private List<TagScopeDTO> agencyList;
/**
* 客户ID
*/

1
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagCustomerDao.java

@ -64,4 +64,5 @@ public interface TagCustomerDao extends BaseDao<TagCustomerEntity> {
* @return
*/
List<TagCustomerDTO> pageList(@Param("customerId") String customerId, @Param("tagName")String tagName);
}

5
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/dao/TagScopeDao.java

@ -1,10 +1,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.TagScopeDTO;
import com.epmet.entity.TagScopeEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 标签应用范围表
*
@ -15,4 +18,6 @@ import org.apache.ibatis.annotations.Param;
public interface TagScopeDao extends BaseDao<TagScopeEntity> {
int deleteByTagId(@Param("tagId") String tagId, @Param("customerId") String customerId);
List<TagScopeDTO> selectScope(String tagId);
}

13
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/TagCustomerService.java

@ -25,9 +25,6 @@ import com.epmet.dto.form.TagCustomerPageFormDTO;
import com.epmet.dto.result.UpdateTagUseCountsResultDTO;
import com.epmet.entity.TagCustomerEntity;
import java.util.List;
import java.util.Map;
/**
* 客户标签表
*
@ -46,16 +43,6 @@ public interface TagCustomerService extends BaseService<TagCustomerEntity> {
*/
PageData<TagCustomerDTO> page(TagCustomerPageFormDTO formDTO);
/**
* 默认查询
*
* @param params
* @return java.util.List<TagCustomerDTO>
* @author generator
* @date 2020-06-02
*/
List<TagCustomerDTO> list(Map<String, Object> params);
/**
* 单条查询
*

28
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/TagCustomerServiceImpl.java

@ -18,10 +18,8 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -43,7 +41,6 @@ import com.epmet.utils.TagColorUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -51,7 +48,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 客户标签表
@ -78,22 +74,6 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC
return new PageData<>(list, pageInfo.getTotal());
}
@Override
public List<TagCustomerDTO> list(Map<String, Object> params) {
List<TagCustomerEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, TagCustomerDTO.class);
}
private QueryWrapper<TagCustomerEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<TagCustomerEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public TagCustomerDTO get(String id) {
TagCustomerEntity entity = baseDao.selectById(id);
@ -119,8 +99,8 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC
entity.setUseCount(NumConstant.ZERO);
entity.setShowFlag(NumConstant.ONE);
insert(entity);
if(CollectionUtils.isNotEmpty(dto.getAgencyIds())){
dto.getAgencyIds().forEach(tagScopeDTO->{
if(CollectionUtils.isNotEmpty(dto.getAgencyList())){
dto.getAgencyList().forEach(tagScopeDTO->{
TagScopeEntity tagScopeEntity=new TagScopeEntity();
tagScopeEntity.setCustomerId(entity.getCustomerId());
tagScopeEntity.setTagId(entity.getId());
@ -151,8 +131,8 @@ public class TagCustomerServiceImpl extends BaseServiceImpl<TagCustomerDao, TagC
updateById(entity);
//删除应用范围
tagScopeDao.deleteByTagId(entity.getId(),entity.getCustomerId());
if(CollectionUtils.isNotEmpty(dto.getAgencyIds())){
dto.getAgencyIds().forEach(tagScopeDTO->{
if(CollectionUtils.isNotEmpty(dto.getAgencyList())){
dto.getAgencyList().forEach(tagScopeDTO->{
TagScopeEntity tagScopeEntity=new TagScopeEntity();
tagScopeEntity.setCustomerId(entity.getCustomerId());
tagScopeEntity.setTagId(entity.getId());

11
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagCustomerDao.xml

@ -56,8 +56,17 @@
ORDER BY CUSTOMER_ID
</select>
<resultMap id="TagCustomerMap" type="com.epmet.dto.TagCustomerDTO">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="tagName" column="TAG_NAME"/>
<result property="tagColor" column="TAG_COLOR"/>
<result property="useCount" column="USE_COUNT"/>
<result property="showFlag" column="SHOW_FLAG"/>
<association property="agencyList" column="ID" select="com.epmet.dao.TagScopeDao.selectScope"/>
</resultMap>
<!-- pc标签管理-分页查询 -->
<select id="pageList" parameterType="map" resultType="com.epmet.dto.TagCustomerDTO">
<select id="pageList" parameterType="map" resultMap="TagCustomerMap">
select tc.*
from tag_customer tc
where tc.del_flag='0'

12
epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/TagScopeDao.xml

@ -8,6 +8,8 @@
<result property="customerId" column="CUSTOMER_ID"/>
<result property="tagId" column="TAG_ID"/>
<result property="agencyId" column="AGENCY_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="agencyName" column="AGENCY_NAME"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -21,4 +23,14 @@
where TAG_ID=#{tagId}
and CUSTOMER_ID=#{customerId}
</delete>
<select id="selectScope" parameterType="java.lang.String" resultType="com.epmet.dto.TagScopeDTO">
select ts.TAG_ID,
ts.AGENCY_ID,
ts.ORG_ID_PATH,
ts.AGENCY_NAME
from tag_scope ts
where ts.del_flag='0'
and ts.TAG_ID=#{tagId}
</select>
</mapper>
Loading…
Cancel
Save