From 7951168bb85eccefc8d6bc9a3ccdf3347587f7d8 Mon Sep 17 00:00:00 2001 From: xyc <3422692813@qq.com> Date: Mon, 21 Jul 2025 15:42:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B00721?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/InspectionInfoController.java | 4 +- .../InspectionMallPartnersController.java | 98 ++++++++++++++++++- .../controller/PartnerOwnController.java | 13 +-- .../inspection/entity/AppointmentQuery.java | 12 +++ .../InspectionBatchSettlementOrder.java | 5 + .../inspection/entity/InspectionInfo.java | 14 +++ .../mapper/InspectionAppointmentMapper.java | 2 + .../inspection/query/OrderTableQuery.java | 6 ++ .../service/AppInspectionPartnerService.java | 1 + .../IInspectionAppointmentService.java | 2 + .../impl/AppInspectionPartnerServiceImpl.java | 23 +++++ .../InspectionAppointmentServiceImpl.java | 9 +- .../impl/InspectionInfoServiceImpl.java | 19 ++-- .../inspection/vo/InspectionInfoVo.java | 20 ++++ .../module/job/logger/AccessLogCleanJob.java | 41 ++++++++ .../impl/PartnerCustomerInfoServiceImpl.java | 10 +- .../controller/ShopUserCarController.java | 93 ++++++++++-------- .../module/shop/entity/InsuranceSaveVo.java | 39 ++++++++ .../yudao/module/shop/entity/ShopUserCar.java | 11 ++- .../shop/service/IShopUserCarService.java | 30 +++++- .../service/impl/ShopUserCarServiceImpl.java | 47 +++++++++ .../mapper/InspectionWorkNodeMapper.xml | 18 ++-- .../inspection/AppInspectionPartnerMapper.xml | 22 +++-- .../InspectionAppointmentMapper.xml | 73 ++++++++++++++ .../inspection/InspectionInfoMapper.xml | 43 +++++--- .../src/main/resources/application.yaml | 1 + 26 files changed, 550 insertions(+), 106 deletions(-) create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/AppointmentQuery.java create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/job/logger/AccessLogCleanJob.java create mode 100644 dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/InsuranceSaveVo.java diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java index 649f29d9..1af6c0c3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java @@ -385,7 +385,7 @@ public class InspectionInfoController extends BaseController { * @date 16:22 2024/12/18 **/ @GetMapping("/getCountByType") - public CommonResult getCountByType(@RequestParam("partnerId") Integer partnerId) { + public CommonResult getCountByType(@RequestParam(required = false, name = "partnerId") Integer partnerId) { return success(inspectionInfoService.getCountByType(partnerId)); } @@ -396,7 +396,7 @@ public class InspectionInfoController extends BaseController { * @date 16:22 2024/12/18 **/ @GetMapping("/getBusinessCountByType") - public CommonResult getBusinessCountByType(@RequestParam("partnerId") Integer partnerId) { + public CommonResult getBusinessCountByType(@RequestParam(required = false, name ="partnerId") Integer partnerId) { return success(inspectionInfoService.getBusinessCountByType(partnerId)); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java index 3d1bfdac..20f5c6a9 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionMallPartnersController.java @@ -182,7 +182,7 @@ public class InspectionMallPartnersController extends BaseController { Map stringObjectMap = orderInfoService.workOrderData(query); rows.add(CollUtil.newArrayList("公示价格汇总:", "", String.valueOf(Double.parseDouble(stringObjectMap.get("goodsPriceSum").toString()) / 100d) + "元", "实付金额汇总:", "", String.valueOf(Double.parseDouble(stringObjectMap.get("payMoneySum").toString()) / 100d) + "元")); - rows.add(CollUtil.newArrayList("车牌号", "检测车型", "检测类型", "业务渠道", "客户来源", "经办人", "公示价格", "实收金额", "付款时间", "客户手机号", "支付方式", "开始时间", "结束时间", "检测结果","出纳是否确认")); + rows.add(CollUtil.newArrayList("车牌号", "检测车型", "检测类型", "业务渠道", "客户来源", "经办人", "公示价格", "实收金额", "付款时间", "客户手机号", "支付方式", "开始时间", "结束时间", "检测结果", "出纳是否确认")); List sysDictData = dictDataService.getDictDataListByDictType("pay_type"); @@ -216,12 +216,12 @@ public class InspectionMallPartnersController extends BaseController { if (ObjectUtil.isNotEmpty(item.getCashierConfirm())) { if (item.getCashierConfirm().equals("0")) { cashier = "待审核"; - }else { + } else { cashier = "已审核"; } } - rows.add(CollUtil.newArrayList(Optional.ofNullable(item.getCarNum()).orElse(""), Optional.ofNullable(item.getGoodsTitle()).orElse(""), Optional.ofNullable(item.getSkuName()).orElse(""), Optional.ofNullable(item.getBusinessChannel()).orElse(""), Optional.ofNullable(item.getCustomerSource()).orElse(""), Optional.ofNullable(item.getOtherName()).orElse(""), ObjectUtil.isEmpty(item.getGoodsPrice()) ? "" : BigDecimal.valueOf(item.getGoodsPrice()) + rows.add(CollUtil.newArrayList(Optional.ofNullable(item.getCarNum()).orElse(item.getCertificateNum()), Optional.ofNullable(item.getGoodsTitle()).orElse(""), Optional.ofNullable(item.getSkuName()).orElse(""), Optional.ofNullable(item.getBusinessChannel()).orElse(""), Optional.ofNullable(item.getCustomerSource()).orElse(""), Optional.ofNullable(item.getOtherName()).orElse(""), ObjectUtil.isEmpty(item.getGoodsPrice()) ? "" : BigDecimal.valueOf(item.getGoodsPrice()) .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP) .toString(), ObjectUtil.isEmpty(item.getRealPayMoney()) ? "暂未支付" : BigDecimal.valueOf(item.getRealPayMoney()) .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP) @@ -229,14 +229,102 @@ public class InspectionMallPartnersController extends BaseController { Optional.ofNullable(item.getBuyPhone()).orElse(""), payTypeStr, ObjectUtil.isEmpty(item.getStartTime()) ? "" : DateUtil.format(item.getStartTime(), "yyyy-MM-dd hh:mm"), ObjectUtil.isEmpty(item.getEndTime()) ? "" : DateUtil.format(item.getEndTime(), "yyyy-MM-dd hh:mm"), isPassStr, cashier)); } + // 创建 ExcelWriter ExcelWriter writer = ExcelUtil.getWriter(); + +// ====== 拼接标题 ====== + StringBuilder titleBuilder = new StringBuilder("检测工单"); + + StringBuilder filterBuilder = new StringBuilder(); + +// 时间范围 + if (query.getInspectionTime() != null && query.getInspectionTime().length == 2) { + filterBuilder.append("时间:") + .append(query.getInspectionTime()[0]) + .append(" - ") + .append(query.getInspectionTime()[1]) + .append(","); + } + +// 客户来源 + if (StringUtils.isNotEmpty(query.getCustomerSource())) { + filterBuilder.append("客户来源:") + .append(query.getCustomerSource()) + .append(","); + } + +// 业务渠道 + if (StringUtils.isNotEmpty(query.getBusinessChannel())) { + filterBuilder.append("业务渠道:") + .append(query.getBusinessChannel()) + .append(","); + } + +// 车龄 + if (query.getCarYear() != null) { + filterBuilder.append("车龄:") + .append(query.getCarYear()) + .append("年,"); + } + +// 检测类型 + if (StringUtils.isNotEmpty(query.getSkuName())) { + filterBuilder.append("检测类型:") + .append(query.getSkuName()) + .append(","); + } + +// 支付方式 + if (StringUtils.isNotEmpty(query.getPayType())) { + filterBuilder.append("支付方式:") + .append(query.getPayType()) + .append(","); + } + +// 支付状态 + if (query.getPayStatus() != null) { + filterBuilder.append("支付状态:") + .append(query.getPayStatus() == 0 ? "未支付" : "已支付") + .append(","); + } + +// 车辆型号/车龄关键字 + if (StringUtils.isNotEmpty(query.getCarModelOrCarYear())) { + filterBuilder.append("车牌号或合格证后六位:") + .append(query.getCarModelOrCarYear()) + .append(","); + } + +// 车辆型号/车龄关键字 + if (ObjectUtil.isNotEmpty(query.getCarYear())) { + filterBuilder.append("车龄:") + .append(query.getCarYear()) + .append(","); + } + +// 去掉最后一个多余的逗号 + if (filterBuilder.length() > 0 && filterBuilder.charAt(filterBuilder.length() - 1) == ',') { + filterBuilder.deleteCharAt(filterBuilder.length() - 1); + } + +// 如果有筛选条件,就加括号 + if (filterBuilder.length() > 0) { + titleBuilder.append("(").append(filterBuilder).append(")"); + } + +// ====== 合并单元格写标题 ====== + writer.merge(14, titleBuilder.toString()); + +// ====== 设置标题行高 ====== + writer.setRowHeight(0, 30); + //跳过当前行,既第一行,非必须,在此演示用 //合并单元格后的标题行,使用默认标题样式 //一次性写出内容,强制输出标题 writer.write(rows, true); ExcelExtraHelper.enhanceExcel(writer, rows, - CollUtil.newArrayList(8,11,12,15), + CollUtil.newArrayList(8, 11, 12, 15), null); //out为OutputStream,需要写出到的目标流 //response为HttpServletResponse对象 @@ -254,7 +342,7 @@ public class InspectionMallPartnersController extends BaseController { @GetMapping("/workOrderData") - public CommonResult workOrderData(OrderTableQuery query, Integer pageSize, Integer pageNum) { + public CommonResult workOrderData(OrderTableQuery query, Integer pageSize, Integer pageNum) { // LoginUser user = SecurityFrameworkUtils.getLoginUser(); // Set userRoleIdListByUserId = permissionService.getUserRoleIdListByUserId(user.getId()); // List roleList = roleService.getRoleList(userRoleIdListByUserId); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java index cc999820..efe89a57 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/PartnerOwnController.java @@ -477,17 +477,10 @@ public class PartnerOwnController extends BaseController { //获取到店预约的数据 @GetMapping("/getAppointmentList") - public CommonResult getAppointmentList(Long partnerId, String phoneNum, - Integer pageSize, Integer pageNum, - String carNo, @RequestParam(required = false) String startTime, @RequestParam(required = false) String endTime) throws Exception { -// LoginUser user = SecurityFrameworkUtils.getLoginUser(); -// ShopMallPartners partnersTmp = partnerList.getById(partnerId); -// if (!partnersTmp.getUserId().equals(user.getId())){ -// return null; -// } + public CommonResult getAppointmentList(AppointmentQuery query, + Integer pageSize, Integer pageNum) throws Exception { Page page = new Page<>(pageNum, pageSize); -// ShopMallPartners shopMallPartners = partnerList.shopInfo(); - IPage appointments = partnerList.getAppointmentList(page, null, phoneNum, carNo, startTime, endTime); + IPage appointments = partnerList.getAppointmentList(page, query); return success(appointments); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/AppointmentQuery.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/AppointmentQuery.java new file mode 100644 index 00000000..a0efb338 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/AppointmentQuery.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.inspection.entity; + +import lombok.Data; + +@Data +public class AppointmentQuery { + String phoneNum; + String carNo; + String startTime; + String endTime; + Integer deleted; +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionBatchSettlementOrder.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionBatchSettlementOrder.java index e13e3c09..25b4644b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionBatchSettlementOrder.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionBatchSettlementOrder.java @@ -34,6 +34,11 @@ public class InspectionBatchSettlementOrder extends TenantBaseDO implements Seri */ private Long payMoney; + /** + * 优惠金额 + */ + private Long reduceMoney = 0L; + /** * 订单id集合 */ diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java index e27ab28f..59f5500f 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java @@ -244,4 +244,18 @@ public class InspectionInfo extends TenantBaseDO */ @TableField(exist = false) private String accountingConfirmRemark; + + /** 保险到期日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @TableField(exist = false) + private Date insuranceExpiryDate; + + /** 保险到期日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @TableField(exist = false) + private Date vehicleInsuranceExpiryDate; + + /** 保险公司名称 */ + @TableField(exist = false) + private String insuranceCompanyName; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java index 4689b925..88fe1484 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionAppointmentMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.inspection.mapper; +import cn.iocoder.yudao.module.inspection.entity.AppointmentQuery; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.iocoder.yudao.module.inspection.entity.InspectionAppointment; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -69,4 +70,5 @@ public interface InspectionAppointmentMapper extends BaseMapper getAppointmentOwn(@Param("userId") Long userId); + IPage getAppointmentListNew(Page page, @Param("vo") AppointmentQuery query); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/query/OrderTableQuery.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/query/OrderTableQuery.java index b1b25b19..0c5f1c3e 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/query/OrderTableQuery.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/query/OrderTableQuery.java @@ -68,4 +68,10 @@ public class OrderTableQuery { private String remark; private String receivablesAccount; + + /** 优惠金额 */ + private Long reduceMoney; + + /** 筛选类型 */ + private String dateType; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java index dee19ac6..cf663790 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/AppInspectionPartnerService.java @@ -126,6 +126,7 @@ public interface AppInspectionPartnerService extends IService void makeCertOk(Long inspectionId); IPage getAppointmentList(Page page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime); + IPage getAppointmentList(Page page, AppointmentQuery query); IPage validationList(Page page, Long partnerId, String searchValue); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java index 5abb39c4..3a85d422 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionAppointmentService.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.inspection.service; +import cn.iocoder.yudao.module.inspection.entity.AppointmentQuery; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -77,5 +78,6 @@ public interface IInspectionAppointmentService extends IService getAppointmentList(Page page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime); + public IPage getAppointmentList(Page page, AppointmentQuery query); List getAppointmentOwn(); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java index 0e277489..c02bf39b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/AppInspectionPartnerServiceImpl.java @@ -157,6 +157,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl partnerList(Page page, PartnerListQuery partnerListQuery) { @@ -375,6 +377,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getAppointmentList(Page page, AppointmentQuery query) { + if (StrUtil.isNotEmpty(query.getStartTime()) && StrUtil.isNotEmpty(query.getEndTime())) { + query.setStartTime(query.getStartTime() + " 00:00:00"); + query.setEndTime(query.getEndTime() + " 23:59:59"); + + } + return appointmentService.getAppointmentList(page, query); + } + @Override public IPage validationList(Page page, Long partnerId, String searchValue) { @@ -2697,7 +2716,9 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpllambdaUpdate() .in(OrderInfo::getId, orderIds) @@ -2706,6 +2727,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl getAppointmentList(Page page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime) { return baseMapper.getAppointmentList(page, partnerId, phoneNum, carNo, startTime, endTime); } + @Override + public IPage getAppointmentList(Page page, AppointmentQuery query) { + return baseMapper.getAppointmentListNew(page, query); + } @Override public List getAppointmentOwn() { diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index 4d44830e..819dff03 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -167,7 +167,6 @@ public class InspectionInfoServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId, inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId()).last("limit 1"); + queryWrapper.eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId()).last("limit 1"); PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper); if (ObjectUtil.isEmpty(customerInfo)) { customerInfo = new PartnerCustomerInfo(); - customerInfo.setPartnerId(inspectionInfo.getPartnerId()); customerInfo.setUserId(user.getId()); customerInfo.setCustomerPhone(user.getMobile()); customerInfo.setCustomerName(user.getNickname()); @@ -615,6 +615,10 @@ public class InspectionInfoServiceImpl extends ServiceImpl pageWorkOrder(OrderTableQuery query, Page page) { + if (StringUtils.isNotEmpty(query.getDatetimeRange())) { + query.getDatetimeRange()[0] = query.getDatetimeRange()[0] + " 00:00:00"; + query.getDatetimeRange()[1] = query.getDatetimeRange()[1] + " 23:59:59"; + } return baseMapper.pageWorkOrderNew(query, page); } @@ -773,6 +777,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId, partners.getPartnerId()) - .eq(PartnerCustomerInfo::getCustomerPhone, partnerCustomerInfo.getCustomerPhone()); + queryWrapper.eq(PartnerCustomerInfo::getCustomerPhone, partnerCustomerInfo.getCustomerPhone()); PartnerCustomerInfo customerInfo = this.getOne(queryWrapper); if (ObjectUtils.isNotEmpty(customerInfo)) { @@ -145,6 +143,7 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl ids = new HashSet<>(); @@ -249,11 +248,10 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl page = new Page<>(pageNum, pageSize); - IPage list = shopUserCarService.selectShopUserCarList(page,shopUserCar); + IPage list = shopUserCarService.selectShopUserCarList(page, shopUserCar); return success(list); } + @GetMapping("/listOfPartner") public CommonResult listOfPartner(ShopUserCar shopUserCar, - @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, - @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) - { + @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { Page page = new Page<>(pageNum, pageSize); - IPage list = shopUserCarService.selectShopUserCarList(page,shopUserCar); + IPage list = shopUserCarService.selectShopUserCarList(page, shopUserCar); return success(list); } + /** * 导出用户车辆列表 */ // @PreAuthorize("@ss.hasPermi('system:userCar:export')") @PostMapping("/export") public void export(HttpServletResponse response, ShopUserCar shopUserCar, - @RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum, - @RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) - { - Page page = new Page<>(pageNum,pageSize); - IPage list = shopUserCarService.selectShopUserCarList(page,shopUserCar); + @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum, + @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) { + Page page = new Page<>(pageNum, pageSize); + IPage list = shopUserCarService.selectShopUserCarList(page, shopUserCar); ExcelUtil util = new ExcelUtil(ShopUserCar.class); util.exportExcel(response, list.getRecords(), "用户车辆数据"); } @@ -72,8 +71,7 @@ public class ShopUserCarController extends BaseController */ // @PreAuthorize("@ss.hasPermi('system:userCar:query')") @GetMapping(value = "/{carId}") - public CommonResult getInfo(@PathVariable("carId") Long carId) - { + public CommonResult getInfo(@PathVariable("carId") Long carId) { return success(shopUserCarService.selectShopUserCarByCarId(carId)); } @@ -81,10 +79,8 @@ public class ShopUserCarController extends BaseController * 新增用户车辆 */ // @PreAuthorize("@ss.hasPermi('system:userCar:add')") - @PostMapping - public CommonResult add(@RequestBody ShopUserCar shopUserCar) - { + public CommonResult add(@RequestBody ShopUserCar shopUserCar) { return toAjax(shopUserCarService.insertShopUserCar(shopUserCar)); } @@ -92,10 +88,8 @@ public class ShopUserCarController extends BaseController * 修改用户车辆 */ // @PreAuthorize("@ss.hasPermi('system:userCar:edit')") - @PutMapping - public CommonResult edit(@RequestBody ShopUserCar shopUserCar) - { + public CommonResult edit(@RequestBody ShopUserCar shopUserCar) { return toAjax(shopUserCarService.updateShopUserCar(shopUserCar)); } @@ -104,46 +98,63 @@ public class ShopUserCarController extends BaseController * 删除用户车辆 */ // @PreAuthorize("@ss.hasPermi('system:userCar:remove')") - - @DeleteMapping("/{carIds}") - public CommonResult remove(@PathVariable Long[] carIds) - { + @DeleteMapping("/{carIds}") + public CommonResult remove(@PathVariable Long[] carIds) { return toAjax(shopUserCarService.deleteShopUserCarByCarIds(carIds)); } @GetMapping(value = "/getUserCar") @TenantIgnore - public CommonResult getUserCarByUserId() - { + public CommonResult getUserCarByUserId() { return success(shopUserCarService.selectShopUserCarByUserId(getUserId())); } @PostMapping("/vehicleLicenseOCR") - public CommonResult vehicleLicenseOCR(String imagePath) throws Exception - { + public CommonResult vehicleLicenseOCR(String imagePath) throws Exception { return success(shopUserCarService.vehicleLicenseOCR(imagePath)); } @PostMapping("/appVehicleLicenseOCR") - public CommonResult appVehicleLicenseOCR(String imagePath) throws Exception - { + public CommonResult appVehicleLicenseOCR(String imagePath) throws Exception { return success(shopUserCarService.appVehicleLicenseOCR(imagePath)); } -//20240327追加接口 + + //20240327追加接口 @PostMapping("/appVehicleLicenseOCR2") - public CommonResult appVehicleLicenseOCR2(String imagePath) throws Exception - { + public CommonResult appVehicleLicenseOCR2(String imagePath) throws Exception { return success(shopUserCarService.appVehicleLicenseOCR2(imagePath)); } + @PostMapping("/infoCardOCR") - public CommonResult infoCardOCR(String imagePath) throws Exception - { + public CommonResult infoCardOCR(String imagePath) throws Exception { shopUserCarService.infoCardOCR(imagePath); return success(); } + @GetMapping("/getInfoCard") - public CommonResult getInfoCard() - { - return success( shopUserCarService.getInfoCard()); + public CommonResult getInfoCard() { + return success(shopUserCarService.getInfoCard()); + } + + /** + * 保险信息完善 + * + * @param insuranceSaveVo 保险信息 + */ + @PostMapping("/completeInsuranceInformation") + public CommonResult completeInsuranceInformation(@RequestBody InsuranceSaveVo insuranceSaveVo) { + shopUserCarService.completeInsuranceInformation(insuranceSaveVo); + return CommonResult.ok(); + } + + /** + * 根据车牌号查询车辆信息 + * + * @param carNo 车牌号 + * @return 车辆信息 + */ + @GetMapping("/getUserCarByCarNo") + public CommonResult getUserCarByCarNo(String carNo) { + return CommonResult.success(shopUserCarService.selectUserCarsByCarNo(carNo)); } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/InsuranceSaveVo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/InsuranceSaveVo.java new file mode 100644 index 00000000..eb7657ef --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/InsuranceSaveVo.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.shop.entity; + +import lombok.Data; + +import java.util.Date; + +@Data +public class InsuranceSaveVo { + + /** + * 用户ID + */ + private Long userId; + + /** + * 车牌号码 + */ + private String carNo; + + /** + * 保险公司名称 + */ + private String insuranceCompanyName; + + /** + * 交强险到期日期 + */ + private Date insuranceExpiryDate; + + /** + * 商业险到期日期 + */ + private Date vehicleInsuranceExpiryDate; + + /** + * 下次年检日期 + */ + private Date nextInspectionDate; +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopUserCar.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopUserCar.java index 8738a928..40cf97a3 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopUserCar.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/entity/ShopUserCar.java @@ -55,6 +55,10 @@ public class ShopUserCar extends TenantBaseDO @Excel(name = "年检日期", width = 30, dateFormat = "yyyy-MM-dd") private Date inspectionDate; + /** 保险公司名称 */ + @Excel(name = "保险公司名称") + private String insuranceCompanyName; + /** 保险日期 */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "保险日期", width = 30, dateFormat = "yyyy-MM-dd") @@ -76,9 +80,14 @@ public class ShopUserCar extends TenantBaseDO /** 保险到期日期 */ @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "保险到期日期", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "交强险到期日期", width = 30, dateFormat = "yyyy-MM-dd") private Date insuranceExpiryDate; + /** 保险到期日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "商业险到期日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date vehicleInsuranceExpiryDate; + private String carBrand; //车辆性质 private String carNature; diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java index 1489cd31..5462ba13 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/IShopUserCarService.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.shop.service; import java.util.List; + +import cn.iocoder.yudao.module.shop.entity.InsuranceSaveVo; import cn.iocoder.yudao.module.shop.entity.ShopUserCar; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -14,8 +16,7 @@ import com.tencentcloudapi.common.exception.TencentCloudSDKException; * @author ruoyi * @date 2023-07-10 */ -public interface IShopUserCarService extends IService -{ +public interface IShopUserCarService extends IService { /** * 查询用户车辆 * @@ -65,16 +66,37 @@ public interface IShopUserCarService extends IService public int deleteShopUserCarByCarId(Long carId); public ShopUserCar selectShopUserCarByUserId(Long userId); - ShopUserCar selectUserCarsByUserIdCarNum(Long userId,String carNum); + + ShopUserCar selectUserCarsByUserIdCarNum(Long userId, String carNum); List selectUserCarsByUserId(Long userId); + List getDbCars(Long userId); String vehicleLicenseOCR(String imagePath) throws TencentCloudSDKException; + String appVehicleLicenseOCR(String imagePath) throws Exception; + JSONObject appVehicleLicenseOCR2(String imagePath) throws Exception; - void infoCardOCR( String imagePath) throws TencentCloudSDKException; + + void infoCardOCR(String imagePath) throws TencentCloudSDKException; + JSONObject getInfoCard(); void deleteShopUserCarByUserId(Long userId); + + public void completeInsuranceInformation(InsuranceSaveVo insuranceSaveVo); + + /** + * 根据车牌号查询车辆信息 + * + * @param carNo 车牌号 + * @return + */ + ShopUserCar selectUserCarsByCarNo(String carNo); + + /** + * 查询车辆到期提醒 + */ + public void expirationReminder(); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java index 58431949..7cc61c76 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/shop/service/impl/ShopUserCarServiceImpl.java @@ -1,9 +1,11 @@ package cn.iocoder.yudao.module.shop.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.shop.entity.InsuranceSaveVo; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.service.user.AdminUserService; @@ -11,6 +13,7 @@ import cn.iocoder.yudao.util.IDCardOCR; import cn.iocoder.yudao.util.VehicleLicenseOCR; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import cn.iocoder.yudao.util.StringUtils; @@ -406,6 +409,50 @@ public class ShopUserCarServiceImpl extends ServiceImpllambdaQuery() + .eq(ShopUserCar::getCarNo, insuranceSaveVo.getCarNo()) + .last("limit 1")); + + if (userCar == null) { + // 新建 + userCar = new ShopUserCar(); + BeanUtil.copyProperties(insuranceSaveVo, userCar); + baseMapper.insert(userCar); + } else { + //更新 + BeanUtil.copyProperties(insuranceSaveVo, userCar); + baseMapper.updateById(userCar); + } + } + + /** + * 根据车牌号查询车辆信息 + * + * @param carNo 车牌号 + * @return + */ + @Override + public ShopUserCar selectUserCarsByCarNo(String carNo) { + return getOne(Wrappers.lambdaQuery() + .eq(ShopUserCar::getCarNo, carNo) + .last("limit 1")); + } + + /** + * 查询车辆到期提醒 + */ + @Override + public void expirationReminder() { + + } + //处理年检日期保养日期 void dealCarDate(ShopUserCar shopUserCar){ //注册日期 diff --git a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml index 8cb08610..44202f4c 100644 --- a/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/InspectionWorkNodeMapper.xml @@ -256,17 +256,17 @@ AND iwn.create_time BETWEEN concat(#{datetimeRange[0]}, ' 00:00:00') AND concat(#{datetimeRange[1]}, ' 23:59:59') LEFT JOIN inspection_project ip ON ip.id = iwn.project_id --- LEFT JOIN ( --- SELECT DISTINCT sur.user_id --- FROM system_user_role sur --- JOIN system_role sr ON sur.role_id = sr.id --- WHERE sr.service_package_id = 'jiance' --- AND sr.CODE NOT IN ('jcyh', 'jcywjl') --- ) valid_roles ON staff.user_id = valid_roles.user_id + LEFT JOIN ( + SELECT DISTINCT sur.user_id + FROM system_user_role sur + JOIN system_role sr ON sur.role_id = sr.id + WHERE sr.service_package_id = 'jiance' + AND sr.CODE NOT IN ('jcyh', 'jcywjl') + ) valid_roles ON staff.user_id = valid_roles.user_id LEFT JOIN system_users su ON su.id = staff.user_id staff.deleted = 0 AND su.deleted = 0 --- AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户 + AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户 GROUP BY staff.user_id ,ip.id @@ -359,7 +359,7 @@ AND ii.customer_source = #{query.customerSource} - AND ii.create_time BETWEEN #{query.datetimeRange[0]} AND #{query.datetimeRange[1]} + AND ii.create_time BETWEEN CONCAT(#{query.datetimeRange[0]}, ' 00:00:00') AND CONCAT(#{query.datetimeRange[1]}, ' 23:59:59') AND ii.customer_source = #{query.customSource} diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml index bef16448..4fde466d 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/AppInspectionPartnerMapper.xml @@ -470,11 +470,11 @@ FROM + diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml index 4a646cee..e5dab1ab 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml @@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from inspection_info where id = #{id} + UPDATE inspection_info SET deleted = 1 WHERE id = #{id} @@ -662,17 +662,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM inspection_meet_car_order imco - JOIN inspection_business_channel ibc ON imco.customer_source_id = ibc.id + LEFT JOIN inspection_business_channel ibc ON imco.customer_source_id = ibc.id + LEFT JOIN system_users su + ON su.username COLLATE utf8mb4_general_ci = imco.other_phone COLLATE utf8mb4_general_ci - INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0 + LEFT JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0 LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0 WHERE imco.deleted = 0 AND ibc.deleted = 0 - AND FIND_IN_SET(#{info.userId}, ibc.user_ids) + AND (FIND_IN_SET(#{info.userId}, ibc.user_ids) OR su.id = #{info.userId}) @@ -704,14 +706,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select distinct ins.*,oi.goods_title,su.nickname as buyName,su.mobile as buyPhone,oi.sku_name,oi.pay_money as realPayMoney ,oi.pay_type,oi.order_status as - orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,oi.cashier_confirm,oi.cashier_confirm_remark,oi.cashier_confirm_time ,oi.accounting_confirm,oi.accounting_confirm_remark + orderStatus,oi.goods_id,oi.sku_id,oi.pay_time,oi.goods_price,oi.cashier_confirm,oi.cashier_confirm_remark,oi.cashier_confirm_time + ,oi.accounting_confirm,oi.accounting_confirm_remark, + car.next_inspection_date,car.insurance_company_name,car.insurance_expiry_date,car.vehicle_insurance_expiry_date from inspection_info ins left join order_info oi on oi.id = ins.inspection_order_id left join system_users su on su.id = ins.user_id left join system_user_role sur on sur.user_id = su.id - where 1=1 + LEFT JOIN shop_user_car car on car.car_no = ins.car_num + where 1=1 AND ins.deleted = 0 - and ins.car_num like concat('%',#{query.carModelOrCarYear},'%') + and (ins.car_num like concat('%',#{query.carModelOrCarYear},'%') + OR ins.certificate_num like concat('%',#{query.carModelOrCarYear},'%')) and oi.sku_name like concat('%',#{query.skuName},'%') @@ -733,7 +739,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and ins.start_time between #{query.startTime} and #{query.endTime} - and ins.start_time between #{query.datetimeRange[0]} and #{query.datetimeRange[1]} + + and ins.start_time between #{query.datetimeRange[0]} and #{query.datetimeRange[1]} + + + and car.insurance_expiry_date between #{query.datetimeRange[0]} and #{query.datetimeRange[1]} + + + and car.vehicle_insurance_expiry_date between #{query.datetimeRange[0]} and #{query.datetimeRange[1]} + + + and car.next_inspection_date between #{query.datetimeRange[0]} and #{query.datetimeRange[1]} + + and (oi.pay_money is null OR oi.pay_type = 'sz') @@ -748,15 +766,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by ins.start_time desc