package com.hzqianren.qilun.dao.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzqianren.common.exception.AppServiceException;
import com.hzqianren.common.model.baseEntity.QlUserInfo;
import com.hzqianren.common.model.dto.Result;
import com.hzqianren.common.util.other.oConvertUtils;
import com.hzqianren.qilun.dao.entity.BaseDataPro;
import com.hzqianren.qilun.dao.entity.QlVehicleValuation;
import com.hzqianren.qilun.dao.mapper.QlVehicleValuationMapper;
import com.hzqianren.qilun.dao.service.IBaseDataProService;
import com.hzqianren.qilun.dao.service.QlUserInfoService;
import com.hzqianren.qilun.dao.service.QlVehicleValuationService;
import com.hzqianren.util.SecurityUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Service
@Slf4j
public class QlVehicleValuationServiceImpl extends ServiceImpl<QlVehicleValuationMapper, QlVehicleValuation> implements QlVehicleValuationService {
@Autowired
private QlVehicleValuationMapper qlVehicleValuationMapper;
@Autowired
private SecurityUtil securityUtil;
@Autowired
private QlUserInfoService qlUserInfoService;
//4.2米轻卡
private static final double lightTruck = 150000.00;
//3.6米小卡
private static final double cam = 90000.00;
//7.8方轻客
private static final double lightPassenger = 95000.00;
//6方微面
private static final double sixMicroplane = 80000.00;
//5方微面
private static final double fiveMicroplane = 70000.00;
//4方微面
private static final double fourMicroplane = 60000.00;
//三万公里
private static final BigDecimal threeMileage = new BigDecimal(30000);
//六万公里
private static final BigDecimal sixMileage = new BigDecimal(60000);
//十万公里
private static final BigDecimal tenMileage = new BigDecimal(100000);
//十五万公里
private static final BigDecimal fifteenMileage = new BigDecimal(150000);
//二十万公里
private static final BigDecimal twentyMileage = new BigDecimal(200000);
private static final String A = "A";
private static final String B = "B";
private static final String C = "C";
private static final String D = "D";
/**
* 车辆估值
*
* @param qlVehicleValuation
* @return
*/
@Override
public Result beenUndervalued(QlVehicleValuation qlVehicleValuation) {
if (qlVehicleValuation == null) {
throw new RuntimeException("传入参数有误");
}
// qlVehicleValuationMapper.insert(qlVehicleValuation);
Integer userId = securityUtil.getUserDO().getId();
qlVehicleValuation.setUserId(userId);
QlUserInfo qlUserInfo = qlUserInfoService.getByUserId(userId);
if (qlUserInfo==null){
throw new AppServiceException(201,"用户未认证,无法获取公司名称");
}
qlVehicleValuation.setCompanyName(qlUserInfo.getFirmName());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date firstRegistration = null;
try {
firstRegistration = simpleDateFormat.parse(qlVehicleValuation.getLicensingTime());
} catch (ParseException e) {
e.printStackTrace();
}
//免费估值或置换估值
if (qlVehicleValuation.getType().equals(1) || qlVehicleValuation.getType().equals(3)) {
return freeVehicleValuation(qlVehicleValuation);
//// simpleDateFormat.format(firstRegistration);
// long begin = firstRegistration.getTime();
// Date date = new Date();
// long end = date.getTime();
// long l = (end - begin) / 1000 / (24 * 3600) / 365;
// String s = String.valueOf(l);
// Integer integer = Integer.valueOf(s);
// if (l > 10) {
// return Result.ok(20000);
// }
// //第一年折旧率
// double one = 20 * (1 - 0.15);
// //第二年折旧率
// double two = one * (1 - 0.12);
// //第三年折旧率
// double three = two * (1 - 0.1);
// //第四年折旧率
// double four = three * (1 - 0.08);
// //第五年折旧率
// double five = four * (1 - 0.07);
// if (5 <= l && l <= 10) {
// switch (integer) {
// case 1:
// qlVehicleValuation.setEstimatedPrice(one);
// qlVehicleValuationMapper.insert(qlVehicleValuation);
// return Result.ok(one);
// case 2:
// qlVehicleValuation.setEstimatedPrice(two);
// qlVehicleValuationMapper.insert(qlVehicleValuation);
// return Result.ok(two);
// case 3:
// qlVehicleValuation.setEstimatedPrice(three);
// qlVehicleValuationMapper.insert(qlVehicleValuation);
// return Result.ok(three);
// case 4:
// qlVehicleValuation.setEstimatedPrice(four);
// qlVehicleValuationMapper.insert(qlVehicleValuation);
// return Result.ok(four);
// case 5:
// qlVehicleValuation.setEstimatedPrice(five);
// qlVehicleValuationMapper.insert(qlVehicleValuation);
// return Result.ok(five);
// }
// }
// qlVehicleValuation.setEstimatedPrice(1D);
// return Result.ok(qlVehicleValuation);
//上门估值
} else if (qlVehicleValuation.getType().equals(2)){
String addressDetail = qlVehicleValuation.getAddressDetail();
if(StringUtils.isEmpty(addressDetail)){
throw new RuntimeException("详细地址不能为空");
}
int insert = qlVehicleValuationMapper.insert(qlVehicleValuation);
return Result.ok("提交成功,等待系统人员与您联系");
}
return Result.ok();
}
@Autowired
private IBaseDataProService baseDataProService;
/**
* 免费估值
* @param qlVehicleValuation
* @return
*/
private Result freeVehicleValuation(QlVehicleValuation qlVehicleValuation) {
List<BaseDataPro> list = baseDataProService.selectType();
for (BaseDataPro baseDataPro : list) {
log.info("车型{}",baseDataPro.getKeyStr());
}
log.info("4.2米轻卡{}",list.get(0).getKeyStr());
if(list.get(0).getKeyStr().equals(qlVehicleValuation.getModel())){
//计算4.2米轻卡的价格
double sumNum = calculationLightTruckMoney(qlVehicleValuation);
qlVehicleValuation.setEstimatedPrice(sumNum);
qlVehicleValuationMapper.insert(qlVehicleValuation);
return Result.ok(qlVehicleValuation);
}
if(list.get(1).getKeyStr().equals(qlVehicleValuation.getModel())){
//计算3.6米小卡价格
double sumNum = calculationCamMoney(qlVehicleValuation);
qlVehicleValuation.setEstimatedPrice(sumNum);
qlVehicleValuationMapper.insert(qlVehicleValuation);
return Result.ok(qlVehicleValuation);
// return calculationCamMoney(qlVehicleValuation);
}
if(list.get(2).getKeyStr().equals(qlVehicleValuation.getModel()
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本项目是一款采用Java语言开发的千仞二手车管理系统源代码,整体包含775个文件,其中包括690个Java源文件、66个XML配置文件、7个YAML文件、5个文本文件、3个FreeMarker模板文件、2个Git忽略文件、1个classpath文件以及1个SQL文件。该系统功能完善,适用于二手车管理领域。
资源推荐
资源详情
资源评论
收起资源包目录
基于Java语言的千仞二手车管理系统设计源码 (776个子文件)
.classpath 1020B
chatingRoom.ftl 16KB
pdfPreviewIframe.ftl 1KB
demo3.ftl 272B
.gitignore 47B
.gitignore 9B
QlVehicleValuationServiceImpl.java 34KB
AdminDashboardController.java 33KB
QlNewCarOrderServiceImpl.java 31KB
SysUserController.java 28KB
WXPay.java 26KB
SysPermissionController.java 24KB
ExcelUtils.java 20KB
ExcelUtils.java 19KB
QueryGenerator.java 18KB
QueryGenerator.java 18KB
DateUtils.java 18KB
QIUserApiController.java 17KB
UserImportExcelDTO.java 16KB
AdminCarDOController.java 16KB
oConvertUtils.java 15KB
UserServiceImpl.java 15KB
SysRoleController.java 15KB
AdminHomeServiceImpl.java 15KB
FaceUtil.java 14KB
QlFinancialManagementController.java 14KB
AdminDistributorDOController.java 14KB
AdminUserInfoDOController.java 13KB
ElectronicSignatureUtil.java 12KB
RedisUtil.java 12KB
QIBuyCarPlanController.java 12KB
AdminHomeController.java 12KB
CarOrderDOServiceImpl.java 12KB
UserCvCopyDO.java 11KB
AdminCarOrderDOController.java 11KB
QICarDOController.java 11KB
WXPayReport.java 11KB
SysAnnouncementController.java 11KB
SMSUtil.java 11KB
CarDOServiceImpl.java 10KB
WXPayRequest.java 10KB
QIBaseDataProController.java 10KB
QIResidualValueDOController.java 10KB
QIDistributorDOController.java 10KB
AdminBaseDataProController.java 10KB
QlReplaceNewCarServiceImpl.java 10KB
WXPayUtil.java 10KB
DistributorDOServiceImpl.java 10KB
SysAnnouncementSendController.java 10KB
AdminQlReplaceNewCarController.java 9KB
QIBaseDataDOController.java 9KB
AdminBaseDataDOController.java 9KB
AdminCarImgDOController.java 9KB
QICarOrderDOController.java 9KB
JobImportExcelDTO.java 9KB
AdminUserDOController.java 9KB
QRCodeUtils.java 9KB
QICarImgDOController.java 9KB
SysDepartServiceImpl.java 8KB
QlReplaceOldCarServiceImpl.java 8KB
SysUserServiceImpl.java 8KB
SysDictController.java 8KB
TencentUploadCommon.java 8KB
SysDepartTreeModel.java 8KB
SysPermissionServiceImpl.java 8KB
MsgReplyServiceImpl.java 8KB
WxUserServiceImpl.java 8KB
CarDO.java 8KB
AdminPlanController.java 8KB
VedioUtil.java 8KB
QlReplaceOldCar.java 8KB
AdminResidualValueDOController.java 7KB
SysDepartController.java 7KB
ShiroConfig.java 7KB
NameBuilder.java 7KB
SysPermissionTree.java 7KB
QuartzJobController.java 7KB
ImageWatermarkUtil.java 7KB
QlReplaceOldCarExcel.java 7KB
QlInformationServiceImpl.java 7KB
CommonUtil.java 7KB
UserH5LoginController.java 7KB
QIMessageDOController.java 7KB
QrRegionsController.java 7KB
QlReplaceNewCarController.java 6KB
QlVehicleValuation.java 6KB
EazyPoiExcelUtil.java 6KB
SysBaseApiImpl.java 6KB
RedisConfig.java 6KB
PermissionDataAspect.java 6KB
ShufflingFigureController.java 6KB
DictAspect.java 6KB
JwtUtil.java 6KB
AdminNewCarOrderController.java 6KB
VideoUtil.java 6KB
CodeUtil.java 6KB
QrSiteSettingsController.java 6KB
SysUserAgentController.java 5KB
UserOAuth2WebResponseExceptionTranslator.java 5KB
ResourceServerConfiguration.java 5KB
共 776 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
xyq2024
- 粉丝: 2399
- 资源: 5452
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- wxsqlite3 源码,make直接编译
- appium server gui安装包
- C#企业合同管理系统源码 合同执行管理系统源码数据库 SQL2008源码类型 WebForm
- STM32F103C8T6+HC05
- v-model指令表单应用及组件封装
- 人脸识别系统(python+opencv+UI界面)
- 3DAutoPress-NX V1 Trial20241108.rar
- C#ASP.NET发票管理系统源码 增值税发票管理系统源码数据库 SQL2008源码类型 WebForm
- 【Next.js + TypeScript + Tailwind + Framer Motion】打造一个浪漫的告白页面
- MATLAB实现绘制NURBS曲线程序源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功