diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/WarnMessageController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/WarnMessageController.java index 00c2020c..5dd5a138 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/WarnMessageController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/WarnMessageController.java @@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.util.ExcelUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -39,7 +41,12 @@ public class WarnMessageController extends BaseController return success(list); } - + @GetMapping("/pageList") + public CommonResult pageList(WarnMessage warnMessage,Integer pageNo,Integer pageSize) throws Exception { + Page page =new Page(pageNo,pageSize); + IPage list = warnMessageService.pageList(page,warnMessage); + return success(list); + } @PostMapping("/export") public void export(HttpServletResponse response, WarnMessage warnMessage) throws Exception { List list = warnMessageService.selectWarnMessageList(warnMessage); diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/WarnMessageMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/WarnMessageMapper.java index b090289a..62c39d63 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/WarnMessageMapper.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/WarnMessageMapper.java @@ -4,7 +4,11 @@ import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import cn.iocoder.yudao.module.inspection.entity.WarnMessage; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + /** * warnMsgMapper接口 @@ -31,4 +35,6 @@ public interface WarnMessageMapper extends BaseMapper */ public List selectWarnMessageList(WarnMessage warnMessage); + IPage pageList(Page page,@Param("warnMessage") WarnMessage warnMessage); + } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IWarnMessageService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IWarnMessageService.java index 5e26e5a2..a4cecafe 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IWarnMessageService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IWarnMessageService.java @@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.inspection.service; import java.util.List; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import cn.iocoder.yudao.module.inspection.entity.WarnMessage; @@ -28,6 +30,7 @@ public interface IWarnMessageService extends IService * @return warnMsg集合 */ public List selectWarnMessageList(WarnMessage warnMessage) throws Exception; + IPage pageList(Page page,WarnMessage warnMessage) throws Exception; /** * 新增warnMsg 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 36caf35a..04941ab3 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 @@ -195,7 +195,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl pageList(Page page, WarnMessage warnMessage) throws Exception { + ShopMallPartners partners = partnerService.shopInfo(); + warnMessage.setPartnerId(partners.getPartnerId()); + warnMessage.setIsRead("0"); + IPage warnMessages = baseMapper.pageList(page,warnMessage); + return warnMessages; + } + /** * 新增warnMsg * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java index f138158c..f30e9a68 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/partner/service/impl/PartnerCustomerInfoServiceImpl.java @@ -1,6 +1,14 @@ package cn.iocoder.yudao.module.partner.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.entity.CustomerCar; +import cn.iocoder.yudao.module.custom.entity.CustomerMain; +import cn.iocoder.yudao.module.custom.entity.UserCar; +import cn.iocoder.yudao.module.custom.service.CarMainService; +import cn.iocoder.yudao.module.custom.service.CustomerCarService; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; +import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO; import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService; import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo; import cn.iocoder.yudao.module.partner.mapper.PartnerCustomerInfoMapper; @@ -27,10 +35,12 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.math.BigDecimal; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +import static cn.iocoder.yudao.common.BaseConstants.SIGN_CREATE; /** * 客户信息Service业务层处理 @@ -55,6 +65,12 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partners.getPartnerId()).eq(PartnerCustomerInfo::getCustomerPhone,partnerCustomerInfo.getCustomerPhone()); + + // 检查客户是否已存在 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerCustomerInfo::getPartnerId, partners.getPartnerId()) + .eq(PartnerCustomerInfo::getCustomerPhone, partnerCustomerInfo.getCustomerPhone()); + PartnerCustomerInfo customerInfo = this.getOne(queryWrapper); - if (ObjectUtils.isNotEmpty(customerInfo)){ + if (ObjectUtils.isNotEmpty(customerInfo)) { throw new Exception("客户已存在"); } + + // 查找或创建用户 AdminUserDO user = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone()); - if (ObjectUtils.isEmpty(user)){ + if (ObjectUtils.isEmpty(user)) { RoleDO role = roleService.queryRole("jcyh"); - - UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); - user = new AdminUserDO(); - BeanUtils.copyProperties(partnerCustomerInfo,user); - userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone()); - userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName()); - userSaveReqVO.setPassword("123456"); - Long uid = userService.createUser(userSaveReqVO); - user.setId(uid); - Set ids = new HashSet<>(); - ids.add(role.getId()); - permissionService.assignUserRole(uid,ids); - + if (role != null) { + UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); + user = new AdminUserDO(); + BeanUtils.copyProperties(partnerCustomerInfo, user); + userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone()); + userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName()); + userSaveReqVO.setPassword("123456"); + Long uid = userService.createUser(userSaveReqVO); + user.setId(uid); + Set ids = new HashSet<>(); + ids.add(role.getId()); + permissionService.assignUserRole(uid, ids); + } else { + throw new RuntimeException("无法找到角色 'jcyh'"); + } } - if (!StringUtils.isEmpty(partnerCustomerInfo.getCustomerPhone())&&!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())){ + + // 角色分配 + if (!StringUtils.isEmpty(partnerCustomerInfo.getRoleCode())) { RoleDO sysRole = roleService.queryRole(partnerCustomerInfo.getRoleCode()); Set ids = new HashSet<>(); ids.add(sysRole.getId()); - permissionService.assignUserRole(user.getId(),ids); - + permissionService.assignUserRole(user.getId(), ids); } + + // 车辆信息处理 List userCarList = partnerCustomerInfo.getUserCarList(); - if (CollectionUtil.isNotEmpty(userCarList)){ + List saveCarList = new ArrayList<>(); + List saveCustomerCarList = new ArrayList<>(); + List saveUserCarList = new ArrayList<>(); + + UserCar userCar1 = new UserCar(); + if (CollectionUtil.isNotEmpty(userCarList)) { for (ShopUserCar shopUserCar : userCarList) { - LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>(); - queryWrapper1.eq(ShopUserCar::getUserId,user.getId()).eq(ShopUserCar::getCarNo,shopUserCar.getCarNo()); - ShopUserCar one = userCarService.getOne(queryWrapper1); - if (ObjectUtils.isNotEmpty(one)){ - //保养日期 - if (null!=shopUserCar.getMaintenanceDate()){ - one.setMaintenanceDate(shopUserCar.getMaintenanceDate()); - } - if (null!=shopUserCar.getMaintenanceMileage()){ - one.setMaintenanceMileage(shopUserCar.getMaintenanceMileage()); - } - if (null!=shopUserCar.getInspectionDate()){ - one.setInspectionDate(shopUserCar.getInspectionDate()); - } + // 生成车辆ID + String carId = UUID.randomUUID().toString().replace("-", ""); + CarMain carMain = new CarMain(); + carMain.setId(carId); + carMain.setUserId(user.getId()); + carMain.setLicenseNumber(shopUserCar.getCarNo()); + carMain.setEngineNumber(userCar1.getEngineNumber()); + carMain.setVin(userCar1.getVin()); + carMain.setCarModel(shopUserCar.getCarModel()); + // 设置其它车辆信息 + carMain.setMaintenanceDate(convertToLocalDateTime(shopUserCar.getMaintenanceDate())); + carMain.setMaintenanceMileage(convertToBigDecimal(shopUserCar.getMaintenanceMileage())); + carMain.setInspectionDate(convertToLocalDateTime(shopUserCar.getInspectionDate())); + carMain.setInsuranceDate(convertToLocalDateTime(shopUserCar.getInsuranceDate())); + carMain.setNextMaintenanceDate(convertToLocalDateTime(shopUserCar.getNextMaintenanceDate())); + carMain.setNextMaintenanceMileage(convertToBigDecimal(shopUserCar.getNextMaintenanceMileage())); + carMain.setNextInspectionDate(convertToLocalDateTime(shopUserCar.getNextInspectionDate())); + carMain.setInsuranceExpiryDate(convertToLocalDateTime(shopUserCar.getInsuranceExpiryDate())); + carMain.setCarBrand(shopUserCar.getCarBrand()); + carMain.setCarNature(shopUserCar.getCarNature()); + carMain.setCarCategory(userCar1.getCarCategory()); + carMain.setCarRegisterDate(convertToLocalDateTime(shopUserCar.getCarRegisterDate())); + carMain.setCarLicenseImg(shopUserCar.getCarLicenseImg()); + carMain.setCheckDate(convertToLocalDateTime(shopUserCar.getCheckDate())); + carMain.setNextCheckDate(convertToLocalDateTime(shopUserCar.getNextCheckDate())); - if (null!=shopUserCar.getInsuranceDate()){ - one.setInsuranceDate(shopUserCar.getInsuranceDate()); - } - if (null!=shopUserCar.getNextMaintenanceDate()){ - one.setNextMaintenanceDate(shopUserCar.getNextMaintenanceDate()); - } - if (null!=shopUserCar.getNextMaintenanceMileage()){ - one.setNextMaintenanceMileage(shopUserCar.getNextMaintenanceMileage()); - } - if (null!=shopUserCar.getNextInspectionDate()){ - one.setNextInspectionDate(shopUserCar.getNextInspectionDate()); - } - if (null!=shopUserCar.getInsuranceExpiryDate()){ - one.setInsuranceExpiryDate(shopUserCar.getInsuranceExpiryDate()); - } - userCarService.updateById(one); - }else { - shopUserCar.setUserId(user.getId()); - userCarService.save(shopUserCar); - } + // 保存车辆信息 + saveCarList.add(carMain); + // 客户与车辆的关联关系 + CustomerCar customerCar = new CustomerCar(); + customerCar.setId(UUID.randomUUID().toString().replace("-", "")); + customerCar.setCusId(user.getId().toString()); + customerCar.setCarId(carId); + customerCar.setIsOwner(userCar1.getIsOwner()); // 是否为车主 + saveCustomerCarList.add(customerCar); + + // 保存用户车辆信息 + ShopUserCar userCar = new ShopUserCar(); + userCar.setUserId(user.getId()); + userCar.setCarNo(shopUserCar.getCarNo()); + userCar.setCarModel(shopUserCar.getCarModel()); + userCar.setMaintenanceDate(shopUserCar.getMaintenanceDate()); + userCar.setMaintenanceMileage(shopUserCar.getMaintenanceMileage()); + userCar.setInspectionDate(shopUserCar.getInspectionDate()); + userCar.setInsuranceDate(shopUserCar.getInsuranceDate()); + userCar.setNextMaintenanceDate(shopUserCar.getNextMaintenanceDate()); + userCar.setNextMaintenanceMileage(shopUserCar.getNextMaintenanceMileage()); + userCar.setNextInspectionDate(shopUserCar.getNextInspectionDate()); + userCar.setInsuranceExpiryDate(shopUserCar.getInsuranceExpiryDate()); + saveUserCarList.add(userCar); } } + + // 验证手机号 + if (!StringUtils.isMobile(partnerCustomerInfo.getCustomerPhone())) { + throw new Exception("手机号不符合规范"); + } + + // 创建客户信息 + CustomerMain customerMain = new CustomerMain(); + customerMain.setId(UUID.randomUUID().toString().replace("-", "")); + customerMain.setUserId(user.getId()); + customerMain.setCusName(partnerCustomerInfo.getCustomerName()); + customerMain.setPhoneNumber(partnerCustomerInfo.getCustomerPhone()); + customerMain.setSex(partnerCustomerInfo.getSex()); + customerMain.setIsHangAccount("0"); + customerMain.setTypeCode("01"); + // 设置客户初始来源 + customerMain.setDataFrom("01"); + // 设置注册方式 + customerMain.setInviterType("01"); + + // 保存客户信息 + customerMainService.saveOrUpdate(customerMain); + + // 保存车辆信息和客户与车辆关联关系 + carMainService.saveOrUpdateBatch(saveCarList); + customerCarService.saveBatch(saveCustomerCarList); + + // 保存用户车辆信息 + for (ShopUserCar userCar : saveUserCarList) { + // 检查是否已存在 + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(ShopUserCar::getUserId, userCar.getUserId()).eq(ShopUserCar::getCarNo, userCar.getCarNo()); + ShopUserCar existingUserCar = userCarService.getOne(queryWrapper1); + if (existingUserCar != null) { + // 更新用户车辆信息 + userCarService.updateById(userCar); + } else { + // 保存新用户车辆信息 + userCarService.save(userCar); + } + } + + // 填充 partnerCustomerInfo partnerCustomerInfo.setPartnerId(partners.getPartnerId()); partnerCustomerInfo.setUserId(user.getId()); + + // 插入 partner_customer_info return baseMapper.insertPartnerCustomerInfo(partnerCustomerInfo); } + /* Date转换为LocalDateTime */ + private LocalDateTime convertToLocalDateTime(Date date) { + if (date != null) { + return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); + } + return null; + } + + /* Long转换为BigDecimal */ + private BigDecimal convertToBigDecimal(Long value) { + if (value != null) { + return BigDecimal.valueOf(value); + } + return null; + } + + + + /** * 修改客户信息 * diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/StringUtils.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/StringUtils.java index 1995674b..9651b5dc 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/StringUtils.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/util/StringUtils.java @@ -607,4 +607,19 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } return sb.toString(); } + + /** + * 手机号格式验证 + * @author lzt + * @param customerPhone 手机号 + * @return 验证结果 + * @date 2024年10月22日 + */ + public static boolean isMobile(String customerPhone) { + if (customerPhone == null || customerPhone.length() != 11) { + return false; + } + String regex = "^1[358]\\d{9}$"; + return customerPhone.matches(regex); + } } 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 95b8d5de..85d4c0a5 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/InspectionInfoMapper.xml @@ -209,8 +209,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java index 81830573..73d7589a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/base/service/RepairRecordsService.java @@ -19,7 +19,7 @@ public interface RepairRecordsService extends IService { * 保存维修记录 * * @param ticketId 工单id - * @param repairItemId 工单子表id +// * @param repairItemId 工单子表id * @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举) * @param remark 备注 * @param images 图片(相对路径按照“,”分隔) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index 3c674550..cde8ddb9 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -39,6 +39,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -100,6 +101,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl getBossNum() { return success(dlRepairTicketsService.getBossNum()); } + + /** + * 服务顾问通知客户取车 + * + * @author 小李 + * @date 22:40 2024/10/23 + * @param noticeCusVO 请求对象 + **/ + @PostMapping("/noticeCus") + @Operation(summary = "服务顾问通知客户取车") + public CommonResult noticeCus(@RequestBody NoticeCusVO noticeCusVO) { + dlRepairTicketsService.noticeCus(noticeCusVO); + return CommonResult.ok(); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index 52af385f..941b34ed 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; +import cn.iocoder.yudao.module.tickets.vo.NoticeCusVO; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -172,4 +173,13 @@ public interface DlRepairTicketsService extends IService { * @return java.util.Map **/ Map getBossNum(); + + /** + * 服务顾问通知客户取车 + * + * @author 小李 + * @date 22:40 2024/10/23 + * @param noticeCusVO 请求对象 + **/ + void noticeCus(NoticeCusVO noticeCusVO); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 0ecc3431..1bc1a761 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -43,10 +43,7 @@ import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; import cn.iocoder.yudao.module.tickets.tools.WordUtil; -import cn.iocoder.yudao.module.tickets.vo.CustomerAndCarVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO; +import cn.iocoder.yudao.module.tickets.vo.*; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -55,6 +52,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.deepoove.poi.XWPFTemplate; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.Na; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -63,6 +62,7 @@ import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.InputStream; import java.math.BigDecimal; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -735,13 +735,13 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl() .set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode()) @@ -801,6 +801,52 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl repairType = dictDataApi.getDictDataList("repair_type"); + // 默认是维修 + String type = "维修"; + DictDataRespDTO dictDataRespDTO = repairType.stream() + .filter(item -> item.getValue().equals(tickets.getRepairType())) + .findFirst() + .orElse(null); + if (dictDataRespDTO != null){ + type = dictDataRespDTO.getLabel(); + } + // 构建消息 + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String start = format.format(noticeCusVO.getTime()[0]); + String end = format.format(noticeCusVO.getTime()[1]); + String message = String.format( + "尊敬的客户您好:您的爱车%s已%s完毕,请您于%s至%s之内前来取车。若有问题可以联系%s,联系电话:%s" + , tickets.getCarNo(), type, start, end, noticeCusVO.getName(), noticeCusVO.getMobile() + ); + // todo 小程序通知客户 + // todo 短信通知客户 + // 记录日志 + String recordStr = noticeCusVO.getName() + + "通知客户:" + + cus.getCusName() + + "于" + + start + + "至" + + end + + "前来取车"; + repairRecordsService.saveRepairRecord(noticeCusVO.getId(), null, RecordTypeEnum.JSGD.getCode(), recordStr, null); + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java new file mode 100644 index 00000000..c1ad5192 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/NoticeCusVO.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.tickets.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Data +public class NoticeCusVO { + + /** 维修工单ID */ + private String id; + + /** 取车时间 */ + @Schema(pattern = "时间区间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date[] time; + + /** 联系人 */ + private String name; + + /** 联系电话 */ + private String mobile; + + /** 备注 */ + private String remark; +} diff --git a/sql/增量DB.sql b/sql/增量DB.sql index 6c0fb9af..0d3cfeac 100644 --- a/sql/增量DB.sql +++ b/sql/增量DB.sql @@ -1,3 +1,4 @@ --增加封面图字段用来回显首页 ALTER TABLE `system_service_package` ADD COLUMN `cover_img` varchar(255) NULL COMMENT '服务icon' AFTER `menu_ids`; +INSERT INTO `sys_config`(`config_id`, `config_name`, `config_key`, `config_value`, `config_type`, `creator`, `create_time`, `updater`, `update_time`, `remark`) VALUES (10, '检测工单', 'inspection_work_order', '

\r\n
\r\n

\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n                                              title\r\n
\r\n 地址\r\n \r\n buyAdress\r\n
\r\n 客户名称\r\n \r\n buyName\r\n \r\n 电话\r\n \r\n buyPhone\r\n
\r\n 上线日期\r\n \r\n 车牌\r\n \r\n 车架号\r\n \r\n 检测类型\r\n \r\n 检测项目\r\n \r\n 检测费用\r\n \r\n 优惠金额\r\n \r\n 实收金额\r\n
\r\n timeStr
\r\n
\r\n carNum\r\n \r\n carIdNo\r\n \r\n goodsTitle\r\n \r\n skuName\r\n \r\n goodsPrice
\r\n
\r\n reduceMoney\r\n \r\n realPayMoney\r\n
\r\n                                                   合计:\r\n \r\n goodsPrice\r\n \r\n reduceMoney\r\n \r\n realPayMoney\r\n
\r\n 支付方式\r\n \r\n payType\r\n
\r\n 备注:payRemark\r\n
\r\n 客户:buyName\r\n \r\n 服务顾问:workName\r\n \r\n 收银员:\r\n \r\n workName\r\n
', 'N', '', NULL, '', NULL, NULL); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index bdf9cc09..f9fcd2e9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -19,12 +19,14 @@ import cn.iocoder.yudao.module.system.controller.admin.user.LoginBody; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.service.ServicePackageDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.service.auth.AdminAuthService; import cn.iocoder.yudao.module.system.service.permission.MenuService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; +import cn.iocoder.yudao.module.system.service.service.ServicePackageService; import cn.iocoder.yudao.module.system.service.social.SocialClientService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import io.swagger.v3.oas.annotations.Operation; @@ -32,6 +34,7 @@ import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -39,6 +42,7 @@ import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -75,6 +79,8 @@ public class AuthController { private PermissionApi permissionApi; @Resource private RoleApi roleApi; + @Resource + private ServicePackageService servicePackageService; @PostMapping("/login") @@ -185,7 +191,7 @@ public class AuthController { @GetMapping("/get-permission-info") @Operation(summary = "获取登录用户的权限信息") - public CommonResult getPermissionInfo() { + public CommonResult getPermissionInfo(String routeCode) { // 1.1 获得用户信息 AdminUserDO user = userService.getUser(getLoginUserId()); if (user == null) { @@ -202,6 +208,12 @@ public class AuthController { // 1.3 获得菜单列表 Set menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId)); + //过滤出来当前服务的菜单 + if (StringUtils.isNotEmpty(routeCode)){ + ServicePackageDO servicePackage = servicePackageService.getServicePackage(routeCode); + Set servicePackageMenuIds = servicePackage.getMenuIds(); + menuIds= menuIds.stream().filter(servicePackageMenuIds::contains).collect(Collectors.toSet()); + } List menuList = menuService.getMenuList(menuIds); menuList = menuService.filterDisableMenus(menuList);