# Conflicts:
#	dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/controller/admin/DlRepairTicketsController.java
#	dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java
#	dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java
This commit is contained in:
Vinjor 2024-10-24 15:06:06 +08:00
commit 6fe4bd85f8
17 changed files with 353 additions and 74 deletions

View File

@ -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<WarnMessage> list = warnMessageService.pageList(page,warnMessage);
return success(list);
}
@PostMapping("/export")
public void export(HttpServletResponse response, WarnMessage warnMessage) throws Exception {
List<WarnMessage> list = warnMessageService.selectWarnMessageList(warnMessage);

View File

@ -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<WarnMessage>
*/
public List<WarnMessage> selectWarnMessageList(WarnMessage warnMessage);
IPage<WarnMessage> pageList(Page page,@Param("warnMessage") WarnMessage warnMessage);
}

View File

@ -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<WarnMessage>
* @return warnMsg集合
*/
public List<WarnMessage> selectWarnMessageList(WarnMessage warnMessage) throws Exception;
IPage<WarnMessage> pageList(Page page,WarnMessage warnMessage) throws Exception;
/**
* 新增warnMsg

View File

@ -195,7 +195,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
customerInfo.setCustomerName(user.getNickname());
customerInfo.setSex("0");
customerInfo.setUserAge(user.getUserAge());
customerInfoService.save(customerInfo);
customerInfoService.insertPartnerCustomerInfo(customerInfo);
}
//追加订单明细记录
orderInfoDetailService.save(new OrderInfoDetail(orderInfo.getId(),"线下订单创建",new Date(),0L,"1"));

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.inspection.service.impl;
import java.util.Arrays;
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.impl.ServiceImpl;
import cn.iocoder.yudao.util.DateUtils;
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
@ -53,6 +55,15 @@ public class WarnMessageServiceImpl extends ServiceImpl<WarnMessageMapper,WarnMe
return warnMessages;
}
@Override
public IPage<WarnMessage> pageList(Page page, WarnMessage warnMessage) throws Exception {
ShopMallPartners partners = partnerService.shopInfo();
warnMessage.setPartnerId(partners.getPartnerId());
warnMessage.setIsRead("0");
IPage<WarnMessage> warnMessages = baseMapper.pageList(page,warnMessage);
return warnMessages;
}
/**
* 新增warnMsg
*

View File

@ -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<PartnerCustomerI
private PartnerCustomerInfoMapper customerInfoMapper;
@Autowired
private PartnerCustomerInfoMapper partnerCustomerInfoMapper;
@Resource
private CustomerMainService customerMainService;
@Autowired
private CarMainService carMainService;
@Resource
private CustomerCarService customerCarService;
/**
* 查询客户信息列表
@ -112,20 +128,27 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
@Override
@Transactional(rollbackFor = Exception.class)
public int insertPartnerCustomerInfo(PartnerCustomerInfo partnerCustomerInfo) throws Exception {
// 获取当前商户信息
ShopMallPartners partners = partnerService.shopInfo();
LambdaQueryWrapper<PartnerCustomerInfo> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(PartnerCustomerInfo::getPartnerId,partners.getPartnerId()).eq(PartnerCustomerInfo::getCustomerPhone,partnerCustomerInfo.getCustomerPhone());
// 检查客户是否已存在
LambdaQueryWrapper<PartnerCustomerInfo> 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)){
RoleDO role = roleService.queryRole("jcyh");
// 查找或创建用户
AdminUserDO user = userService.selectUserByPhone(partnerCustomerInfo.getCustomerPhone());
if (ObjectUtils.isEmpty(user)) {
RoleDO role = roleService.queryRole("jcyh");
if (role != null) {
UserSaveReqVO userSaveReqVO = new UserSaveReqVO();
user = new AdminUserDO();
BeanUtils.copyProperties(partnerCustomerInfo,user);
BeanUtils.copyProperties(partnerCustomerInfo, user);
userSaveReqVO.setUsername(partnerCustomerInfo.getCustomerPhone());
userSaveReqVO.setNickname(partnerCustomerInfo.getCustomerName());
userSaveReqVO.setPassword("123456");
@ -133,62 +156,151 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
user.setId(uid);
Set<Long> ids = new HashSet<>();
ids.add(role.getId());
permissionService.assignUserRole(uid,ids);
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<Long> ids = new HashSet<>();
ids.add(sysRole.getId());
permissionService.assignUserRole(user.getId(),ids);
permissionService.assignUserRole(user.getId(), ids);
}
// 车辆信息处理
List<ShopUserCar> userCarList = partnerCustomerInfo.getUserCarList();
if (CollectionUtil.isNotEmpty(userCarList)){
List<CarMain> saveCarList = new ArrayList<>();
List<CustomerCar> saveCustomerCarList = new ArrayList<>();
List<ShopUserCar> saveUserCarList = new ArrayList<>();
UserCar userCar1 = new UserCar();
if (CollectionUtil.isNotEmpty(userCarList)) {
for (ShopUserCar shopUserCar : userCarList) {
LambdaQueryWrapper<ShopUserCar> 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());
// 生成车辆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()));
// 保存车辆信息
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 (null!=shopUserCar.getMaintenanceMileage()){
one.setMaintenanceMileage(shopUserCar.getMaintenanceMileage());
}
if (null!=shopUserCar.getInspectionDate()){
one.setInspectionDate(shopUserCar.getInspectionDate());
}
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);
// 验证手机号
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<ShopUserCar> 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;
}
/**
* 修改客户信息
*

View File

@ -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);
}
}

View File

@ -209,8 +209,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<select id="pageWorkOrder" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
select 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,ins.create_time
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
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

View File

@ -20,7 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select * from warn_message
where id = #{id}
</select>
<select id="pageList" resultType="cn.iocoder.yudao.module.inspection.entity.WarnMessage">
select * from warn_message
<where>
and warn_time <![CDATA[<=]]> NOW()
<if test="warnMessage.title != null and warnMessage.title != ''"> and title = #{warnMessage.title}</if>
<if test="warnMessage.partnerId != null "> and partner_id = #{warnMessage.partnerId}</if>
<if test="warnMessage.isRead != null and warnMessage.isRead != ''"> and is_read = #{warnMessage.isRead}</if>
</where>
order by create_time desc
</select>
</mapper>

View File

@ -19,7 +19,7 @@ public interface RepairRecordsService extends IService<RepairRecords> {
* 保存维修记录
*
* @param ticketId 工单id
* @param repairItemId 工单子表id
// * @param repairItemId 工单子表id
* @param type 工作类型数据字典repair_records_type;后端对应 RecordTypeEnum 枚举
* @param remark 备注
* @param images 图片(相对路径按照,分隔)

View File

@ -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<DlRepairSoMapper, DlRepai
@DSTransactional
@Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date());
// 取当前登录用户的门店信息
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
repairSoRespVO.setDeptId(deptId);

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
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.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.apache.commons.lang3.StringUtils;
@ -305,5 +306,19 @@ public class DlRepairTicketsController {
public CommonResult<?> 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();
}
}

View File

@ -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<DlRepairTickets> {
* @return java.util.Map<java.lang.String,java.lang.Integer>
**/
Map<String,Integer> getBossNum();
/**
* 服务顾问通知客户取车
*
* @author 小李
* @date 22:40 2024/10/23
* @param noticeCusVO 请求对象
**/
void noticeCus(NoticeCusVO noticeCusVO);
}

View File

@ -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<DlRepairTicketsMappe
/**
* 维修总检完成总检
*
* @param respVO 请求对象
* @author 小李
* @date 16:48 2024/10/23
* @param respVO 请求对象
**/
@Override
@DSTransactional
public void inspection(DlRepairTicketsRespVO respVO){
public void inspection(DlRepairTicketsRespVO respVO) {
// 新增日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.ZJ.getCode(), respVO.getRemark(), respVO.getImage());
// 更新工单
@ -759,12 +759,12 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
/**
* 服务顾问上传出厂检验日志
*
* @param respVO 请求对象
* @author 小李
* @date 17:47 2024/10/23
* @param respVO 请求对象
**/
@Override
public void confirm(DlRepairTicketsRespVO respVO){
public void confirm(DlRepairTicketsRespVO respVO) {
// 更新工单状态
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
@ -801,6 +801,52 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
rtnMap.put("doneNum",doneNum);
return rtnMap;
}
/**
* 服务顾问通知客户取车
*
* @param noticeCusVO 请求对象
* @author 小李
* @date 22:40 2024/10/23
**/
@Override
@DSTransactional
public void noticeCus(NoticeCusVO noticeCusVO) {
// 获取客户信息
DlRepairTickets tickets = baseMapper.selectById(noticeCusVO.getId());
CustomerMain cus = customerService.getById(tickets.getUserId());
// 维修项目
List<DictDataRespDTO> 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);
}
}

View File

@ -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;
}

File diff suppressed because one or more lines are too long

View File

@ -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<AuthPermissionInfoRespVO> getPermissionInfo() {
public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo(String routeCode) {
// 1.1 获得用户信息
AdminUserDO user = userService.getUser(getLoginUserId());
if (user == null) {
@ -202,6 +208,12 @@ public class AuthController {
// 1.3 获得菜单列表
Set<Long> menuIds = permissionService.getRoleMenuListByRoleId(convertSet(roles, RoleDO::getId));
//过滤出来当前服务的菜单
if (StringUtils.isNotEmpty(routeCode)){
ServicePackageDO servicePackage = servicePackageService.getServicePackage(routeCode);
Set<Long> servicePackageMenuIds = servicePackage.getMenuIds();
menuIds= menuIds.stream().filter(servicePackageMenuIds::contains).collect(Collectors.toSet());
}
List<MenuDO> menuList = menuService.getMenuList(menuIds);
menuList = menuService.filterDisableMenus(menuList);