Commit 5588019f39bb1d28e95a25782759dc89c72e6643

Authored by 张志伟
1 parent 766f1865

:bug: 保有客保持率抽取bug修复

fw-valhalla-common/src/main/java/cn/fw/valhalla/common/utils/DateUtil.java
... ... @@ -304,6 +304,20 @@ public final class DateUtil {
304 304 }
305 305  
306 306 /**
  307 + * 获取时间字符串
  308 + *
  309 + * @param date 需要转换格式的日期
  310 + * @return 返回短时间字符串格式 yyyy-MM-dd HH:mm:ss
  311 + */
  312 + public static String getMonthString(Date date) {
  313 + if (date == null) {
  314 + return "";
  315 + }
  316 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
  317 + return format.format(date);
  318 + }
  319 +
  320 + /**
307 321 * 获取下月月初时间
308 322 */
309 323 public static Date getNextMonthStartTime() {
... ...
fw-valhalla-service/src/main/java/cn/fw/valhalla/service/bus/CustomerRetentionRatioBizService.java
... ... @@ -74,12 +74,12 @@ public class CustomerRetentionRatioBizService {
74 74  
75 75 private void extractingPerson(ShopInfo shop, Date nowDate) {
76 76 Timestamp preMonthDay = DateUtil.getExpiredMonth(nowDate, -1);
77   - String dateString = DateUtil.getFullDateString(preMonthDay);
78 77 List<StammkundePool> pools = Optional.ofNullable(stammkundePoolService.list(Wrappers.<StammkundePool>query()
79   - .select("DISTINCT adviser_id", "adviser_name")
80   - .eq("pool_status", 1)
81   - .eq("DATE_FORMAT(activation_time, '%Y-%m')", "DATE_FORMAT('" + dateString + "', '%Y-%m')")
82   - .eq("shop_id", shop.getId()))
  78 + .select("DISTINCT adviser_id", "adviser_name")
  79 + .eq("pool_status", 1)
  80 + .eq("shop_id", shop.getId())
  81 + .apply("DATE_FORMAT(activation_time, '%Y-%m') = {0}", DateUtil.getMonthString(preMonthDay))
  82 + )
83 83 ).orElse(new ArrayList<>());
84 84 List<PostUserDTO> userDTOS = Optional.ofNullable(userService.getUserByRole(shop.getId(), RoleCode.FWGW)).orElse(new ArrayList<>());
85 85 Set<UserInfo> set = new HashSet<>();
... ...