diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteCustomerApplyLogService.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteCustomerApplyLogService.java new file mode 100644 index 00000000..ed2830f2 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteCustomerApplyLogService.java @@ -0,0 +1,34 @@ +package com.ruoyi.system.api; + +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Merchant; +import com.ruoyi.system.api.factory.RemoteCustomerApplyLogFallbackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; + +import java.util.List; + +/** + * 用户服务 + * + * @author ruoyi + */ +@FeignClient(contextId = "remoteCustomerApplyLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteCustomerApplyLogFallbackFactory.class) +public interface RemoteCustomerApplyLogService +{ + /** + * 获取商户今日已申请数 + * + * + * @param merchantId + * @param source 请求来源 + * @return 结果 + */ + @GetMapping("/log/sum") + public R sum(@PathVariable("merchantId") Long merchantId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source); + +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteMerchantService.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteMerchantService.java new file mode 100644 index 00000000..9503672b --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/RemoteMerchantService.java @@ -0,0 +1,33 @@ +package com.ruoyi.system.api; + +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.constant.ServiceNameConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Merchant; +import com.ruoyi.system.api.domain.SysUser; +import com.ruoyi.system.api.factory.RemoteMerChantFallbackFactory; +import com.ruoyi.system.api.factory.RemoteUserFallbackFactory; +import com.ruoyi.system.api.model.LoginUser; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 用户服务 + * + * @author ruoyi + */ +@FeignClient(contextId = "remoteMerchantService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteMerChantFallbackFactory.class) +public interface RemoteMerchantService +{ + /** + * 获取合适的产品 前筛 + * + * @param source 请求来源 + * @return 结果 + */ + @GetMapping("/merchant/merchantList") + public R> merchantList(@RequestHeader(SecurityConstants.FROM_SOURCE) String source); + +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerApplyLogFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerApplyLogFallbackFactory.java new file mode 100644 index 00000000..cede92dc --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerApplyLogFallbackFactory.java @@ -0,0 +1,41 @@ +package com.ruoyi.system.api.factory; + +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Merchant; +import com.ruoyi.system.api.RemoteCustomerApplyLogService; +import com.ruoyi.system.api.RemoteMerchantService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestHeader; + +import java.util.List; + +/** + * 用户服务降级处理 + * + * @author ruoyi + */ +@Component +@Slf4j +public class RemoteCustomerApplyLogFallbackFactory implements FallbackFactory +{ + + @Override + public RemoteCustomerApplyLogService create(Throwable throwable) + { + log.error("用户服务调用失败:{}", throwable.getMessage()); + return new RemoteCustomerApplyLogService() + { + @Override + public R sum(@PathVariable("merchantId") Long merchantId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) + { + return R.fail("获取商户已申请数失败:" + throwable.getMessage()); + } + + + }; + } +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerFallbackFactory.java index 3501b1b9..d53b6c3f 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteCustomerFallbackFactory.java @@ -2,7 +2,6 @@ package com.ruoyi.system.api.factory; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.domain.http.Customer; -import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.system.api.RemoteCustomerService; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.openfeign.FallbackFactory; diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMerChantFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMerChantFallbackFactory.java new file mode 100644 index 00000000..f8392786 --- /dev/null +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteMerChantFallbackFactory.java @@ -0,0 +1,37 @@ +package com.ruoyi.system.api.factory; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Merchant; +import com.ruoyi.system.api.RemoteMerchantService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.cloud.openfeign.FallbackFactory; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 用户服务降级处理 + * + * @author ruoyi + */ +@Component +@Slf4j +public class RemoteMerChantFallbackFactory implements FallbackFactory +{ + + @Override + public RemoteMerchantService create(Throwable throwable) + { + log.error("用户服务调用失败:{}", throwable.getMessage()); + return new RemoteMerchantService() + { + @Override + public R> merchantList(String source) + { + return R.fail("获取用户失败:" + throwable.getMessage()); + } + + + }; + } +} diff --git a/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 9212ec04..4c526d6d 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/ruoyi-api/ruoyi-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,3 +1,6 @@ com.ruoyi.system.api.factory.RemoteUserFallbackFactory com.ruoyi.system.api.factory.RemoteLogFallbackFactory com.ruoyi.system.api.factory.RemoteFileFallbackFactory +com.ruoyi.system.api.factory.RemoteCustomerFallbackFactory +com.ruoyi.system.api.factory.RemoteMerChantFallbackFactory +com.ruoyi.system.api.factory.RemoteCustomerApplyLogFallbackFactory \ No newline at end of file diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Channel.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Channel.java similarity index 98% rename from ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Channel.java rename to ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Channel.java index 018c90a5..4deeac68 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Channel.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Channel.java @@ -1,4 +1,4 @@ -package com.ruoyi.system.domain; +package com.ruoyi.common.core.domain.http; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Customer.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Customer.java index eda92b13..477015a9 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Customer.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Customer.java @@ -22,6 +22,10 @@ public class Customer extends BaseEntity /** $column.columnComment */ private Long id; + /**渠道ID**/ + @Excel(name = "渠道ID") + private Long channelId; + /** 年龄 */ @Excel(name = "年龄") private Integer age; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Merchant.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Merchant.java new file mode 100644 index 00000000..7f5f1813 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/domain/http/Merchant.java @@ -0,0 +1,203 @@ +package com.ruoyi.common.core.domain.http; + +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 商户对象 merchant + * + * @author ruoyi + * @date 2024-09-15 + */ +@Data +public class Merchant extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 商户类型 1H5 2连登 3半流程 4全流程 */ + @Excel(name = "商户类型 1H5 2连登 3半流程 4全流程") + private Long merchantType; + + /** 商户名称 */ + @Excel(name = "商户名称") + private String merchantName; + + /** 商户描述 */ + @Excel(name = "商户描述") + private String merchantDescribe; + + /** 商户主体 */ + @Excel(name = "商户主体") + private String merchantCompany; + + /** logo文件地址 */ + @Excel(name = "logo文件地址") + private String logo; + + /** 是否上下架 */ + @Excel(name = "是否上下架") + private Integer status; + + /** 定量数 */ + @Excel(name = "定量数") + private Integer limitNum; + + /** 是否定量 0否 1是 */ + @Excel(name = "是否定量 0否 1是") + private Integer limitType; + + /** 渠道限制类型 0不限 1准入 2禁入 */ + @Excel(name = "渠道限制类型 0不限 1准入 2禁入") + private Integer channelLimitType; + + /** 渠道限制ID */ + @Excel(name = "渠道限制ID") + private String channelLimit; + + /** 渠道限制类型 0不限 1满足其一 2满足全部 */ + @Excel(name = "渠道限制类型 0不限 1满足其一 2满足全部") + private Integer customerInfoFilterType; + + /** 年龄限制开始 */ + @Excel(name = "年龄限制开始") + private Integer ageLimitStart; + + /** 年龄限制结束 */ + @Excel(name = "年龄限制结束") + private Integer ageLimitEnd; + + /** 手机号禁入号段英文逗号分隔 */ + @Excel(name = "手机号禁入号段英文逗号分隔") + private String phoneLimit; + + /** 无社保 */ + @Excel(name = "无社保") + private Boolean socialSecurityNo; + + /** 社保未满6个月 */ + @Excel(name = "社保未满6个月") + private Boolean socialSecurityLow; + + /** 社保6个月以上 */ + @Excel(name = "社保6个月以上") + private Boolean socialSecurityHigh; + + /** 无车 */ + @Excel(name = "无车") + private Boolean carNo; + + /** 有车 */ + @Excel(name = "有车") + private Boolean carHave; + + /** 保单缴纳不满一年 */ + @Excel(name = "保单缴纳不满一年") + private Boolean guaranteeSlipLow; + + /** 保单缴纳一年以上 */ + @Excel(name = "保单缴纳一年以上") + private Boolean guaranteeSlipCentre; + + /** 保单缴纳2年以上 */ + @Excel(name = "保单缴纳2年以上") + private Boolean guaranteeSlipHigh; + + /** 初中 */ + @Excel(name = "初中") + private Boolean educationMiddle; + + /** 高中 */ + @Excel(name = "高中") + private Boolean educationHighSchool; + + /** 中专 */ + @Excel(name = "中专") + private Boolean educationPolytechnic; + + /** 大专 */ + @Excel(name = "大专") + private Boolean educationJuniorCollege; + + /** 本科 */ + @Excel(name = "本科") + private Boolean educationUndergraduateCourse; + + /** 研究生及以上 */ + @Excel(name = "研究生及以上") + private Boolean educationPostgraduate; + + /** 公积金未满6个月 */ + @Excel(name = "公积金未满6个月") + private Boolean accumulationFundLow; + + /** 公积金满6个月以上 */ + @Excel(name = "公积金满6个月以上") + private Boolean accumulationFundHigh; + + /** 本地无房 */ + @Excel(name = "本地无房") + private Boolean hourseNo; + + /** 本地全款房 */ + @Excel(name = "本地全款房") + private Boolean hourseFullPayment; + + /** 本地按揭 */ + @Excel(name = "本地按揭") + private Boolean hourseMortgaging; + + /** 上班族 */ + @Excel(name = "上班族") + private Boolean officeWorker; + + /** 公务员 */ + @Excel(name = "公务员") + private Boolean civilServant; + + /** 私营业主 */ + @Excel(name = "私营业主") + private Boolean privatePropertyOwners; + + /** 个体户 */ + @Excel(name = "个体户") + private Boolean selfEmployedPerson; + + /** 其他职业 */ + @Excel(name = "其他职业") + private Boolean otherOccupations; + + /** 花呗5000以下 */ + @Excel(name = "花呗5000以下") + private Boolean huaBeiLow; + + /** 花呗5000-10000 */ + @Excel(name = "花呗5000-10000") + private Boolean huaBeiMiddle; + + /** 花呗10000以上 */ + @Excel(name = "花呗10000以上") + private Boolean huaBeiHigh; + + /** 白条5000以下 */ + @Excel(name = "白条5000以下") + private Boolean baiTiaoLow; + + /** 白条5000-10000 */ + @Excel(name = "白条5000-10000") + private Boolean baiTiaoMiddle; + + /** 白条10000以上 */ + @Excel(name = "白条10000以上") + private Boolean baiTiaoHigh; + + /** 芝麻分 */ + @Excel(name = "芝麻分") + private Integer zhiMa; + +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/LocalDateTimeUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/LocalDateTimeUtils.java new file mode 100644 index 00000000..eef18ef1 --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/LocalDateTimeUtils.java @@ -0,0 +1,483 @@ +package com.ruoyi.common.core.utils; + +import java.text.SimpleDateFormat; +import java.time.*; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.time.temporal.TemporalAdjusters; +import java.util.*; + +/** + * @program: JieYiHua-Cloud + * @description: 时间工具类 + * @author: LiYu + * @create: 2021-08-04 15:45 + **/ +public class LocalDateTimeUtils { + /** + * 获取指定日期所属周的周一的日期 + * + * @param localDate + * @return + */ + public static LocalDateTime getMondayForThisWeek(LocalDate localDate) { + LocalDateTime monday = LocalDateTime.of(localDate, LocalTime.MIN).with(DayOfWeek.MONDAY); + return monday; + } + + /** + * 获取指定日期所属周的周日的日期 + * + * @param localDate + * @return + */ + public static LocalDateTime getSundayForThisWeek(LocalDate localDate) { + LocalDateTime sunday = LocalDateTime.of(localDate, LocalTime.MIN).with(DayOfWeek.SUNDAY); + return sunday; + } + + /** + * 获取指定日期所属周的下周一的日期 + * + * @param localDate + * @return + */ + public static LocalDateTime getMondayForNextWeek(LocalDate localDate) { + LocalDateTime monday = LocalDateTime.of(localDate, LocalTime.MIN).plusWeeks(1).with(DayOfWeek.MONDAY); + return monday; + } + + /** + * 获取指定日期所属周的下周日的日期 + * + * @param localDate + * @return + */ + public static LocalDateTime getSundayForNextWeek(LocalDate localDate) { + LocalDateTime sunday = LocalDateTime.of(localDate, LocalTime.MIN).plusWeeks(1).with(DayOfWeek.SUNDAY); + return sunday; + } + + /** + * 指定格式为"yyyy-MM-dd HH:mm:ss"的字符串时间转化为LocalDateTime类型 + * + * @param dateStr + * @return + */ + public static LocalDateTime getLocalDateTimeFromString(String dateStr) { + LocalDateTime localDateTime = LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + return localDateTime; + } + + /** + * 指定格式为"yyyy-MM-ddTHH:mm:ss"的字符串时间转化为LocalDateTime类型 + * + * @param dateStr + * @return + */ + public static LocalDateTime getLocalDateTimeFromString2(String dateStr) { + LocalDateTime localDateTime = LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd w hh:mm:ss")); + return localDateTime; + } + + /** + * LocalDateTime类型转化为格式为"yyyy-MM-dd HH:mm:ss"的字符串时间类型 + * + * @param localDateTime + * @return + */ + public static String getStringFromLocalDateTime(LocalDateTime localDateTime) { + String localDateTimeStr = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + return localDateTimeStr; + } + + + /** + * LocalDateTime类型转化为格式为"yyyy-MM-dd"的字符串时间类型 + * + * @param localDateTime 时间 + * @return 结果 + */ + public static String getStringFromLocalDateTime2(LocalDateTime localDateTime) { + if (localDateTime == null) { return null; } + return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + } + + /** + * LocalDateTime类型转化为格式为"yyyy-MM-dd HH"的字符串时间类型 + * + * @param localDateTime 时间 + * @return 结果 + */ + public static String getStringFromLocalDateTime4(LocalDateTime localDateTime) { + if (localDateTime == null) { return null; } + return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH")); + } + + /** + * LocalDateTime类型转化为格式为"yyyy-MM"的字符串时间类型 + */ + public static String getStringFromLocalDateTime3(LocalDateTime localDateTime) { + if (localDateTime == null) { + return null; + } + return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM")); + } + + /** + * Date类型时间转化为LocalDateTime类型 + * + * @param date + * @return + */ + public static LocalDateTime getLocalDateTimeFromDate(Date date) { + LocalDateTime localDateTime = date.toInstant().atOffset(ZoneOffset.of("+8")).toLocalDateTime(); + return localDateTime; + } + + /** + * LocalDateTime类型转化为Date类型时间 + * + * @param localDateTime + * @return + */ + public static Date getDateFromLocalDateTime(LocalDateTime localDateTime) { + Date date = Date.from(localDateTime.toInstant(ZoneOffset.of("+8"))); + return date; + } + + /** + * 获取指定时间的00:00:00 + * + * @param localDateTime + * @return + */ + public static LocalDateTime getLocalDateTimeForBegin(LocalDateTime localDateTime) { + LocalDateTime begin = LocalDateTime.of(localDateTime.toLocalDate(), LocalTime.MIN); + return begin; + } + + /** + * 获取指定时间的23:59:59 + * + * @param localDateTime + * @return + */ + public static LocalDateTime getLocalDateTimeForEnd(LocalDateTime localDateTime) { + LocalDateTime end = LocalDateTime.of(localDateTime.toLocalDate(), LocalTime.MAX); + return end; + } + + /** + * 时间戳(毫秒)转化为LocalDateTime格式 + * + * @param timestamp + * @return + */ + public static LocalDateTime getLocalDateTimeFromTimestamp(Long timestamp) { + LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(timestamp / 1000, 0, ZoneOffset.ofHours(8)); + return localDateTime; + } + + /** + * LocalDateTime格式转化为时间戳(毫秒) + * + * @param localDateTime + * @return + */ + public static Long getTimestampFromLocalDateTime(LocalDateTime localDateTime) { + Long timestamp = localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); + return timestamp; + } + + /** + * 时间戳(毫秒)转 yyyy-MM-dd HH:mm:ss + * @param timestamp + * @return + */ + public static String getStringFromTimestamp(Long timestamp) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return dateFormat.format(timestamp); + } + + /** + * 获取本月开始时间 + * + * @return 开始时间 + */ + public static LocalDateTime getFirstDayOfMonth() { + return LocalDateTime.of(LocalDate.from(LocalDateTime.now().with(TemporalAdjusters.firstDayOfMonth())), LocalTime.MIN); + } + + /** + * 获取月初 + * + * @param localDateTime 时间 + * @return 数据 + */ + public static LocalDateTime getTheBeginningOfTheMonth(LocalDateTime localDateTime) { + return LocalDateTime.of(LocalDate.from(localDateTime.with(TemporalAdjusters.firstDayOfMonth())), LocalTime.MIN); + } + + /** + * 获取本月结束时间 + * + * @return 结束时间 + */ + public static LocalDateTime getLastDay() { + return LocalDateTime.of(LocalDate.from(LocalDateTime.now().with(TemporalAdjusters.lastDayOfMonth())), LocalTime.MAX); + } + + public static LocalDateTime getTheEndOfTheMonth(LocalDateTime localDateTime) { + return LocalDateTime.of(LocalDate.from(localDateTime.with(TemporalAdjusters.lastDayOfMonth())), LocalTime.MAX); + } + + /** + * 获取时间差 (秒) + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 秒 + */ + public static Long getTimeDifference(LocalDateTime startTime, LocalDateTime endTime) { + Duration duration = Duration.between(startTime, endTime); + return duration.toMinutes() * 60; + } + + /** + * 获取两个时间差 (天数) + * + * @param localDateTime 时间 + * @return 天数 + */ + public static Long timeDifferenceByDay(LocalDateTime localDateTime) { + LocalDateTime now = LocalDateTime.now(); + Duration duration = Duration.between(localDateTime, now); + return duration.toDays(); + } + + /** + * 获取两天时间间隔 + * + * @param startingTime 开始时间 + * @param endTime 结束时间 + * @return 结果 + */ + public static Long twoDayInterval(LocalDateTime startingTime, LocalDateTime endTime) { + Duration duration = Duration.between(startingTime, endTime); + return duration.toDays(); + } + + /** + * 转白话 + * + * @param localDateTime 时间 + * @return 字符串 + */ + public static String toTheVernacular(LocalDateTime localDateTime) { + return localDateTime.getYear() + "年" + localDateTime.getMonthValue() + "月" + localDateTime.getDayOfMonth() + "日"; + } + + + /** + * 获取昨天 + * + * @return 获取昨天 + */ + public static LocalDateTime getYesterdaySDate() { + return LocalDateTime.now().plusDays(1); + } + /** + * 获取昨天 + * + * @return 获取昨天 + */ + public static LocalDateTime getMinusDays() { + return LocalDateTime.now().minusDays(1); + } + /** + * 获取明天 + * + * @return 获取明天 + */ + public static LocalDateTime getPlusDays() { + return LocalDateTime.now().plusDays(1); + } + + /** + * 获取今年开始时间 + * + * @return 开始时间 + */ + public static LocalDateTime startThisYear() { + return LocalDateTime.of(LocalDate.from(LocalDateTime.now().with(TemporalAdjusters.firstDayOfYear())), LocalTime.MIN); + } + + + /** + * 根据日期获取 星期 (2019-05-06 ——> 星期一) + * + * @param datetime + * @return + */ + public static int dateToWeek(LocalDateTime datetime) { + //获取当前时间 + LocalDateTime currentDate = LocalDateTime.now(); + //获取当前周 + int week = currentDate.getDayOfWeek().getValue(); + System.out.println("获取当前周:" + week); + return week; + } + + public static void main(String[] args) { + System.out.println(twoDayInterval(LocalDateTime.now(),LocalDateTime.now())); + System.out.println(getNowBeforeHourTime(-24L)); + } + + + + /** + * 获取今天开始时间 + * + * @return 结果 + */ + public static LocalDateTime getTodayStartTime() { + return getLocalDateTimeForBegin(LocalDateTime.now()); + } + + /** + * 获取今天结束时间 + * + * @return 结果 + */ + public static LocalDateTime getTodayEndTime() { + return getLocalDateTimeForEnd(LocalDateTime.now()); + } + + + + + + /** + * 相隔所有时间 + * + * @param startingTime 开始时间 + * @param endTime 结束时间 + * @return 结果 + */ + public static List allTimeApart(String startingTime, String endTime) { + Long size = LocalDateTimeUtils.twoDayInterval(LocalDateTimeUtils.getLocalDateTimeFromString(startingTime), LocalDateTimeUtils.getLocalDateTimeFromString(endTime)); + List list = new ArrayList<>(Math.toIntExact(size)); + LocalDateTime time = getLocalDateTimeFromString(endTime); + for (int i = 0; i <= size; i++) { + LocalDateTime localDateTime = time.minusDays(i); + list.add(getStringFromLocalDateTime2(localDateTime)); + } + return list; + } + + + /** + * 判断当前用户登录时段是否在09:00-18:00 + * @param + * @return + */ + public static boolean setFirstLogTime(){ + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm");//获取时,分 + //当前系统时间 + Date data = new Date(); + String dateString = formatter.format(data); + String format = "HH:mm"; + try{ + Date nowTime = new SimpleDateFormat(format).parse(dateString); + Date startTime = new SimpleDateFormat(format).parse("09:00"); + Date endTime = new SimpleDateFormat(format).parse("18:00"); + return isEffectiveDate(nowTime, startTime, endTime); + }catch (Exception e){ + e.printStackTrace(); + return false; + } + } + + /** + * 判断当前时间是否在[startTime, endTime]区间,注意时间格式要一致 + * + * @param nowTime 当前时间 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + public static boolean isEffectiveDate(Date nowTime, Date startTime, Date endTime) { + if (nowTime.getTime() == startTime.getTime() || nowTime.getTime() == endTime.getTime()) { + return true; + } + Calendar date = Calendar.getInstance(); + date.setTime(nowTime); + Calendar begin = Calendar.getInstance(); + begin.setTime(startTime); + Calendar end = Calendar.getInstance(); + end.setTime(endTime); + if (date.after(begin) && date.before(end)) { + return true; + } else { + return false; + } + } + + /** + * 判断当前日期是否大于某个日期 + * @param date yyyy-MM-dd + * @return + */ + public static boolean afterDate(LocalDateTime date){ + //针对好享管家图片相反 + String times = "2022-08-23"; + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + //把String转为LocalDate + LocalDate localTime=LocalDate.parse(times,dtf); + //判断当前日期是否大于指定日期 + return date.toLocalDate().isAfter(localTime); + } + + + /** + * 获取当前时间指定偏移多长小时前的时间 + * @param hour 负向前偏移 正向后偏移 + * @return + */ + public static LocalDateTime getNowBeforeHourTime(Long hour){ + LocalDateTime localDateTime = LocalDateTime.now(ZoneId.systemDefault()); + return localDateTime.plusHours(hour); + } + + public static Long timeDifferenceByLocalDate(LocalDateTime localDateTime) { + LocalDate toLocalDate = localDateTime.toLocalDate(); + LocalDate now = LocalDate.now(); + long until = toLocalDate.until(now, ChronoUnit.DAYS); + return toLocalDate.until(now, ChronoUnit.DAYS); + } + + /** + * 判断时间是否是今天 + * @param localDateTime 时间 + * @return 结果 + */ + public static boolean isToday(LocalDateTime localDateTime) { + return localDateTime.toLocalDate().equals(LocalDate.now()); + } + + /** + * 判断日期是否是指定天数内 + * @param localDateTime 时间 + * @param day 天数 + * @return 结果 + */ + public static boolean isDay(LocalDateTime localDateTime,Long day) { + return localDateTime.toLocalDate().equals(LocalDate.now().plusDays(day)); + } + + public static long getTimeStamp(String dateTime){ + LocalDateTime time = LocalDateTimeUtils.getLocalDateTimeFromString(dateTime); + return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + } +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/match/MatchQualification.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/match/MatchQualification.java index fdd96a0b..44576ee7 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/match/MatchQualification.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/match/MatchQualification.java @@ -1,9 +1,456 @@ package com.ruoyi.common.core.utils.match; +import com.ruoyi.common.core.domain.http.Customer; +import com.ruoyi.common.core.domain.http.Merchant; import lombok.extern.slf4j.Slf4j; +import java.util.Objects; + @Slf4j public class MatchQualification { - + /** + * 是否可以匹配上产品 + * @param customer 用户信息 + * @param merchant 产品前筛 + * openInfoFilter 开启资质筛选 0:不筛选, 1:满足1, 2:满足全部 + * + * @return 结构 + */ + public static Boolean doesItMatchProduct(Customer customer, Merchant merchant) { +// if (Objects.isNull(merchant)){ +// return true; +// } +// +// if (Objects.isNull(merchant.getCustomerInfoFilterType()) || merchant.getCustomerInfoFilterType() == 0){ +// return true; +// } +// +// //满足1个 +// boolean openOne = merchant.getCustomerInfoFilterType() == 1; +// //满足所有 +// boolean openAll = merchant.getCustomerInfoFilterType() == 2; +// //结果 +// boolean result = false; +// +// String userInfo = customer.getId() + "-" + customer.getChannelId() + "-" + merchant.getId(); +// +// //社保 +// if (merchant.getSocialSecurityHigh() || merchant.getSocialSecurityNo() ||merchant.getSocialSecurityLow()) { +// if (openAll && Objects.isNull(customer.getSocialSecurity())){ +// log.info("资质匹配筛选, 配置[满足所有]-社保为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// Integer infoByCode = customer.getSocialSecurity(); +// if (Objects.nonNull(customer.getSocialSecurity())) { +// if (merchant.getSocialSecurityNo()) { +// if (customer.getSocialSecurity()==merchant.getSocialSecurityNo())) { +// result = true; +// } +// } +// +// if (merchant.getSocialSecurityLow()) { +// if (customer.getSocialSecurity().equals(CustomerSocialSecurityType.GREAT_SOCIAL_SECURITY.getCode())) { +// result = true; +// } +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +//// log.info("资质匹配筛选, 配置[满足其一]-社保:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getSocialSecurity() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-社保:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getSocialSecurity() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //公积金 +// if (productLimit.getSmallProvidentFund() || productLimit.getGreatProvidentFund()) { +// if (openAll && Objects.isNull(userDetailsDTO.getProvidentFund())){ +// log.info("资质匹配筛选, 配置[满足所有]-公积金为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = CustomerProvidentFundType.getInfoByCode(userDetailsDTO.getProvidentFund()); +// if (Objects.nonNull(userDetailsDTO.getProvidentFund())) { +// if (productLimit.getSmallProvidentFund()) { +// if (userDetailsDTO.getProvidentFund().equals(CustomerProvidentFundType.SMALL_PROVIDENT_FUND.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getGreatProvidentFund()) { +// if (userDetailsDTO.getProvidentFund().equals(CustomerProvidentFundType.GREAT_PROVIDENT_FUND.getCode())) { +// result = true; +// } +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +//// log.info("资质匹配筛选, 配置[满足其一]-公积金:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getProvidentFund() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +//// log.info("资质匹配筛选, 配置[满足所有]-公积金:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getProvidentFund() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //车产 +// if (productLimit.getHavaCar()) { +// if (openAll && Objects.isNull(userDetailsDTO.getCarProduction())){ +// log.info("资质匹配筛选, 配置[满足所有]-车产为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = CustomerCarProductionType.getInfoByCode(userDetailsDTO.getCarProduction()); +// if (Objects.nonNull(userDetailsDTO.getCarProduction())) { +// if (userDetailsDTO.getCarProduction().equals(CustomerCarProductionType.HAVE_CAR.getCode())) { +// result = true; +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-车产:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getCarProduction() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-车产:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getCarProduction() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //房产 +// if (productLimit.getHaveMortgageRoom() || productLimit.getHaveFullRoom()) { +// if (openAll && Objects.isNull(userDetailsDTO.getEstate())){ +// log.info("资质匹配筛选, 配置[满足所有]-房产为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = CustomerEstateType.getInfoByCode(userDetailsDTO.getEstate()); +// if (Objects.nonNull(userDetailsDTO.getEstate())) { +// if (productLimit.getHaveMortgageRoom()){ +// if (userDetailsDTO.getEstate().equals(CustomerEstateType.HAVE_PROPERTY.getCode())){ +// result = true; +// } +// } +// +// if (productLimit.getHaveFullRoom()){ +// if (userDetailsDTO.getEstate().equals(CustomerEstateType.FULL_PAYMENT_FOR_HOUSING.getCode())){ +// result = true; +// } +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +//// log.info("资质匹配筛选, 配置[满足其一]-房产:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getEstate() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-房产:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getEstate() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //保单 +// if (productLimit.getPolicyLessThanOneYear() || productLimit.getPolicyPaymentForOneYear() || productLimit.getPolicyPaymentForTwoYear()) { +// if (openAll && Objects.isNull(userDetailsDTO.getPersonalInsurance())){ +// log.info("资质匹配筛选, 配置[满足所有]-保单为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = CustomerInsurancePolicyType.getInfoByCode(userDetailsDTO.getPersonalInsurance()); +// if (Objects.nonNull(userDetailsDTO.getPersonalInsurance())) { +// if (productLimit.getPolicyLessThanOneYear()) { +// if (userDetailsDTO.getPersonalInsurance().equals(CustomerInsurancePolicyType.POLICY_LESS_THAN_ONE_YEAR.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getPolicyPaymentForOneYear()) { +// if (userDetailsDTO.getPersonalInsurance().equals(CustomerInsurancePolicyType.POLICY_PAYMENT_FOR_ONE_YEAR.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getPolicyPaymentForTwoYear()) { +// if (userDetailsDTO.getPersonalInsurance().equals(CustomerInsurancePolicyType.POLICY_PAYMENT_FOR_TWO_YEAR.getCode())) { +// result = true; +// } +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-保单:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getPersonalInsurance() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-保单:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getPersonalInsurance() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //芝麻分 +// if (Objects.nonNull(productLimit.getSesame())){ +// if (openAll && Objects.isNull(userDetailsDTO.getSesame())){ +// log.info("资质匹配筛选, 配置[满足所有]-芝麻分为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// if (Objects.nonNull(userDetailsDTO.getSesame())) { +// if (userDetailsDTO.getSesame() >= productLimit.getSesame()){ +// result = true; +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-芝麻分:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getSesame(), userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-芝麻分:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getSesame(), userInfo); +// return false; +// } +// } +// +// //职业 +// if (productLimit.getOfficeWorker() || +// productLimit.getCivilServant() || +// productLimit.getPrivateOwners() || +// productLimit.getSmallPrivateBusiness() || +// productLimit.getOtherOccupations()) { +// +// if (openAll && Objects.isNull(userDetailsDTO.getProfessionalIdentity())){ +// log.info("资质匹配筛选, 配置[满足所有]-职业为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = CustomerProfessionalIdentityType.getInfoByCode(userDetailsDTO.getProfessionalIdentity()); +// if (Objects.nonNull(userDetailsDTO.getProfessionalIdentity())) { +// if (productLimit.getOfficeWorker()){ +// if (userDetailsDTO.getProfessionalIdentity().equals(CustomerProfessionalIdentityType.OFFICE_WORKER.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getCivilServant()){ +// if (userDetailsDTO.getProfessionalIdentity().equals(CustomerProfessionalIdentityType.CIVIL_SERVANT.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getPrivateOwners()){ +// if (userDetailsDTO.getProfessionalIdentity().equals(CustomerProfessionalIdentityType.PRIVATE_OWNERS.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getSmallPrivateBusiness()){ +// if (userDetailsDTO.getProfessionalIdentity().equals(CustomerProfessionalIdentityType.SMALL_PRIVATE_BUSINESS.getCode())) { +// result = true; +// } +// } +// +// if (productLimit.getOtherOccupations()){ +// if (userDetailsDTO.getProfessionalIdentity().equals(CustomerProfessionalIdentityType.OTHER_OCCUPATIONS.getCode())) { +// result = true; +// } +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-职业:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getProfessionalIdentity() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-职业:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getProfessionalIdentity() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //学历 字典映射 1: "初中及以下,2: "高中",3: "中专",4: "大专",5: "本科",6: "研究生及以上" +// if (productLimit.getJuniorMiddleSchool() || +// productLimit.getSeniorMiddleSchool() || +// productLimit.getMiddleSchool() || +// productLimit.getCollege() || +// productLimit.getUndergraduate() || +// productLimit.getPostgraduate()) { +// +// if (openAll && Objects.isNull(userDetailsDTO.getEducation())){ +// log.info("资质匹配筛选, 配置[满足所有]-学历为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = getEducationByCode(userDetailsDTO.getEducation()); +// if (Objects.nonNull(userDetailsDTO.getEducation())) { +// if (productLimit.getJuniorMiddleSchool() && userDetailsDTO.getEducation() == 1) { //初中 +// result = true; +// } +// +// if (productLimit.getSeniorMiddleSchool() && userDetailsDTO.getEducation() == 2) { //高中 +// result = true; +// } +// +// if (productLimit.getMiddleSchool() && userDetailsDTO.getEducation() == 3) { //中专 +// result = true; +// } +// +// if (productLimit.getCollege() && userDetailsDTO.getEducation() == 4) { //大专 +// result = true; +// } +// +// if (productLimit.getUndergraduate() && userDetailsDTO.getEducation() == 5) { //本科 +// result = true; +// } +// +// if (productLimit.getPostgraduate() && userDetailsDTO.getEducation() == 6) { //研究生 +// result = true; +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-学历:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getEducation() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-学历:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getEducation() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //白条可用额度 字典映射 1: 无额度,2: 2000以下,3: 2000-10000,4: 大于10000 +// if (productLimit.getBaiTiaoLevelOne() || +// productLimit.getBaiTiaoLevelTwo() || +// productLimit.getBaiTiaoLevelThree()) { +// +// if (openAll && Objects.isNull(userDetailsDTO.getBaiTiaoQuota())){ +// log.info("资质匹配筛选, 配置[满足所有]-白条为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = getBaiTiaoByCode(userDetailsDTO.getBaiTiaoQuota()); +// if (Objects.nonNull(userDetailsDTO.getBaiTiaoQuota())) { +// if (productLimit.getBaiTiaoLevelOne() && userDetailsDTO.getBaiTiaoQuota() == 2) { //2000以下 +// result = true; +// } +// +// if (productLimit.getBaiTiaoLevelTwo() && userDetailsDTO.getBaiTiaoQuota() == 3) { //2000-10000 +// result = true; +// } +// +// if (productLimit.getBaiTiaoLevelThree() && userDetailsDTO.getBaiTiaoQuota() == 4) { //大于10000 +// result = true; +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-白条:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getBaiTiaoQuota() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-白条:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getBaiTiaoQuota() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //花呗可用额度 字典映射 1: 无额度,2: 2000以下,3: 2000-10000,4: 大于10000 +// if (productLimit.getHuaBeiLevelOne() || +// productLimit.getHuaBeiLevelTwo() || +// productLimit.getHuaBeiLevelThree()) { +// +// if (openAll && Objects.isNull(userDetailsDTO.getHuaBeiQuota())){ +// log.info("资质匹配筛选, 配置[满足所有]-花呗为空, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return false; +// } +// +// //判断结果置默认 +// result = false; +// String infoByCode = getBaiTiaoByCode(userDetailsDTO.getHuaBeiQuota()); +// if (Objects.nonNull(userDetailsDTO.getHuaBeiQuota())) { +// if (productLimit.getHuaBeiLevelOne() && userDetailsDTO.getHuaBeiQuota() == 2) { //2000以下 +// result = true; +// } +// +// if (productLimit.getHuaBeiLevelTwo() && userDetailsDTO.getHuaBeiQuota() == 3) { //2000-10000 +// result = true; +// } +// +// if (productLimit.getHuaBeiLevelThree() && userDetailsDTO.getHuaBeiQuota() == 4) { //大于10000 +// result = true; +// } +// +// //条件为 满足一个即可, 恰巧现在就有满足的, 则返回true(通过) +// if (openOne && result) { +// log.info("资质匹配筛选, 配置[满足其一]-花呗:{}, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getHuaBeiQuota() + "-" + infoByCode, userInfo); +// return result; +// } +// } +// +// //条件为 满足全部, 恰巧现在这个不满足, 则返回false(不通过) +// if (openAll && !result) { +// log.info("资质匹配筛选, 配置[满足所有]-花呗:{}, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userDetailsDTO.getHuaBeiQuota() + "-" + infoByCode, userInfo); +// return false; +// } +// } +// +// //满足其一, 但结果为false, 则不通过 +// if (openOne && !result){ +//// log.info("资质匹配筛选, 配置[满足其一]-未匹配成功, 匹配不通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return result; +// } +// +// if (openAll && result){ +// log.info("资质匹配筛选, 配置[满足所有]-匹配成功, 匹配通过, 结束匹配, 用户id-渠道id-渠道名称-产品id:{}", userInfo); +// return result; +// } +// +// log.info("资质匹配筛选, 此行日志我觉得不会输出, 用户id-渠道id-渠道名称-产品id:{}", userInfo); + return true; + } } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java index 6eff642f..e0b4e54e 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java @@ -129,6 +129,17 @@ public class BaseController return rows > 0 ? AjaxResult.success() : AjaxResult.error(); } + /** + * 响应返回结果 + * + * @param rows 影响行数 + * @return 操作结果 + */ + protected AjaxResult toAjax(Long rows) + { + return rows > 0 ? AjaxResult.success() : AjaxResult.error(); + } + /** * 响应返回结果 * diff --git a/ruoyi-modules/ruoyi-btc/pom.xml b/ruoyi-modules/ruoyi-btc/pom.xml index 6cb9c61b..44c4b088 100644 --- a/ruoyi-modules/ruoyi-btc/pom.xml +++ b/ruoyi-modules/ruoyi-btc/pom.xml @@ -57,6 +57,14 @@ org.projectlombok lombok + + com.ruoyi + ruoyi-common-redis + + + com.ruoyi + ruoyi-common-security + diff --git a/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/RuoYiBtcApplication.java b/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/RuoYiBtcApplication.java index 63763cb3..338bdd45 100644 --- a/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/RuoYiBtcApplication.java +++ b/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/RuoYiBtcApplication.java @@ -1,14 +1,16 @@ package com.ruoyi.btc; +import com.ruoyi.common.security.annotation.EnableRyFeignClients; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; /** - * 文件服务 + * 三方调用服务 * * @author ruoyi */ +@EnableRyFeignClients @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class }) public class RuoYiBtcApplication { diff --git a/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/service/impl/SysPublicHalfServiceImpl.java b/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/service/impl/SysPublicHalfServiceImpl.java index 05849b1f..c554ae46 100644 --- a/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/service/impl/SysPublicHalfServiceImpl.java +++ b/ruoyi-modules/ruoyi-btc/src/main/java/com/ruoyi/btc/service/impl/SysPublicHalfServiceImpl.java @@ -5,30 +5,38 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.btc.domain.ComPublicHalfDto; import com.ruoyi.btc.domain.CustomerInfoDto; import com.ruoyi.btc.service.ISysPublicHalfService; +import com.ruoyi.common.core.constant.CacheConstants; import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Channel; import com.ruoyi.common.core.domain.http.Customer; +import com.ruoyi.common.core.domain.http.Merchant; import com.ruoyi.common.core.utils.SecureUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.redis.service.RedisService; +import com.ruoyi.system.api.RemoteCustomerApplyLogService; import com.ruoyi.system.api.RemoteCustomerService; +import com.ruoyi.system.api.RemoteMerchantService; import lombok.RequiredArgsConstructor; -import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; -import java.util.Date; +import java.util.*; +import java.util.stream.Collectors; /** * 本地文件存储 * * @author ruoyi */ -@Primary @Service @RequiredArgsConstructor public class SysPublicHalfServiceImpl implements ISysPublicHalfService { private final RemoteCustomerService remoteCustomerService; + private final RemoteMerchantService remoteMerchantService; + private final RemoteCustomerApplyLogService remoteCustomerApplyLogService; + private final RedisService redisService; /** * 半流程通用撞库 @@ -37,9 +45,14 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService @Override public AjaxResult check(ComPublicHalfDto comPublicHalfDto) { //校验 IP地址是否正常 渠道标识是否存在 数据是否为空 + if (StringUtils.isEmpty(comPublicHalfDto.getChannelSignature())){ return AjaxResult.error("渠道标识不能未空"); } + Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN + comPublicHalfDto.getChannelSignature()); + if (channel==null||channel.getId()==null){ + return AjaxResult.error("渠道不存在"); + } if (StringUtils.isEmpty(comPublicHalfDto.getData())){ return AjaxResult.error("加密数据不能为空"); } @@ -57,6 +70,7 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService //转化字段未数据库中资质字段 并保存 用户未实名状态 一并保存用户申请记录 未申请状态 Customer customer = new Customer(); BeanUtil.copyProperties(customerInfoDto,customer); + customer.setChannelId(channel.getId()); customer.setActurlName(customerInfoDto.getNameMd5()); customer.setFirstLoginTime(new Date()); customer.setLastLoginTime(new Date()); @@ -68,11 +82,51 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService }else { remoteCustomerService.add(customer,SecurityConstants.INNER); } - //匹配资质 造轮子 返回多个符合的商户 - - + //TODO 暂时不做 目前下游暂时不需要 匹配资质 造轮子 返回多个符合的商户 + List merchants = matchMerchant(customer); //结束返回上游结果 - return null; + Map re = new HashMap<>(); + if (merchants.size()>0){ + re.put("data",true); + return AjaxResult.success(re); + } + re.put("data",false); + return AjaxResult.success(re); + } + + /** + * 获取前筛符合的商户 + * @param customer + */ + private List matchMerchant(Customer customer) { + R> listR = remoteMerchantService.merchantList(SecurityConstants.INNER); + if (listR.getCode()!=200){ + return new ArrayList<>(); + } + List merchants = new ArrayList<>(); + for (Merchant merchant:listR.getData()) { + //限量判定 + R sum = remoteCustomerApplyLogService.sum(merchant.getId(), SecurityConstants.INNER); + if (merchant.getLimitType()==1&&merchant.getLimitNum()<=sum.getData()){ + continue; + } + + if (customer.getAge()merchant.getAgeLimitEnd()){ + continue; + } + if (merchant.getChannelLimitType()==1||merchant.getChannelLimitType()==2){ + + List list = Arrays.asList(merchant.getChannelLimit().split(",")).stream().map(val->Long.parseLong(val)).collect(Collectors.toList()); + if (merchant.getChannelLimitType()==1&& !list.contains(customer.getChannelId())){ + continue; + } + if (merchant.getChannelLimitType()==2&& list.contains(customer.getChannelId())){ + continue; + } + } + merchants.add(merchant); + } + return merchants; } /** diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/ChannelController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/ChannelController.java index 176535ed..6b27b754 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/ChannelController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/ChannelController.java @@ -1,7 +1,6 @@ package com.ruoyi.system.controller; import java.util.List; -import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -15,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.system.domain.Channel; +import com.ruoyi.common.core.domain.http.Channel; import com.ruoyi.system.service.IChannelService; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomerApplyLogController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomerApplyLogController.java index c4a8b8b4..acfbc070 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomerApplyLogController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/CustomerApplyLogController.java @@ -3,15 +3,11 @@ package com.ruoyi.system.controller; import java.util.List; import java.io.IOException; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.domain.R; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; @@ -47,6 +43,18 @@ public class CustomerApplyLogController extends BaseController return getDataTable(list); } + /** + * 获取商户今日已申请数 + * + * + * @param merchantId + * @param source 请求来源 + * @return 结果 + */ + @GetMapping("/log/sum") + public R sum(@PathVariable("merchantId") Long merchantId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source){ + return R.ok(customerApplyLogService.getApplySum(merchantId)); + } /** * 导出客户申请记录列表 */ diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/MerchantController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/MerchantController.java index 4373dfbe..fef624c0 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/MerchantController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/MerchantController.java @@ -1,23 +1,17 @@ package com.ruoyi.system.controller; import java.util.List; -import java.io.IOException; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.common.core.constant.SecurityConstants; +import com.ruoyi.common.core.domain.R; import com.ruoyi.system.service.IChannelService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.log.annotation.Log; import com.ruoyi.common.log.enums.BusinessType; import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.system.domain.Merchant; +import com.ruoyi.common.core.domain.http.Merchant; import com.ruoyi.system.service.IMerchantService; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -52,6 +46,16 @@ public class MerchantController extends BaseController return getDataTable(list); } + /** + * 获取合适的产品 + * + * @return 结果 + */ + @GetMapping("/merchantList") + public R> merchantList(){ + return merchantService.getMerchantList(); + } + /** * 导出商户列表 */ diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Merchant.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Merchant.java deleted file mode 100644 index 809c8ad2..00000000 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/Merchant.java +++ /dev/null @@ -1,642 +0,0 @@ -package com.ruoyi.system.domain; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import com.ruoyi.common.core.annotation.Excel; -import com.ruoyi.common.core.web.domain.BaseEntity; - -/** - * 商户对象 merchant - * - * @author ruoyi - * @date 2024-09-15 - */ -public class Merchant extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** $column.columnComment */ - private Long id; - - /** 商户类型 1H5 2连登 3半流程 4全流程 */ - @Excel(name = "商户类型 1H5 2连登 3半流程 4全流程") - private Long merchantType; - - /** 商户名称 */ - @Excel(name = "商户名称") - private String merchantName; - - /** 商户描述 */ - @Excel(name = "商户描述") - private String merchantDescribe; - - /** 商户主体 */ - @Excel(name = "商户主体") - private String merchantCompany; - - /** logo文件地址 */ - @Excel(name = "logo文件地址") - private Long logo; - - /** 是否上下架 */ - @Excel(name = "是否上下架") - private Long status; - - /** 定量数 */ - @Excel(name = "定量数") - private String limitNum; - - /** 是否定量 0否 1是 */ - @Excel(name = "是否定量 0否 1是") - private Long limitType; - - /** 渠道限制类型 0不限 1准入 2禁入 */ - @Excel(name = "渠道限制类型 0不限 1准入 2禁入") - private Long channelLimitType; - - /** 年龄限制开始 */ - @Excel(name = "年龄限制开始") - private Long ageLimitStart; - - /** 年龄限制结束 */ - @Excel(name = "年龄限制结束") - private Long ageLimitEnd; - - /** 手机号禁入号段英文逗号分隔 */ - @Excel(name = "手机号禁入号段英文逗号分隔") - private String phoneLimit; - - /** 无社保 */ - @Excel(name = "无社保") - private Long socialSecurityNo; - - /** 社保未满6个月 */ - @Excel(name = "社保未满6个月") - private Long socialSecurityLow; - - /** 社保6个月以上 */ - @Excel(name = "社保6个月以上") - private Long socialSecurityHigh; - - /** 无车 */ - @Excel(name = "无车") - private Long carNo; - - /** 有车 */ - @Excel(name = "有车") - private Long carHave; - - /** 保单缴纳不满一年 */ - @Excel(name = "保单缴纳不满一年") - private Long guaranteeSlipLow; - - /** 保单缴纳一年以上 */ - @Excel(name = "保单缴纳一年以上") - private Long guaranteeSlipCentre; - - /** 保单缴纳2年以上 */ - @Excel(name = "保单缴纳2年以上") - private Long guaranteeSlipHigh; - - /** 初中 */ - @Excel(name = "初中") - private Long educationMiddle; - - /** 高中 */ - @Excel(name = "高中") - private Long educationHighSchool; - - /** 中专 */ - @Excel(name = "中专") - private Long educationPolytechnic; - - /** 大专 */ - @Excel(name = "大专") - private Long educationJuniorCollege; - - /** 本科 */ - @Excel(name = "本科") - private Long educationUndergraduateCourse; - - /** 研究生及以上 */ - @Excel(name = "研究生及以上") - private Long educationPostgraduate; - - /** 公积金未满6个月 */ - @Excel(name = "公积金未满6个月") - private Long accumulationFundLow; - - /** 公积金满6个月以上 */ - @Excel(name = "公积金满6个月以上") - private Long accumulationFundHigh; - - /** 本地无房 */ - @Excel(name = "本地无房") - private Long hourseNo; - - /** 本地全款房 */ - @Excel(name = "本地全款房") - private Long hourseFullPayment; - - /** 本地按揭 */ - @Excel(name = "本地按揭") - private Long hourseMortgaging; - - /** 上班族 */ - @Excel(name = "上班族") - private Long officeWorker; - - /** 公务员 */ - @Excel(name = "公务员") - private Long civilServant; - - /** 私营业主 */ - @Excel(name = "私营业主") - private Long privatePropertyOwners; - - /** 个体户 */ - @Excel(name = "个体户") - private Long selfEmployedPerson; - - /** 其他职业 */ - @Excel(name = "其他职业") - private Long otherOccupations; - - /** 花呗5000以下 */ - @Excel(name = "花呗5000以下") - private Long huaBeiLow; - - /** 花呗5000-10000 */ - @Excel(name = "花呗5000-10000") - private Long huaBeiMiddle; - - /** 花呗10000以上 */ - @Excel(name = "花呗10000以上") - private Long huaBeiHigh; - - /** 白条5000以下 */ - @Excel(name = "白条5000以下") - private Long baiTiaoLow; - - /** 白条5000-10000 */ - @Excel(name = "白条5000-10000") - private Long baiTiaoMiddle; - - /** 白条10000以上 */ - @Excel(name = "白条10000以上") - private Long baiTiaoHigh; - - /** 芝麻分 */ - @Excel(name = "芝麻分") - private Long zhiMa; - - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - public void setMerchantType(Long merchantType) - { - this.merchantType = merchantType; - } - - public Long getMerchantType() - { - return merchantType; - } - public void setMerchantName(String merchantName) - { - this.merchantName = merchantName; - } - - public String getMerchantName() - { - return merchantName; - } - public void setMerchantDescribe(String merchantDescribe) - { - this.merchantDescribe = merchantDescribe; - } - - public String getMerchantDescribe() - { - return merchantDescribe; - } - public void setMerchantCompany(String merchantCompany) - { - this.merchantCompany = merchantCompany; - } - - public String getMerchantCompany() - { - return merchantCompany; - } - public void setLogo(Long logo) - { - this.logo = logo; - } - - public Long getLogo() - { - return logo; - } - public void setStatus(Long status) - { - this.status = status; - } - - public Long getStatus() - { - return status; - } - public void setLimitNum(String limitNum) - { - this.limitNum = limitNum; - } - - public String getLimitNum() - { - return limitNum; - } - public void setLimitType(Long limitType) - { - this.limitType = limitType; - } - - public Long getLimitType() - { - return limitType; - } - public void setChannelLimitType(Long channelLimitType) - { - this.channelLimitType = channelLimitType; - } - - public Long getChannelLimitType() - { - return channelLimitType; - } - public void setAgeLimitStart(Long ageLimitStart) - { - this.ageLimitStart = ageLimitStart; - } - - public Long getAgeLimitStart() - { - return ageLimitStart; - } - public void setAgeLimitEnd(Long ageLimitEnd) - { - this.ageLimitEnd = ageLimitEnd; - } - - public Long getAgeLimitEnd() - { - return ageLimitEnd; - } - public void setPhoneLimit(String phoneLimit) - { - this.phoneLimit = phoneLimit; - } - - public String getPhoneLimit() - { - return phoneLimit; - } - public void setSocialSecurityNo(Long socialSecurityNo) - { - this.socialSecurityNo = socialSecurityNo; - } - - public Long getSocialSecurityNo() - { - return socialSecurityNo; - } - public void setSocialSecurityLow(Long socialSecurityLow) - { - this.socialSecurityLow = socialSecurityLow; - } - - public Long getSocialSecurityLow() - { - return socialSecurityLow; - } - public void setSocialSecurityHigh(Long socialSecurityHigh) - { - this.socialSecurityHigh = socialSecurityHigh; - } - - public Long getSocialSecurityHigh() - { - return socialSecurityHigh; - } - public void setCarNo(Long carNo) - { - this.carNo = carNo; - } - - public Long getCarNo() - { - return carNo; - } - public void setCarHave(Long carHave) - { - this.carHave = carHave; - } - - public Long getCarHave() - { - return carHave; - } - public void setGuaranteeSlipLow(Long guaranteeSlipLow) - { - this.guaranteeSlipLow = guaranteeSlipLow; - } - - public Long getGuaranteeSlipLow() - { - return guaranteeSlipLow; - } - public void setGuaranteeSlipCentre(Long guaranteeSlipCentre) - { - this.guaranteeSlipCentre = guaranteeSlipCentre; - } - - public Long getGuaranteeSlipCentre() - { - return guaranteeSlipCentre; - } - public void setGuaranteeSlipHigh(Long guaranteeSlipHigh) - { - this.guaranteeSlipHigh = guaranteeSlipHigh; - } - - public Long getGuaranteeSlipHigh() - { - return guaranteeSlipHigh; - } - public void setEducationMiddle(Long educationMiddle) - { - this.educationMiddle = educationMiddle; - } - - public Long getEducationMiddle() - { - return educationMiddle; - } - public void setEducationHighSchool(Long educationHighSchool) - { - this.educationHighSchool = educationHighSchool; - } - - public Long getEducationHighSchool() - { - return educationHighSchool; - } - public void setEducationPolytechnic(Long educationPolytechnic) - { - this.educationPolytechnic = educationPolytechnic; - } - - public Long getEducationPolytechnic() - { - return educationPolytechnic; - } - public void setEducationJuniorCollege(Long educationJuniorCollege) - { - this.educationJuniorCollege = educationJuniorCollege; - } - - public Long getEducationJuniorCollege() - { - return educationJuniorCollege; - } - public void setEducationUndergraduateCourse(Long educationUndergraduateCourse) - { - this.educationUndergraduateCourse = educationUndergraduateCourse; - } - - public Long getEducationUndergraduateCourse() - { - return educationUndergraduateCourse; - } - public void setEducationPostgraduate(Long educationPostgraduate) - { - this.educationPostgraduate = educationPostgraduate; - } - - public Long getEducationPostgraduate() - { - return educationPostgraduate; - } - public void setAccumulationFundLow(Long accumulationFundLow) - { - this.accumulationFundLow = accumulationFundLow; - } - - public Long getAccumulationFundLow() - { - return accumulationFundLow; - } - public void setAccumulationFundHigh(Long accumulationFundHigh) - { - this.accumulationFundHigh = accumulationFundHigh; - } - - public Long getAccumulationFundHigh() - { - return accumulationFundHigh; - } - public void setHourseNo(Long hourseNo) - { - this.hourseNo = hourseNo; - } - - public Long getHourseNo() - { - return hourseNo; - } - public void setHourseFullPayment(Long hourseFullPayment) - { - this.hourseFullPayment = hourseFullPayment; - } - - public Long getHourseFullPayment() - { - return hourseFullPayment; - } - public void setHourseMortgaging(Long hourseMortgaging) - { - this.hourseMortgaging = hourseMortgaging; - } - - public Long getHourseMortgaging() - { - return hourseMortgaging; - } - public void setOfficeWorker(Long officeWorker) - { - this.officeWorker = officeWorker; - } - - public Long getOfficeWorker() - { - return officeWorker; - } - public void setCivilServant(Long civilServant) - { - this.civilServant = civilServant; - } - - public Long getCivilServant() - { - return civilServant; - } - public void setPrivatePropertyOwners(Long privatePropertyOwners) - { - this.privatePropertyOwners = privatePropertyOwners; - } - - public Long getPrivatePropertyOwners() - { - return privatePropertyOwners; - } - public void setSelfEmployedPerson(Long selfEmployedPerson) - { - this.selfEmployedPerson = selfEmployedPerson; - } - - public Long getSelfEmployedPerson() - { - return selfEmployedPerson; - } - public void setOtherOccupations(Long otherOccupations) - { - this.otherOccupations = otherOccupations; - } - - public Long getOtherOccupations() - { - return otherOccupations; - } - public void setHuaBeiLow(Long huaBeiLow) - { - this.huaBeiLow = huaBeiLow; - } - - public Long getHuaBeiLow() - { - return huaBeiLow; - } - public void setHuaBeiMiddle(Long huaBeiMiddle) - { - this.huaBeiMiddle = huaBeiMiddle; - } - - public Long getHuaBeiMiddle() - { - return huaBeiMiddle; - } - public void setHuaBeiHigh(Long huaBeiHigh) - { - this.huaBeiHigh = huaBeiHigh; - } - - public Long getHuaBeiHigh() - { - return huaBeiHigh; - } - public void setBaiTiaoLow(Long baiTiaoLow) - { - this.baiTiaoLow = baiTiaoLow; - } - - public Long getBaiTiaoLow() - { - return baiTiaoLow; - } - public void setBaiTiaoMiddle(Long baiTiaoMiddle) - { - this.baiTiaoMiddle = baiTiaoMiddle; - } - - public Long getBaiTiaoMiddle() - { - return baiTiaoMiddle; - } - public void setBaiTiaoHigh(Long baiTiaoHigh) - { - this.baiTiaoHigh = baiTiaoHigh; - } - - public Long getBaiTiaoHigh() - { - return baiTiaoHigh; - } - public void setZhiMa(Long zhiMa) - { - this.zhiMa = zhiMa; - } - - public Long getZhiMa() - { - return zhiMa; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("merchantType", getMerchantType()) - .append("merchantName", getMerchantName()) - .append("merchantDescribe", getMerchantDescribe()) - .append("merchantCompany", getMerchantCompany()) - .append("logo", getLogo()) - .append("status", getStatus()) - .append("limitNum", getLimitNum()) - .append("limitType", getLimitType()) - .append("channelLimitType", getChannelLimitType()) - .append("ageLimitStart", getAgeLimitStart()) - .append("ageLimitEnd", getAgeLimitEnd()) - .append("phoneLimit", getPhoneLimit()) - .append("socialSecurityNo", getSocialSecurityNo()) - .append("socialSecurityLow", getSocialSecurityLow()) - .append("socialSecurityHigh", getSocialSecurityHigh()) - .append("carNo", getCarNo()) - .append("carHave", getCarHave()) - .append("guaranteeSlipLow", getGuaranteeSlipLow()) - .append("guaranteeSlipCentre", getGuaranteeSlipCentre()) - .append("guaranteeSlipHigh", getGuaranteeSlipHigh()) - .append("educationMiddle", getEducationMiddle()) - .append("educationHighSchool", getEducationHighSchool()) - .append("educationPolytechnic", getEducationPolytechnic()) - .append("educationJuniorCollege", getEducationJuniorCollege()) - .append("educationUndergraduateCourse", getEducationUndergraduateCourse()) - .append("educationPostgraduate", getEducationPostgraduate()) - .append("accumulationFundLow", getAccumulationFundLow()) - .append("accumulationFundHigh", getAccumulationFundHigh()) - .append("hourseNo", getHourseNo()) - .append("hourseFullPayment", getHourseFullPayment()) - .append("hourseMortgaging", getHourseMortgaging()) - .append("officeWorker", getOfficeWorker()) - .append("civilServant", getCivilServant()) - .append("privatePropertyOwners", getPrivatePropertyOwners()) - .append("selfEmployedPerson", getSelfEmployedPerson()) - .append("otherOccupations", getOtherOccupations()) - .append("huaBeiLow", getHuaBeiLow()) - .append("huaBeiMiddle", getHuaBeiMiddle()) - .append("huaBeiHigh", getHuaBeiHigh()) - .append("baiTiaoLow", getBaiTiaoLow()) - .append("baiTiaoMiddle", getBaiTiaoMiddle()) - .append("baiTiaoHigh", getBaiTiaoHigh()) - .append("zhiMa", getZhiMa()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("remark", getRemark()) - .toString(); - } -} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java index 0d0b2835..b948b0a9 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/ChannelMapper.java @@ -1,7 +1,10 @@ package com.ruoyi.system.mapper; import java.util.List; -import com.ruoyi.system.domain.Channel; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.domain.http.Channel; +import com.ruoyi.system.domain.CustomerApplyLog; /** * 渠道配置Mapper接口 @@ -9,7 +12,7 @@ import com.ruoyi.system.domain.Channel; * @author ruoyi * @date 2024-09-15 */ -public interface ChannelMapper +public interface ChannelMapper extends BaseMapper { /** * 查询渠道配置 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CustomerApplyLogMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CustomerApplyLogMapper.java index 23c46394..d03ee464 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CustomerApplyLogMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/CustomerApplyLogMapper.java @@ -1,6 +1,9 @@ package com.ruoyi.system.mapper; import java.util.List; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.domain.http.Merchant; import com.ruoyi.system.domain.CustomerApplyLog; /** @@ -9,7 +12,7 @@ import com.ruoyi.system.domain.CustomerApplyLog; * @author ruoyi * @date 2024-09-15 */ -public interface CustomerApplyLogMapper +public interface CustomerApplyLogMapper extends BaseMapper { /** * 查询客户申请记录 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantMapper.java index 997cf505..990308fe 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/mapper/MerchantMapper.java @@ -1,7 +1,10 @@ package com.ruoyi.system.mapper; import java.util.List; -import com.ruoyi.system.domain.Merchant; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.common.core.domain.http.Customer; +import com.ruoyi.common.core.domain.http.Merchant; /** * 商户Mapper接口 @@ -9,7 +12,7 @@ import com.ruoyi.system.domain.Merchant; * @author ruoyi * @date 2024-09-15 */ -public interface MerchantMapper +public interface MerchantMapper extends BaseMapper { /** * 查询商户 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IChannelService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IChannelService.java index 6f48263c..6b6b4b8a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IChannelService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IChannelService.java @@ -1,7 +1,7 @@ package com.ruoyi.system.service; import java.util.List; -import com.ruoyi.system.domain.Channel; +import com.ruoyi.common.core.domain.http.Channel; /** * 渠道配置Service接口 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomerApplyLogService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomerApplyLogService.java index 18342d31..e47be17a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomerApplyLogService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/ICustomerApplyLogService.java @@ -1,6 +1,8 @@ package com.ruoyi.system.service; import java.util.List; + +import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.system.domain.CustomerApplyLog; /** @@ -9,7 +11,7 @@ import com.ruoyi.system.domain.CustomerApplyLog; * @author ruoyi * @date 2024-09-15 */ -public interface ICustomerApplyLogService +public interface ICustomerApplyLogService extends IService { /** * 查询客户申请记录 @@ -58,4 +60,11 @@ public interface ICustomerApplyLogService * @return 结果 */ public int deleteCustomerApplyLogById(Long id); + + /** + * 获取当日商户已申请数 + * @param merchantId + * @return + */ + Integer getApplySum(Long merchantId); } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IMerchantService.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IMerchantService.java index d42bd871..8a5407e1 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IMerchantService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/IMerchantService.java @@ -1,7 +1,11 @@ package com.ruoyi.system.service; import java.util.List; -import com.ruoyi.system.domain.Merchant; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Customer; +import com.ruoyi.common.core.domain.http.Merchant; /** * 商户Service接口 @@ -9,7 +13,7 @@ import com.ruoyi.system.domain.Merchant; * @author ruoyi * @date 2024-09-15 */ -public interface IMerchantService +public interface IMerchantService extends IService { /** * 查询商户 @@ -58,4 +62,11 @@ public interface IMerchantService * @return 结果 */ public int deleteMerchantById(Long id); + + /** + * 获取基本合适的商户 + * @return + */ + R> getMerchantList(); + } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java index 8a08bb1d..45ae1297 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ChannelServiceImpl.java @@ -11,7 +11,7 @@ import org.apache.commons.lang3.RandomStringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; -import com.ruoyi.system.domain.Channel; +import com.ruoyi.common.core.domain.http.Channel; import com.ruoyi.system.service.IChannelService; import org.springframework.transaction.annotation.Transactional; diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomerApplyLogServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomerApplyLogServiceImpl.java index cb663509..40803ee3 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomerApplyLogServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CustomerApplyLogServiceImpl.java @@ -1,7 +1,12 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.LocalDateTimeUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.CustomerApplyLogMapper; @@ -15,7 +20,7 @@ import com.ruoyi.system.service.ICustomerApplyLogService; * @date 2024-09-15 */ @Service -public class CustomerApplyLogServiceImpl implements ICustomerApplyLogService +public class CustomerApplyLogServiceImpl extends ServiceImpl implements IService,ICustomerApplyLogService { @Autowired private CustomerApplyLogMapper customerApplyLogMapper; @@ -93,4 +98,20 @@ public class CustomerApplyLogServiceImpl implements ICustomerApplyLogService { return customerApplyLogMapper.deleteCustomerApplyLogById(id); } + + /** + * 获取当日商户已申请数 + * @param merchantId + * @return + */ + @Override + public Integer getApplySum(Long merchantId) { + Long aLong = customerApplyLogMapper.selectCount( + new LambdaQueryWrapper() + .eq(CustomerApplyLog::getMerchantId, merchantId) + .eq(CustomerApplyLog::getOrderStatus, 0) + .ge(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayStartTime())) + .le(CustomerApplyLog::getCreateTime, LocalDateTimeUtils.getDateFromLocalDateTime(LocalDateTimeUtils.getTodayEndTime()))); + return aLong.intValue(); + } } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantServiceImpl.java index d23f6794..babbb8dc 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/MerchantServiceImpl.java @@ -1,11 +1,19 @@ package com.ruoyi.system.service.impl; import java.util.List; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.domain.http.Customer; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.system.mapper.CustomerMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.system.mapper.MerchantMapper; -import com.ruoyi.system.domain.Merchant; +import com.ruoyi.common.core.domain.http.Merchant; import com.ruoyi.system.service.IMerchantService; /** @@ -15,7 +23,7 @@ import com.ruoyi.system.service.IMerchantService; * @date 2024-09-15 */ @Service -public class MerchantServiceImpl implements IMerchantService +public class MerchantServiceImpl extends ServiceImpl implements IService,IMerchantService { @Autowired private MerchantMapper merchantMapper; @@ -93,4 +101,17 @@ public class MerchantServiceImpl implements IMerchantService { return merchantMapper.deleteMerchantById(id); } + + /** + * 获取基本合适的商户 + * @return + */ + @Override + public R> getMerchantList() { + List merchants = merchantMapper.selectList(new LambdaQueryWrapper().eq(Merchant::getStatus, true)); + if (CollectionUtil.isEmpty(merchants)){ + return R.fail(); + } + return R.ok(merchants); + } } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/ChannelMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/ChannelMapper.xml index f8c278a8..36507402 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/ChannelMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/ChannelMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -24,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, channel_name, channel_sign from channel - and channel_name like concat('%', #{channelName}, '%') @@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} - + insert into channel channel_name, @@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + update channel channel_name = #{channelName}, diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/MerchantMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/MerchantMapper.xml index 5e0445d1..87f47ef7 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/MerchantMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/MerchantMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -58,7 +58,7 @@ select id, merchant_type, merchant_name, merchant_describe, merchant_company, logo, status, limit_num, limit_type, channel_limit_type, age_limit_start, age_limit_end, phone_limit, social_security_no, social_security_low, social_security_high, car_no, car_have, guarantee_slip_low, guarantee_slip_centre, guarantee_slip_high, education_middle, education_high_school, education_polytechnic, education_junior_college, education_undergraduate_course, education_postgraduate, accumulation_fund_low, accumulation_fund_high, hourse_no, hourse_full_payment, hourse_mortgaging, office_worker, civil_servant, private_property_owners, self_employed_person, other_occupations, hua_bei_low, hua_bei_middle, hua_bei_high, bai_tiao_low, bai_tiao_middle, bai_tiao_high, zhi_ma, create_time, update_time, remark from merchant - and merchant_type = #{merchantType} @@ -112,7 +112,7 @@ where id = #{id} - + insert into merchant merchant_type, @@ -212,7 +212,7 @@ - + update merchant merchant_type = #{merchantType},