
19 changed files with 1027 additions and 26 deletions
@ -0,0 +1,44 @@ |
|||
package com.yxt.anrui.base.api.commoncontract; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@ApiModel("新车买卖合同条件") |
|||
@Data |
|||
public class xcmmContractQuery implements Query { |
|||
|
|||
@ApiModelProperty("合同sid") |
|||
private String contractSid; |
|||
|
|||
@ApiModelProperty("合同编号") |
|||
private String contractNo; |
|||
|
|||
@ApiModelProperty("销售订单sid") |
|||
private String saleOrderSid; |
|||
|
|||
@ApiModelProperty("客户sid") |
|||
private String customerSid; |
|||
|
|||
@ApiModelProperty("客户名称") |
|||
private String customerName; |
|||
|
|||
@ApiModelProperty("是否优惠:1是0否") |
|||
private String discountKey; |
|||
|
|||
@ApiModelProperty("是否在保险公司购买保险:1是0否") |
|||
private String insuranceKey; |
|||
|
|||
@ApiModelProperty("用户sid") |
|||
private String userSid; |
|||
|
|||
@ApiModelProperty("甲方主体") |
|||
private String partyA; |
|||
|
|||
@ApiModelProperty("乙方主体") |
|||
private String partyB; |
|||
|
|||
@ApiModelProperty("预估报价方案") |
|||
private String revalencySchemeKey; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.HashSet; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
* @description |
|||
* @date 2023/11/7 11:19 |
|||
*/ |
|||
@Data |
|||
public class ScanRepaymentVo { |
|||
|
|||
private String sid; |
|||
private String sendSid; |
|||
private String staffSid; |
|||
private String mainStartDate; |
|||
private String borrowerSid; |
|||
private String mainPeriod; |
|||
private String otherPeriod; |
|||
private String otherStartDate; |
|||
private String borrowerName; |
|||
HashSet<String> hashSet = new HashSet<>(); |
|||
} |
@ -0,0 +1,217 @@ |
|||
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule; |
|||
|
|||
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|||
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerDetailsVo; |
|||
import com.yxt.anrui.buscenter.api.bussalesorderborrower.BusSalesOrderBorrowerFeign; |
|||
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|||
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|||
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|||
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|||
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|||
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentSchedule; |
|||
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.ScanRepaymentVo; |
|||
import com.yxt.anrui.riskcenter.api.loanwarrantinformation.LoanWarrantInformation; |
|||
import com.yxt.anrui.riskcenter.biz.loanwarrantinformation.LoanWarrantInformationService; |
|||
import com.yxt.common.base.utils.MsgWs; |
|||
import com.yxt.common.base.utils.StringUtils; |
|||
import com.yxt.messagecenter.api.message.MessageFeign; |
|||
import com.yxt.messagecenter.api.message.MessagePushTransferDto; |
|||
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.scheduling.annotation.Scheduled; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.*; |
|||
import java.util.concurrent.*; |
|||
|
|||
/** |
|||
* @author Administrator |
|||
* @description |
|||
* @date 2023/11/7 14:02 |
|||
*/ |
|||
@Component |
|||
public class ScheduledRepaymentService { |
|||
|
|||
@Autowired |
|||
private LoanRepaymentScheduleService loanRepaymentScheduleService; |
|||
@Autowired |
|||
private SysUserFeign sysUserFeign; |
|||
@Autowired |
|||
private MessageFeign messageFeign; |
|||
@Autowired |
|||
private BusSalesOrderBorrowerFeign busSalesOrderBorrowerFeign; |
|||
@Autowired |
|||
private CrmCustomerTempFeign crmCustomerTempFeign; |
|||
@Autowired |
|||
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|||
@Autowired |
|||
private LoanWarrantInformationService loanWarrantInformationService; |
|||
|
|||
/** |
|||
* 定时任务每天扫描还款日期发送信息 |
|||
*/ |
|||
//@Scheduled(cron = "0 0 0 * * ?")
|
|||
// @Scheduled(cron = "0 0/5 16 * * ?")
|
|||
// @Scheduled(cron = "0/30 * * * * ?") //每30秒执行一次
|
|||
// @Scheduled(cron = "0 0/5 * * * ?")
|
|||
public void scanRepayment() { |
|||
List<ScanRepaymentVo> schedules = loanRepaymentScheduleService.scanRepaymentVos(); |
|||
schedules.removeAll(Collections.singleton(null)); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|||
String formatDate = sdf.format(new Date()); |
|||
if (!schedules.isEmpty()) { |
|||
for (ScanRepaymentVo entity : schedules) { |
|||
HashSet<String> hashSet = new HashSet<>(); |
|||
List<String> mainList = new ArrayList<>(); |
|||
if (StringUtils.isNotBlank(entity.getMainStartDate())) { |
|||
String mainStartDate = entity.getMainStartDate(); |
|||
String mainPeriod = entity.getMainPeriod(); |
|||
mainList = loanRepaymentScheduleService.returnDayList(mainStartDate, mainPeriod); |
|||
} |
|||
List<String> otherList = new ArrayList<>(); |
|||
if (StringUtils.isNotBlank(entity.getOtherStartDate())) { |
|||
String otherStartDate = entity.getOtherStartDate(); |
|||
String otherPeriod = entity.getOtherPeriod(); |
|||
otherList = loanRepaymentScheduleService.returnDayList(otherStartDate, otherPeriod); |
|||
} |
|||
mainList.addAll(otherList); |
|||
if (!mainList.isEmpty()) { |
|||
for (String s : mainList) { |
|||
hashSet.add(s); |
|||
} |
|||
entity.setHashSet(hashSet); |
|||
} |
|||
if (hashSet.contains(formatDate)) { |
|||
LoanRepaymentSchedule schedule = loanRepaymentScheduleService.fetchBySid(entity.getSid()); |
|||
if (null != schedule) { |
|||
String vinNo = ""; |
|||
String customerPhone = ""; |
|||
String month = ""; |
|||
String day = ""; |
|||
String period = ""; |
|||
String customer = ""; |
|||
String staffSid = ""; |
|||
String sendSid = ""; |
|||
String sendName = ""; |
|||
String staffName = ""; |
|||
String sendDept = ""; |
|||
String sendDeptSid = ""; |
|||
String vinMark = ""; |
|||
StringBuffer sbVinMark = new StringBuffer(); |
|||
if (StringUtils.isNotBlank(schedule.getCreateBySid())) { |
|||
sendSid = schedule.getCreateBySid(); |
|||
SysUserVo userVo = sysUserFeign.fetchBySid(sendSid).getData(); |
|||
if (null != userVo) { |
|||
sendName = userVo.getName(); |
|||
sendDept = userVo.getOrganizationName(); |
|||
sendDeptSid = userVo.getOrganizationSid(); |
|||
} |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getStaffSid())) { |
|||
staffSid = schedule.getStaffSid(); |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getStaffName())) { |
|||
staffName = schedule.getStaffName(); |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getBorrowerName())) { |
|||
customer = schedule.getBorrowerName(); |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getMainPeriod())) { |
|||
period = schedule.getMainPeriod(); |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getVinNo())) { |
|||
vinNo = schedule.getVinNo(); |
|||
} |
|||
if (StringUtils.isNotBlank(schedule.getBorrowerSid())) { |
|||
String borrowerSid = schedule.getBorrowerSid(); |
|||
BusSalesOrderBorrowerDetailsVo borrowerDetailsVo = busSalesOrderBorrowerFeign.fetchDetailsBySid(borrowerSid).getData(); |
|||
if (null != borrowerDetailsVo) { |
|||
if (StringUtils.isNotBlank(borrowerDetailsVo.getCustomSid())) { |
|||
CrmCustomerTempVo customerTempVo = crmCustomerTempFeign.fetchSid(borrowerDetailsVo.getCustomSid()).getData(); |
|||
if (null != customerTempVo) { |
|||
if (StringUtils.isNotBlank(customerTempVo.getMobile())) { |
|||
customerPhone = customerTempVo.getMobile(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
String salesOrderSid = schedule.getSalesOrderSid(); |
|||
List<BusSalesOrderVehicle> orderVehicles = busSalesOrderVehicleFeign.selectListByOrderSidAndDkrSid(salesOrderSid, borrowerSid).getData(); |
|||
if (!orderVehicles.isEmpty()) { |
|||
for (BusSalesOrderVehicle orderVehicle : orderVehicles) { |
|||
LoanWarrantInformation loanWarrantInformation = loanWarrantInformationService.fetchByBusVinSid(orderVehicle.getSid()); |
|||
if (null != loanWarrantInformation) { |
|||
if (StringUtils.isNotBlank(loanWarrantInformation.getVehicleMark())) { |
|||
sbVinMark.append(loanWarrantInformation.getVehicleMark()).append(","); |
|||
} |
|||
} |
|||
} |
|||
if (sbVinMark.length() > 0) { |
|||
sbVinMark.delete(sbVinMark.length() - 1, sbVinMark.length()); |
|||
vinMark = sbVinMark.toString(); |
|||
} |
|||
} |
|||
} |
|||
String afterThreeDay = loanRepaymentScheduleService.afterThreeDay(formatDate); |
|||
if (StringUtils.isNotBlank(afterThreeDay)) { |
|||
String[] split = afterThreeDay.split("-"); |
|||
String sMonth = split[1]; |
|||
String sDay = split[2]; |
|||
if (Integer.parseInt(sMonth) < 10) { |
|||
sMonth = sMonth.replace("0", ""); |
|||
} |
|||
if (Integer.parseInt(sDay) < 10) { |
|||
sDay = sDay.replace("0", ""); |
|||
} |
|||
month = sMonth; |
|||
day = sDay; |
|||
} |
|||
String contentCustomer = "尊敬的客户:您的车牌号为" + vinMark + "车辆,还款日为" + month + "月" + day + "日,请及时还款。"; |
|||
String res = MsgWs.SendWaitWorkMsg(customerPhone, contentCustomer); |
|||
System.out.println("还款发送短信:" + res); |
|||
System.out.println(contentCustomer); |
|||
if (StringUtils.isNotBlank(entity.getMainStartDate())) { |
|||
String beforeThreeDay = loanRepaymentScheduleService.beforeThreeDay(entity.getMainStartDate()); |
|||
if (beforeThreeDay.equals(formatDate)) { |
|||
String m = ""; |
|||
String d = ""; |
|||
String[] split = entity.getMainStartDate().split("-"); |
|||
String fmonth = split[1]; |
|||
String fday = split[2]; |
|||
if (Integer.parseInt(fmonth) < 10) { |
|||
m = fmonth.replace("0", ""); |
|||
} else { |
|||
m = fmonth; |
|||
} |
|||
if (Integer.parseInt(fday) < 10) { |
|||
d = fday.replace("0", ""); |
|||
} else { |
|||
d = fday; |
|||
} |
|||
String contentStaff = "您的贷款客户" + customer + "的车辆首期还款日为" + m + "月" + d + "日,请及时提醒客户。"; |
|||
System.out.println(contentStaff); |
|||
//消息推送
|
|||
MessagePushTransferDto messagePushTransferDto = new MessagePushTransferDto(); |
|||
messagePushTransferDto.setMsgTypeSid("bc59c198-2d51-458f-913e-cbd8d7ef4799"); |
|||
messagePushTransferDto.setMsgType("业务"); |
|||
messagePushTransferDto.setMsgTitle("提醒客户还款"); |
|||
messagePushTransferDto.setMsgContent(contentStaff); |
|||
messagePushTransferDto.setMsgSource("还款计划表"); |
|||
messagePushTransferDto.setSenderSid(sendSid); |
|||
messagePushTransferDto.setSenderName(sendName); |
|||
messagePushTransferDto.setSenderDeptSid(sendDeptSid); |
|||
messagePushTransferDto.setSenderDeptName(sendDept); |
|||
messagePushTransferDto.setBusinessSid(schedule.getSid()); |
|||
messagePushTransferDto.setReceiveSids(staffSid); |
|||
messagePushTransferDto.setReceiveNames(staffName); |
|||
messageFeign.pushTransferMessage(messagePushTransferDto); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue