车辆打标签

This commit is contained in:
“hhk” 2024-08-07 16:22:27 +08:00
parent 743f529c31
commit 912b404610
7 changed files with 51 additions and 16 deletions

View File

@ -5,7 +5,9 @@ import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -16,8 +18,8 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import javax.validation.Valid;
import java.util.*;
import java.io.IOException;
@ -25,6 +27,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.common.BaseConstants.TABLE_BASE_CAR_MAIN;
import static cn.iocoder.yudao.common.BaseConstants.TABLE_BASE_CUSTOMER_MAIN;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
@ -40,9 +44,12 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Validated
public class CarMainController {
@Resource
@Autowired
private CarMainService carMainService;
@Autowired
private BusiLabelService busiLabelService;
/**
* 创建车辆信息
*
@ -141,9 +148,24 @@ public class CarMainController {
@PostMapping("/bindCustomerCar")
@Operation(summary = "绑定用户")
@PreAuthorize("@ss.hasPermission('base:car-main:bindCustomer')")
public CommonResult<Boolean> bindCustomerCar(@RequestBody CustomerMainSaveReqVO saveReqVO) {
public CommonResult<Boolean> bindCustomerCar(@RequestBody CarMainReqVO saveReqVO) {
carMainService.bindCustomAndCar(saveReqVO);
return success(true);
}
/**
* 设置标签
*
* @param saveReqVO CustomerMainSaveReqVO
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 16:35 2024/8/6
**/
@PostMapping("/setLabel")
@Operation(summary = "设置标签")
public CommonResult<Boolean> setLabel(@RequestBody CarMainReqVO saveReqVO) {
busiLabelService.saveBusiLable(saveReqVO.getId(), TABLE_BASE_CAR_MAIN, saveReqVO.getLabelList());
return success(true);
}
}

View File

@ -65,5 +65,5 @@ public interface CarMainService extends IService<CarMain> {
* @param saveReqVO CustomerMainSaveReqVO实体
* @return void
**/
void bindCustomAndCar(CustomerMainSaveReqVO saveReqVO);
void bindCustomAndCar(CarMainReqVO saveReqVO);
}

View File

@ -1,14 +1,9 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
import cn.iocoder.yudao.module.custom.entity.CustomerItem;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
import cn.iocoder.yudao.module.custom.mapper.CustomerCarMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
@ -16,8 +11,8 @@ import cn.iocoder.yudao.module.custom.service.CustomerCarService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import cn.iocoder.yudao.module.label.service.BusiLabelService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -30,7 +25,6 @@ import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CAR;
import static cn.iocoder.yudao.common.BaseConstants.CUS_SIGN_CUSTOMER;
/**
* 车辆信息 Service 实现类
@ -46,6 +40,10 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
@Autowired
private CustomerCarService customerCarService;
@Autowired
private BusiLabelService busiLabelService;
/**
* 创建车辆信息
*
@ -128,6 +126,10 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
List<CustomerMainRespVO> cusList = customerCarMapper.selectCusListByCarId(id);
result.setCusList(cusList);
//联查标签信息
List<BusiLabel> labelList = busiLabelService.listByMainId(id);
result.setLabelList(labelList);
return result;
}
@ -152,7 +154,7 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
* @return void
**/
@Override
public void bindCustomAndCar(CustomerMainSaveReqVO saveReqVO) {
public void bindCustomAndCar(CarMainReqVO saveReqVO) {
List<CustomerCar> customerCars = new ArrayList<>();
List<CustomerMainRespVO> cusList = saveReqVO.getCusList();
if (ObjectUtil.isNotEmpty(cusList)){

View File

@ -1,10 +1,12 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -78,4 +80,9 @@ public class CarMainReqVO extends PageParam {
@Schema(description = "租户ID")
private String tenantId;
@Schema(description = "车辆绑定客户信息")
private List<CustomerMainRespVO> cusList;
@Schema(description = "车辆绑定标签信息")
List<BusiLabel> labelList;
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.label.entity.BusiLabel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
@ -25,9 +26,12 @@ public class CarMainRespVO extends CarMain {
@Schema(description = "是否车主0否1是")
private String isOwner;
@Schema(description = "创建时间")
@Schema(description = "关联客户信息")
private List<CustomerMainRespVO> cusList;
@Schema(description = "标签信息")
List<BusiLabel> labelList;

View File

@ -0,0 +1,2 @@
package cn.iocoder.yudao.module.custom.vo;public class CascaderOptionsVO {
}

View File

@ -16,8 +16,6 @@ public class CustomerMainSaveReqVO extends CustomerMain {
private List<CustomerItem> itemList;
/**客户绑定车辆信息*/
private List<CarMainRespVO> carList;
/**客户绑定车辆信息*/
private List<CustomerMainRespVO> cusList;
/**标签信息*/
List<BusiLabel> labelList;