Commit 652ffd0e1409ad09662d71e194a8721b2d69196e

Authored by 张志伟
1 parent 88796c92

:bug: feature(*): 修复bug

- 修复bug
fw-valhalla-dao/src/main/resources/mapper/PubCluePoolMapper.xml
@@ -42,9 +42,6 @@ @@ -42,9 +42,6 @@
42 <if test="condition.userId !=null"> 42 <if test="condition.userId !=null">
43 and t1.follow_user = #{condition.userId} 43 and t1.follow_user = #{condition.userId}
44 </if> 44 </if>
45 - <if test="condition.source != null">  
46 - and t6.source_type = #{condition.source}  
47 - </if>  
48 <if test="condition.userName !=null and condition.userName != ''"> 45 <if test="condition.userName !=null and condition.userName != ''">
49 and t1.follow_user_name like concat('%',#{condition.userName},'%') 46 and t1.follow_user_name like concat('%',#{condition.userName},'%')
50 </if> 47 </if>
@@ -55,7 +52,12 @@ @@ -55,7 +52,12 @@
55 <if test="condition.frameNo != null and condition.frameNo !='' "> 52 <if test="condition.frameNo != null and condition.frameNo !='' ">
56 and t6.vin like concat('%', #{condition.frameNo}, '%') 53 and t6.vin like concat('%', #{condition.frameNo}, '%')
57 </if> 54 </if>
58 - 55 + <if test="condition.source !=null">
  56 + and t6.source_type in
  57 + <foreach collection="condition.source" item="id" index="index" open="(" close=")" separator=",">
  58 + #{id}
  59 + </foreach>
  60 + </if>
59 <if test="condition.shopIds !=null"> 61 <if test="condition.shopIds !=null">
60 and t1.follow_shop in 62 and t1.follow_shop in
61 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=","> 63 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
@@ -122,9 +124,6 @@ @@ -122,9 +124,6 @@
122 <if test="condition.userId !=null"> 124 <if test="condition.userId !=null">
123 and t1.follow_user = #{condition.userId} 125 and t1.follow_user = #{condition.userId}
124 </if> 126 </if>
125 - <if test="condition.source != null">  
126 - and t6.source_type = #{condition.source}  
127 - </if>  
128 <if test="condition.userName !=null and condition.userName != ''"> 127 <if test="condition.userName !=null and condition.userName != ''">
129 and t1.follow_user_name like concat('%',#{condition.userName},'%') 128 and t1.follow_user_name like concat('%',#{condition.userName},'%')
130 </if> 129 </if>
@@ -135,7 +134,12 @@ @@ -135,7 +134,12 @@
135 <if test="condition.frameNo != null and condition.frameNo !='' "> 134 <if test="condition.frameNo != null and condition.frameNo !='' ">
136 and t6.vin like concat('%', #{condition.frameNo}, '%') 135 and t6.vin like concat('%', #{condition.frameNo}, '%')
137 </if> 136 </if>
138 - 137 + <if test="condition.source !=null">
  138 + and t6.source_type in
  139 + <foreach collection="condition.source" item="id" index="index" open="(" close=")" separator=",">
  140 + #{id}
  141 + </foreach>
  142 + </if>
139 <if test="condition.shopIds !=null"> 143 <if test="condition.shopIds !=null">
140 and t1.follow_shop in 144 and t1.follow_shop in
141 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=","> 145 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
fw-valhalla-dao/src/main/resources/mapper/PublicPoolMapper.xml
@@ -51,6 +51,12 @@ @@ -51,6 +51,12 @@
51 <if test="condition.type !=null"> 51 <if test="condition.type !=null">
52 and t1.type = #{condition.type} 52 and t1.type = #{condition.type}
53 </if> 53 </if>
  54 + <if test="condition.createTime1 !=null">
  55 + and t1.create_time >= #{condition.createTime1}
  56 + </if>
  57 + <if test="condition.createTime2 !=null">
  58 + and t1.create_time &lt;= #{condition.createTime2}
  59 + </if>
54 <if test="condition.shopIds !=null"> 60 <if test="condition.shopIds !=null">
55 and t1.shop_id in 61 and t1.shop_id in
56 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=","> 62 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
@@ -120,6 +126,12 @@ @@ -120,6 +126,12 @@
120 <if test="condition.type !=null"> 126 <if test="condition.type !=null">
121 and t1.type = #{condition.type} 127 and t1.type = #{condition.type}
122 </if> 128 </if>
  129 + <if test="condition.createTime1 !=null">
  130 + and t1.create_time >= #{condition.createTime1}
  131 + </if>
  132 + <if test="condition.createTime2 !=null">
  133 + and t1.create_time &lt;= #{condition.createTime2}
  134 + </if>
123 <if test="condition.shopIds !=null"> 135 <if test="condition.shopIds !=null">
124 and t1.shop_id in 136 and t1.shop_id in
125 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=","> 137 <foreach collection="condition.shopIds" item="id" index="index" open="(" close=")" separator=",">
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/query/FollowPoolQueryVO.java
@@ -51,7 +51,7 @@ public class FollowPoolQueryVO extends PoolQuery { @@ -51,7 +51,7 @@ public class FollowPoolQueryVO extends PoolQuery {
51 /** 51 /**
52 * 来源[公共池线索用] 52 * 来源[公共池线索用]
53 */ 53 */
54 - private Integer source; 54 + private String source;
55 private String closeTime; 55 private String closeTime;
56 56
57 public Integer getLoanCustomer() { 57 public Integer getLoanCustomer() {
@@ -129,4 +129,12 @@ public class FollowPoolQueryVO extends PoolQuery { @@ -129,4 +129,12 @@ public class FollowPoolQueryVO extends PoolQuery {
129 List<Integer> stateList = Stream.of(state.split(",")).filter(cn.fw.valhalla.common.utils.StringUtils::isNumber).map(Integer::valueOf).collect(Collectors.toList()); 129 List<Integer> stateList = Stream.of(state.split(",")).filter(cn.fw.valhalla.common.utils.StringUtils::isNumber).map(Integer::valueOf).collect(Collectors.toList());
130 return CollectionUtils.isEmpty(stateList) ? null : stateList; 130 return CollectionUtils.isEmpty(stateList) ? null : stateList;
131 } 131 }
  132 +
  133 + public List<Integer> getSource() {
  134 + if (StringUtils.isBlank(source)) {
  135 + return null;
  136 + }
  137 + List<Integer> sourceList = Stream.of(source.split(",")).filter(cn.fw.valhalla.common.utils.StringUtils::isNumber).map(Integer::valueOf).collect(Collectors.toList());
  138 + return CollectionUtils.isEmpty(sourceList) ? null : sourceList;
  139 + }
132 } 140 }
133 \ No newline at end of file 141 \ No newline at end of file
fw-valhalla-domain/src/main/java/cn/fw/valhalla/domain/query/PublicPoolQueryVO.java
1 package cn.fw.valhalla.domain.query; 1 package cn.fw.valhalla.domain.query;
2 2
  3 +import cn.fw.valhalla.common.utils.DateUtil;
3 import lombok.Data; 4 import lombok.Data;
4 import lombok.EqualsAndHashCode; 5 import lombok.EqualsAndHashCode;
5 import lombok.ToString; 6 import lombok.ToString;
  7 +import org.apache.commons.lang3.StringUtils;
  8 +import org.apache.commons.lang3.math.NumberUtils;
6 9
7 -import java.util.Collections; 10 +import java.time.Instant;
  11 +import java.time.LocalDateTime;
  12 +import java.time.ZoneId;
  13 +import java.util.Date;
8 import java.util.List; 14 import java.util.List;
9 15
10 /** 16 /**
@@ -25,4 +31,33 @@ public class PublicPoolQueryVO extends PoolQuery { @@ -25,4 +31,33 @@ public class PublicPoolQueryVO extends PoolQuery {
25 private Boolean warrantyCard; 31 private Boolean warrantyCard;
26 private Boolean maintainCard; 32 private Boolean maintainCard;
27 private List<Long> ignoreCustIds; 33 private List<Long> ignoreCustIds;
  34 + private String createTime;
  35 + private Boolean fromReport;
  36 +
  37 + public Date getCreateTime1() {
  38 + if (StringUtils.isBlank(createTime)) {
  39 + return null;
  40 + }
  41 + String[] times = createTime.split(",");
  42 + if (StringUtils.isNotBlank(times[0]) && NumberUtils.isDigits(times[0])) {
  43 + LocalDateTime localDateTime = Instant.ofEpochMilli(NumberUtils.toLong(times[0])).atZone(ZoneId.systemDefault()).toLocalDateTime();
  44 + return DateUtil.getBeginInTime(DateUtil.localDateTime2Date(localDateTime));
  45 + }
  46 + return null;
  47 + }
  48 +
  49 + public Date getCreateTime2() {
  50 + if (StringUtils.isBlank(createTime)) {
  51 + return null;
  52 + }
  53 + String[] times = createTime.split(",");
  54 + if (times.length < TIME_STR_LENGTH) {
  55 + return null;
  56 + }
  57 + if (StringUtils.isNotBlank(times[1]) && NumberUtils.isDigits(times[1])) {
  58 + LocalDateTime localDateTime = Instant.ofEpochMilli(NumberUtils.toLong(times[1])).atZone(ZoneId.systemDefault()).toLocalDateTime();
  59 + return DateUtil.getEndInTime(DateUtil.localDateTime2Date(localDateTime));
  60 + }
  61 + return null;
  62 + }
28 } 63 }
fw-valhalla-server/src/main/java/cn/fw/valhalla/controller/app/PoolController.java
@@ -91,7 +91,11 @@ public class PoolController { @@ -91,7 +91,11 @@ public class PoolController {
91 return success(poolBizService.summary(queryVO)); 91 return success(poolBizService.summary(queryVO));
92 } 92 }
93 93
94 - 94 + /**
  95 + * @param queryVO
  96 + * @return
  97 + * @description
  98 + */
95 @GetMapping("/public/clue/own/list") 99 @GetMapping("/public/clue/own/list")
96 @ControllerMethod("查询自己的公共客户池列表") 100 @ControllerMethod("查询自己的公共客户池列表")
97 public Message<AppPage<PublicCluePoolVO>> ownPublicClueList(@CurrentUser LoginAuthBean currentUser, final PublicCluePoolQueryVO queryVO) { 101 public Message<AppPage<PublicCluePoolVO>> ownPublicClueList(@CurrentUser LoginAuthBean currentUser, final PublicCluePoolQueryVO queryVO) {
@@ -99,6 +103,11 @@ public class PoolController { @@ -99,6 +103,11 @@ public class PoolController {
99 return success(page); 103 return success(page);
100 } 104 }
101 105
  106 + /**
  107 + * @param queryVO
  108 + * @return
  109 + * @description
  110 + */
102 @GetMapping("/public/clue/list") 111 @GetMapping("/public/clue/list")
103 @IgnoreAuth 112 @IgnoreAuth
104 @ControllerMethod("查询公共客户池列表") 113 @ControllerMethod("查询公共客户池列表")
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/follow/PoolBizService.java
@@ -93,14 +93,16 @@ public class PoolBizService { @@ -93,14 +93,16 @@ public class PoolBizService {
93 * @return 93 * @return
94 */ 94 */
95 public AppPage<PublicPoolVO> publicList(LoginAuthBean currentUser, PublicPoolQueryVO queryVO) { 95 public AppPage<PublicPoolVO> publicList(LoginAuthBean currentUser, PublicPoolQueryVO queryVO) {
96 - List<AffiliationRecord> affiliationRecordList = Optional.ofNullable(affiliationRecordService.list(Wrappers.<AffiliationRecord>lambdaQuery()  
97 - .eq(AffiliationRecord::getType, CustomerChangeTypeEnum.DEFEAT)  
98 - .eq(AffiliationRecord::getOriginUserId, currentUser.getUserId())  
99 - .ge(AffiliationRecord::getDefeatTime, DateUtil.getNowExpiredMonth(-6))  
100 - )).orElse(new ArrayList<>());  
101 - List<Long> custIds = affiliationRecordList.stream().map(AffiliationRecord::getCustomerId).distinct().collect(Collectors.toList());  
102 - if (custIds.size() > 0) {  
103 - queryVO.setIgnoreCustIds(custIds); 96 + if (!Boolean.TRUE.equals(queryVO.getFromReport())) {
  97 + List<AffiliationRecord> affiliationRecordList = Optional.ofNullable(affiliationRecordService.list(Wrappers.<AffiliationRecord>lambdaQuery()
  98 + .eq(AffiliationRecord::getType, CustomerChangeTypeEnum.DEFEAT)
  99 + .eq(AffiliationRecord::getOriginUserId, currentUser.getUserId())
  100 + .ge(AffiliationRecord::getDefeatTime, DateUtil.getNowExpiredMonth(-6))
  101 + )).orElse(new ArrayList<>());
  102 + List<Long> custIds = affiliationRecordList.stream().map(AffiliationRecord::getCustomerId).distinct().collect(Collectors.toList());
  103 + if (custIds.size() > 0) {
  104 + queryVO.setIgnoreCustIds(custIds);
  105 + }
104 } 106 }
105 107
106 AppPageVO<PublicPoolVO> page = AppPageVO.init(queryVO); 108 AppPageVO<PublicPoolVO> page = AppPageVO.init(queryVO);
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/data/impl/PublicPoolServiceImpl.java
@@ -86,7 +86,6 @@ public class PublicPoolServiceImpl extends ServiceImpl&lt;PublicPoolMapper, PublicP @@ -86,7 +86,6 @@ public class PublicPoolServiceImpl extends ServiceImpl&lt;PublicPoolMapper, PublicP
86 if (CollectionUtils.isEmpty(shopIds)) { 86 if (CollectionUtils.isEmpty(shopIds)) {
87 return Collections.emptyList(); 87 return Collections.emptyList();
88 } 88 }
89 - // mybatis plus 性能有问题 不使用  
90 return Optional.ofNullable(this.getBaseMapper().queryIdListByShops(shopIds)).orElse(Collections.emptyList()); 89 return Optional.ofNullable(this.getBaseMapper().queryIdListByShops(shopIds)).orElse(Collections.emptyList());
91 } 90 }
92 91