| @@ -467,4 +467,11 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(wxCUserBasicInfo); | return new ResultData(wxCUserBasicInfo); | ||||
| } | } | ||||
| @ApiOperation("获取会员过滤器") | |||||
| @GetMapping("/listFilter") | |||||
| public ResultData listFilter() { | |||||
| logger.debug("[" + getIpAddr() + "] WxCUserBasicInfoController::listFilter"); | |||||
| return new ResultData(wxCUserBasicInfoService.listFilters(getTenantId())); | |||||
| } | |||||
| } | } | ||||
| @@ -37,11 +37,6 @@ public class WxTagsController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxTagsService wxTagsService; | private WxTagsService wxTagsService; | ||||
| @Autowired | |||||
| private WxTagsGroupService wxTagsGroupService; | |||||
| @Autowired | |||||
| private WxTagsTypeService wxTagsTypeService; | |||||
| @Autowired | @Autowired | ||||
| private WxCUserTagsService wxCUserTagsService; | private WxCUserTagsService wxCUserTagsService; | ||||
| @@ -50,34 +45,7 @@ public class WxTagsController extends BaseController { | |||||
| @ApiOperation("标签弹窗接口") | @ApiOperation("标签弹窗接口") | ||||
| public ResultData getAllList() { | public ResultData getAllList() { | ||||
| logger.debug("[" + getIpAddr() + "] WxTagsController::getAllList"); | logger.debug("[" + getIpAddr() + "] WxTagsController::getAllList"); | ||||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||||
| for(WxTagsGroup tg:groups) { | |||||
| WxTagsGroupVo tgvo =new WxTagsGroupVo(); | |||||
| tgvo.setId(tg.getId()); | |||||
| tgvo.setName(tg.getName()); | |||||
| WxTagsType type = new WxTagsType(); | |||||
| type.setGroupId(tg.getId()); | |||||
| List<WxTagsTypeVo> typeVos =new ArrayList<>(); | |||||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||||
| for(WxTagsType tt:types) { | |||||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||||
| ttvo.setId(tt.getId()); | |||||
| ttvo.setName(tt.getName()); | |||||
| ttvo.setFlag(tt.getFlag()); | |||||
| ttvo.setGroupId(tg.getId()); | |||||
| ttvo.setGroupName(tg.getName()); | |||||
| WxTags t = new WxTags(); | |||||
| t.setTypeId(tt.getId()); | |||||
| ttvo.setTags(wxTagsService.findList(t)); | |||||
| typeVos.add(ttvo); | |||||
| } | |||||
| tgvo.setTypes(typeVos); | |||||
| groupVos.add(tgvo); | |||||
| } | |||||
| return new ResultData(groupVos); | |||||
| return new ResultData(wxTagsService.listAllVo()); | |||||
| } | } | ||||
| @ApiOperation("查询微信用户人群") | @ApiOperation("查询微信用户人群") | ||||
| @@ -134,7 +134,7 @@ public class WxUserStructureController extends BaseController { | |||||
| WxLevelConfig other = new WxLevelConfig(); | WxLevelConfig other = new WxLevelConfig(); | ||||
| //没有等级的会员 | //没有等级的会员 | ||||
| other.setLevel("无"); | |||||
| other.setLevel("普通会员"); | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | ||||
| other.setCount(wxCUserBasicInfoService.findCount(dto) | other.setCount(wxCUserBasicInfoService.findCount(dto) | ||||
| - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); | - levelList.stream().map(WxLevelConfig::getCount).reduce(Long::sum).orElse(0L)); | ||||
| @@ -2,6 +2,7 @@ package com.iformall.domain.dto; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| @@ -45,12 +46,16 @@ public class WxCUserBasicInfoDto implements Serializable{ | |||||
| @Transient | @Transient | ||||
| private Integer levelStartScore; | private Integer levelStartScore; | ||||
| @Transient | @Transient | ||||
| private Integer levelEndScore; | private Integer levelEndScore; | ||||
| @Transient | @Transient | ||||
| private Integer sex; | private Integer sex; | ||||
| @Transient | |||||
| List<Long> tagIds; | |||||
| public Long getId() { | public Long getId() { | ||||
| return id; | return id; | ||||
| } | } | ||||
| @@ -140,5 +145,12 @@ public class WxCUserBasicInfoDto implements Serializable{ | |||||
| public void setLevelStartScore(Integer levelStartScore) { | public void setLevelStartScore(Integer levelStartScore) { | ||||
| this.levelStartScore = levelStartScore; | this.levelStartScore = levelStartScore; | ||||
| } | } | ||||
| public List<Long> getTagIds() { | |||||
| return tagIds; | |||||
| } | |||||
| public void setTagIds(List<Long> tagIds) { | |||||
| this.tagIds = tagIds; | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,39 @@ | |||||
| package com.iformall.domain.dto; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| /** | |||||
| * 用户查询dto | |||||
| * @author jinguo | |||||
| * | |||||
| */ | |||||
| public class WxCUserBasicInfoFilterDto implements Serializable{ | |||||
| /** | |||||
| * | |||||
| */ | |||||
| private static final long serialVersionUID = -1116465873573690766L; | |||||
| Long typeId; | |||||
| Long id; | |||||
| public Long getTypeId() { | |||||
| return typeId; | |||||
| } | |||||
| public void setTypeId(Long typeId) { | |||||
| this.typeId = typeId; | |||||
| } | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| } | |||||
| @@ -54,11 +54,11 @@ public class WxTags implements Serializable { | |||||
| @Transient | @Transient | ||||
| protected long count; | |||||
| public long getCount() { | |||||
| protected Long count; | |||||
| public Long getCount() { | |||||
| return count; | return count; | ||||
| } | } | ||||
| public void setCount(long count) { | |||||
| public void setCount(Long count) { | |||||
| this.count = count; | this.count = count; | ||||
| } | } | ||||
| @@ -175,6 +175,17 @@ public enum EnumTag { | |||||
| ID_142(142L, EnumTagType.ID_17,"面包店"), | ID_142(142L, EnumTagType.ID_17,"面包店"), | ||||
| ID_143(143L, EnumTagType.ID_17,"咖啡厅"), | ID_143(143L, EnumTagType.ID_17,"咖啡厅"), | ||||
| ID_144(144L, EnumTagType.ID_17,"饮品店"), | ID_144(144L, EnumTagType.ID_17,"饮品店"), | ||||
| ID_1000(1000L, EnumTagType.ID_50,"一天以内"), | |||||
| ID_1001(1001L, EnumTagType.ID_50,"一周以内"), | |||||
| ID_1002(1002L, EnumTagType.ID_50,"一月以内"), | |||||
| ID_1003(1003L, EnumTagType.ID_50,"一季度以内"), | |||||
| ID_1004(1004L, EnumTagType.ID_50,"一年以内"), | |||||
| ID_1005(1005L, EnumTagType.ID_50,"五年以内"), | |||||
| ID_1006(1006L, EnumTagType.ID_50,"五年以上"), | |||||
| ; | ; | ||||
| @@ -10,6 +10,7 @@ public enum EnumTagGroup { | |||||
| ID_3(3L, "消费偏好"), | ID_3(3L, "消费偏好"), | ||||
| ID_4(4L, "行为偏好"), | ID_4(4L, "行为偏好"), | ||||
| ID_10(10L, "会员属性"), | |||||
| ; | ; | ||||
| public static EnumTagGroup getEnum(Long code) { | public static EnumTagGroup getEnum(Long code) { | ||||
| @@ -31,6 +31,11 @@ public enum EnumTagType { | |||||
| ID_24(24L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_4, "会员性格"), | ID_24(24L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_4, "会员性格"), | ||||
| ID_25(25L, EnumTagTypeFlag.FLAG_NORMAL, EnumTagGroup.ID_4, "爱好"), | ID_25(25L, EnumTagTypeFlag.FLAG_NORMAL, EnumTagGroup.ID_4, "爱好"), | ||||
| ID_26(26L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_4, "生活半径"), | ID_26(26L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_4, "生活半径"), | ||||
| ID_50(50L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员会龄"), | |||||
| ID_51(51L, EnumTagTypeFlag.FLAG_SINGLE, EnumTagGroup.ID_10, "会员等级"), | |||||
| ; | ; | ||||
| public static EnumTagType getEnum(Long code) { | public static EnumTagType getEnum(Long code) { | ||||
| @@ -10,6 +10,10 @@ import java.util.List; | |||||
| public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | public interface WxCUserBasicInfoMapper extends CommonMapper<WxCUserBasicInfo, String> { | ||||
| long findCountByFilter(WxCUserBasicInfoDto dto); | |||||
| List<WxCUserBasicInfo> findListByFilter(WxCUserBasicInfoDto dto); | |||||
| List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | List<WxCUserBasicInfo> findList(WxCUserBasicInfo wxCUserBasicInfo); | ||||
| void updateScore(WxCUserBasicInfo record); | void updateScore(WxCUserBasicInfo record); | ||||
| @@ -10,5 +10,4 @@ public interface WxTagsMapper extends CommonMapper<WxTags, String> { | |||||
| List<WxTags> findList(WxTags wxTags); | List<WxTags> findList(WxTags wxTags); | ||||
| List<WxTags> findListAll(); | List<WxTags> findListAll(); | ||||
| List<WxTags> getByName(String name); | |||||
| } | } | ||||
| @@ -7,12 +7,20 @@ import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCarPayRecord; | import com.iformall.domain.po.WxCarPayRecord; | ||||
| import com.iformall.domain.po.WxTags; | import com.iformall.domain.po.WxTags; | ||||
| import com.iformall.domain.vo.CUserBaseInfoT; | import com.iformall.domain.vo.CUserBaseInfoT; | ||||
| import com.iformall.domain.vo.WxTagsGroupVo; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | import java.util.List; | ||||
| public interface WxCUserBasicInfoService { | public interface WxCUserBasicInfoService { | ||||
| /** | |||||
| * 根据租户ID获取会员过滤器列表 | |||||
| * | |||||
| * @return | |||||
| */ | |||||
| List<WxTagsGroupVo> listFilters(String tenentId); | |||||
| /** | /** | ||||
| * 根据实体查询分页列表 | * 根据实体查询分页列表 | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxTags; | import com.iformall.domain.po.WxTags; | ||||
| import com.iformall.domain.vo.WxTagsGroupVo; | |||||
| public interface WxTagsService { | public interface WxTagsService { | ||||
| @@ -39,5 +40,7 @@ public interface WxTagsService { | |||||
| void deleteById(Long id); | void deleteById(Long id); | ||||
| List<WxTags> findList(WxTags wxTags); | List<WxTags> findList(WxTags wxTags); | ||||
| List<WxTagsGroupVo> listAllVo(); | |||||
| } | } | ||||
| @@ -6,17 +6,17 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.domain.dto.WxCUserBasicInfoDto; | import com.iformall.domain.dto.WxCUserBasicInfoDto; | ||||
| import com.iformall.domain.dto.WxCUserBasicInfoFilterDto; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.CUserBaseInfoT; | |||||
| import com.iformall.domain.vo.CUserBaseVo; | |||||
| import com.iformall.domain.vo.CUserTagVo; | |||||
| import com.iformall.domain.vo.WxCUserBasicInfoVo; | |||||
| import com.iformall.enums.EnumScoreType; | |||||
| import com.iformall.domain.vo.*; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.enums.EnumUserType; | |||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -25,8 +25,11 @@ import org.springframework.stereotype.Service; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.text.ParseException; | import java.text.ParseException; | ||||
| import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
| import java.time.LocalDateTime; | |||||
| import java.time.ZoneId; | |||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.concurrent.TimeUnit; | import java.util.concurrent.TimeUnit; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -59,13 +62,196 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { | |||||
| @Autowired | @Autowired | ||||
| WxCarPayRecordMapper wxCarPayRecordMapper; | WxCarPayRecordMapper wxCarPayRecordMapper; | ||||
| @Autowired | @Autowired | ||||
| ExcelService excelService; | ExcelService excelService; | ||||
| @Autowired | @Autowired | ||||
| WxCreditHistoryService wxCreditHistoryService; | WxCreditHistoryService wxCreditHistoryService; | ||||
| @Autowired | |||||
| WxLevelConfigService wxLevelConfigService; | |||||
| @Autowired | |||||
| WxTagsService wxTagsService; | |||||
| private final static List<WxTags> memberTimeList = new ArrayList<WxTags>( | |||||
| Arrays.asList( | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1000.getMessage()); | |||||
| setId(EnumTag.ID_1000.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1001.getMessage()); | |||||
| setId(EnumTag.ID_1001.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1002.getMessage()); | |||||
| setId(EnumTag.ID_1002.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1003.getMessage()); | |||||
| setId(EnumTag.ID_1003.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1004.getMessage()); | |||||
| setId(EnumTag.ID_1004.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1005.getMessage()); | |||||
| setId(EnumTag.ID_1005.getCode()); | |||||
| }}, | |||||
| new WxTags(){{ | |||||
| setName(EnumTag.ID_1006.getMessage()); | |||||
| setId(EnumTag.ID_1006.getCode()); | |||||
| }} | |||||
| ) | |||||
| ); | |||||
| private final static String RANGE_START = "rangeStart"; | |||||
| private final static String RANGE_END = "rangeEnd"; | |||||
| private final static Map<Long,Map<String,Long>> memberTimeMap | |||||
| = new HashMap<Long,Map<String,Long>>() { | |||||
| { | |||||
| put(EnumTag.ID_1000.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,0L); | |||||
| put(RANGE_END,1L); | |||||
| }}); | |||||
| put(EnumTag.ID_1001.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,1L); | |||||
| put(RANGE_END,7L); | |||||
| }}); | |||||
| put(EnumTag.ID_1002.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,7L); | |||||
| put(RANGE_END,30L); | |||||
| }}); | |||||
| put(EnumTag.ID_1003.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,30L); | |||||
| put(RANGE_END,90L); | |||||
| }}); | |||||
| put(EnumTag.ID_1004.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,90L); | |||||
| put(RANGE_END,365L); | |||||
| }}); | |||||
| put(EnumTag.ID_1005.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,365L); | |||||
| put(RANGE_END,365*5L); | |||||
| }}); | |||||
| put(EnumTag.ID_1006.getCode(), | |||||
| new HashMap<String,Long>(){{ | |||||
| put(RANGE_START,365*5L); | |||||
| }}); | |||||
| } | |||||
| }; | |||||
| private WxCUserBasicInfoDto filtersToDto(String tenentId, List<WxCUserBasicInfoFilterDto> filterList){ | |||||
| WxCUserBasicInfoDto dto = new WxCUserBasicInfoDto(); | |||||
| dto.setTagIds(new ArrayList<>()); | |||||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantId(tenentId); | |||||
| filterList.stream().forEach(f->{ | |||||
| switch(EnumTagType.getEnum(f.getTypeId())) { | |||||
| case ID_50: | |||||
| ZoneId zone = ZoneId.systemDefault(); | |||||
| Long rangeStart = memberTimeMap.get(f.getId()).get(RANGE_START); | |||||
| Long rangeEnd = memberTimeMap.get(f.getId()).get(RANGE_END); | |||||
| if (rangeEnd != null){ | |||||
| LocalDateTime localDateTimeStart = LocalDateTime.now().minusDays(rangeEnd); | |||||
| dto.setStartTime(Date.from(localDateTimeStart.atZone(zone).toInstant())); | |||||
| } | |||||
| if (rangeStart != null) { | |||||
| LocalDateTime localDateTimeEnd = LocalDateTime.now().minusDays(rangeStart); | |||||
| dto.setEndTime(Date.from(localDateTimeEnd.atZone(zone).toInstant())); | |||||
| } | |||||
| break; | |||||
| case ID_51: | |||||
| for (int i=0;i<levels.size();i++) | |||||
| { | |||||
| WxLevelConfig l = levels.get(i); | |||||
| if (f.getId().equals(0L)) | |||||
| dto.setLevelStartScore(0); | |||||
| else | |||||
| dto.setLevelStartScore(l.getPoints()); | |||||
| if (i + 1<levels.size()) | |||||
| dto.setLevelEndScore(levels.get(i+1).getPoints()); | |||||
| else | |||||
| dto.setLevelEndScore(null); | |||||
| } | |||||
| break; | |||||
| default: | |||||
| dto.getTagIds().add(f.getId()); | |||||
| } | |||||
| }); | |||||
| return dto; | |||||
| } | |||||
| public long countByFilter(String tenantId, List<WxCUserBasicInfoFilterDto> filterList) { | |||||
| return wxCUserBasicInfoMapper.findCountByFilter(filtersToDto(tenantId,filterList)); | |||||
| } | |||||
| public List<WxCUserBasicInfo> listByFilter(String tenantId, List<WxCUserBasicInfoFilterDto> filterList) { | |||||
| return wxCUserBasicInfoMapper.findListByFilter(filtersToDto(tenantId,filterList)); | |||||
| } | |||||
| public List<WxTagsGroupVo> listFilters(String tenentId) { | |||||
| WxTagsGroupVo filter = new WxTagsGroupVo(); | |||||
| filter.setId(EnumTagGroup.ID_10.getCode()); | |||||
| filter.setName(EnumTagGroup.ID_10.getMessage()); | |||||
| List<WxTagsTypeVo> types = new ArrayList<>(); | |||||
| WxTagsTypeVo typeMemberTime = new WxTagsTypeVo(); | |||||
| typeMemberTime.setFlag(EnumTagTypeFlag.FLAG_SINGLE.getCode()); | |||||
| typeMemberTime.setName(EnumTagType.ID_50.getMessage()); | |||||
| typeMemberTime.setId(EnumTagType.ID_50.getCode()); | |||||
| typeMemberTime.setTags(memberTimeList); | |||||
| types.add(typeMemberTime); | |||||
| WxTagsTypeVo typeMemberLevel = new WxTagsTypeVo(); | |||||
| typeMemberLevel.setFlag(EnumTagTypeFlag.FLAG_SINGLE.getCode()); | |||||
| typeMemberLevel.setName(EnumTagType.ID_51.getMessage()); | |||||
| typeMemberLevel.setId(EnumTagType.ID_51.getCode()); | |||||
| List<WxTags> tagsMemberLevel = new ArrayList<>(); | |||||
| List<WxLevelConfig> levels = wxLevelConfigService.getByTenantId(tenentId); | |||||
| WxTags wxTagsBase = new WxTags(); | |||||
| wxTagsBase.setName("普通会员"); | |||||
| wxTagsBase.setId(0L); | |||||
| tagsMemberLevel.add(wxTagsBase); | |||||
| levels.stream().forEach(l->{ | |||||
| WxTags wxTags = new WxTags(); | |||||
| wxTags.setName(l.getLevel()); | |||||
| wxTags.setId(l.getId()); | |||||
| tagsMemberLevel.add(wxTags); | |||||
| }); | |||||
| typeMemberLevel.setTags(tagsMemberLevel); | |||||
| types.add(typeMemberLevel); | |||||
| filter.setTypes(types); | |||||
| List<WxTagsGroupVo> listVo =wxTagsService.listAllVo(); | |||||
| listVo.add(0,filter); | |||||
| return listVo; | |||||
| } | |||||
| @Override | @Override | ||||
| public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxCUserBasicInfo> listAsPage(WxCUserBasicInfo record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -164,7 +164,6 @@ public class WxLevelConfigServiceImpl implements WxLevelConfigService { | |||||
| return jo.getLong(CAPABILITY_SEND_CAR_COUPON); | return jo.getLong(CAPABILITY_SEND_CAR_COUPON); | ||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | public void deleteById(Long id) { | ||||
| wxLevelConfigMapper.deleteByPrimaryKey(id); | wxLevelConfigMapper.deleteByPrimaryKey(id); | ||||
| @@ -4,8 +4,14 @@ import java.util.*; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxTags; | import com.iformall.domain.po.WxTags; | ||||
| import com.iformall.domain.po.WxTagsGroup; | |||||
| import com.iformall.domain.po.WxTagsType; | |||||
| import com.iformall.domain.vo.WxTagsGroupVo; | |||||
| import com.iformall.domain.vo.WxTagsTypeVo; | |||||
| import com.iformall.mapper.WxTagsMapper; | import com.iformall.mapper.WxTagsMapper; | ||||
| import com.iformall.service.WxTagsGroupService; | |||||
| import com.iformall.service.WxTagsService; | import com.iformall.service.WxTagsService; | ||||
| import com.iformall.service.WxTagsTypeService; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -19,6 +25,12 @@ public class WxTagsServiceImpl implements WxTagsService { | |||||
| @Autowired | @Autowired | ||||
| WxTagsMapper wxTagsMapper; | WxTagsMapper wxTagsMapper; | ||||
| @Autowired | |||||
| private WxTagsTypeService wxTagsTypeService; | |||||
| @Autowired | |||||
| private WxTagsGroupService wxTagsGroupService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxTags> listAsPage(WxTags record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxTags> listAsPage(WxTags record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -51,4 +63,35 @@ public class WxTagsServiceImpl implements WxTagsService { | |||||
| public List<WxTags> findList(WxTags wxTags) { | public List<WxTags> findList(WxTags wxTags) { | ||||
| return wxTagsMapper.findList(wxTags); | return wxTagsMapper.findList(wxTags); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxTagsGroupVo> listAllVo() { | |||||
| List<WxTagsGroupVo> groupVos = new ArrayList<>(); | |||||
| List<WxTagsGroup> groups = wxTagsGroupService.findList(null); | |||||
| for (WxTagsGroup tg : groups) { | |||||
| WxTagsGroupVo tgvo = new WxTagsGroupVo(); | |||||
| tgvo.setId(tg.getId()); | |||||
| tgvo.setName(tg.getName()); | |||||
| WxTagsType type = new WxTagsType(); | |||||
| type.setGroupId(tg.getId()); | |||||
| List<WxTagsTypeVo> typeVos = new ArrayList<>(); | |||||
| List<WxTagsType> types = wxTagsTypeService.findList(type); | |||||
| for (WxTagsType tt : types) { | |||||
| WxTagsTypeVo ttvo = new WxTagsTypeVo(); | |||||
| ttvo.setId(tt.getId()); | |||||
| ttvo.setName(tt.getName()); | |||||
| ttvo.setFlag(tt.getFlag()); | |||||
| WxTags t = new WxTags(); | |||||
| t.setTypeId(tt.getId()); | |||||
| ttvo.setTags(findList(t)); | |||||
| typeVos.add(ttvo); | |||||
| } | |||||
| tgvo.setTypes(typeVos); | |||||
| groupVos.add(tgvo); | |||||
| } | |||||
| return groupVos; | |||||
| } | |||||
| } | } | ||||
| @@ -337,4 +337,57 @@ | |||||
| <include refid="dynamicVoWhereConditions"/> | <include refid="dynamicVoWhereConditions"/> | ||||
| </select> | </select> | ||||
| <sql id="filterWhereConditions"> | |||||
| where 1=1 | |||||
| <if test="null != tenantId"> | |||||
| and tenant_id =#{tenantId} | |||||
| </if> | |||||
| <if test=" null != startTime "> | |||||
| and create_date >= #{startTime} | |||||
| </if> | |||||
| <if test=" null != endTime"> | |||||
| and create_date <= #{endTime} | |||||
| </if> | |||||
| <if test=" null != levelStartScore and (0 != levelStartScore and '' != levelStartScore"> | |||||
| and poins >= #{levelStartScore} | |||||
| <if test=" null != levelEndScore"> | |||||
| and poins < #{levelEndScore} | |||||
| </if> | |||||
| </if> | |||||
| <if test=" null != levelStartScore and (0 == levelStartScore or '' == levelStartScore"> | |||||
| and (poins is null or | |||||
| (poins >= #{levelStartScore} | |||||
| <if test=" null != levelEndScore"> | |||||
| and poins < #{levelEndScore} | |||||
| </if> | |||||
| )) | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| <foreach collection="tagIds" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| and #{idItem} in cut.tags | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findCountByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultType="java.lang.Long"> | |||||
| select count(id) from wx_c_user_basic_info | |||||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||||
| <include refid="filterWhereConditions"/> | |||||
| </select> | |||||
| <select id="findListByFilter" parameterType="com.iformall.domain.dto.WxCUserBasicInfoDto" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> | |||||
| from wx_c_user_basic_info | |||||
| join wx_c_user_tags cut on cut.`id` = cu.`tag_id` | |||||
| <include refid="filterWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||
| @@ -14,6 +14,10 @@ | |||||
| `id`,`name`,`group_id`,`group_name`,`type_id`,`type_name` | `id`,`name`,`group_id`,`group_name`,`type_id`,`type_name` | ||||
| </sql> | </sql> | ||||
| <sql id="allColumnsVo"> | |||||
| `id`,`name` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| where 1 = 1 | where 1 = 1 | ||||
| @@ -52,7 +56,7 @@ | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxTags" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxTags" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | |||||
| <include refid="allColumnsVo"/> | |||||
| from wx_tags | from wx_tags | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| @@ -65,6 +69,8 @@ | |||||
| </if> | </if> | ||||
| </select> | </select> | ||||
| <select id="findListAll" resultMap="BaseResultMap"> | <select id="findListAll" resultMap="BaseResultMap"> | ||||
| select id,name from wx_tags | |||||
| select | |||||
| <include refid="allColumnsVo"/> | |||||
| from wx_tags | |||||
| </select> | </select> | ||||
| </mapper> | </mapper> | ||||