Compare commits

...

4 Commits

10 changed files with 191 additions and 4 deletions

View File

@ -101,6 +101,4 @@ public class BaseTypeController {
public CommonResult<List<BaseTypeRespVO>> getBaseTypeList(@Valid BaseTypeListReqVO listReqVO) {
return success(baseTypeService.getBaseTypeList(listReqVO));
}
}

View File

@ -77,7 +77,8 @@ public class CarBrandController {
@GetMapping("/get")
@Operation(summary = "获得车辆品牌")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:car-brand:query')")
// 有些地方要用但是又没有权限故把查看单个的权限公开---小李
// @PreAuthorize("@ss.hasPermission('base:car-brand:query')")
public CommonResult<CarBrandRespVO> getCarBrand(@RequestParam("id") String id) {
CarBrand carBrand = carBrandService.getCarBrand(id);
return success(BeanUtils.toBean(carBrand, CarBrandRespVO.class));

View File

@ -424,5 +424,18 @@ public class DlRepairTicketsController {
dlRepairTicketsService.removeTicketById(id);
return CommonResult.ok();
}
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
@GetMapping("/getCusAndCarById")
@Operation(summary = "根据工单ID查客户和车辆信息")
public CommonResult<?> getCusAndCarById(@RequestParam("id") String id) {
return success(dlRepairTicketsService.getCusAndCarById(id));
}
}

View File

@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
@ -181,5 +183,32 @@ public class DlTicketWaresController {
public CommonResult<?> getById(@RequestParam("id") String id){
return success(dlTicketWaresService.getById(id));
}
/**
* 修改是否传给保险公司
*
* @author 小李
* @date 15:48 2024/11/18
* @param respVO 对象
**/
@PostMapping("/updateSafe")
@Operation(summary = "修改是否传给保险公司")
public CommonResult<?> updateSafe(@RequestBody DlTicketWaresRespVO respVO){
dlTicketWaresService.updateSafe(respVO);
return CommonResult.ok();
}
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
@GetMapping("/getByIds")
@Operation(summary = "根据选择的配件生成采购单需要的数据")
public CommonResult<?> getByIds(@RequestParam("ids") List<String> ids){
return success(dlTicketWaresService.getByIds(ids));
}
}

View File

@ -68,4 +68,16 @@ public class DlTicketWares extends TenantBaseDO {
/** 多个图片地址,英文逗号分隔(拍照上传配件申请单时用) */
private String images;
/** 是否传给保险公司(字典yes_no1:是0:否默认0) */
private String toSafe;
/** 保险公司名称 */
private String safeName;
/** 保险公司联系人 */
private String safeContact;
/** 保险公司联系电话 */
private String safeMobile;
}

View File

@ -252,4 +252,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @date 15:00 2024/11/16
**/
Boolean hasPrice(String id);
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
CustomerAndCarVO getCusAndCarById(String id);
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.tickets.service;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
@ -104,4 +105,22 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
* @date 15:38 2024/10/22
**/
Map<String,Integer> getWorkerTodo();
/**
* 修改是否传给保险公司
*
* @author 小李
* @date 15:48 2024/11/18
* @param respVO 对象
**/
void updateSafe(DlTicketWaresRespVO respVO);
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
Map<String, List<DlTwItemRespVO>> getByIds(List<String> ids);
}

View File

@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.custom.entity.*;
import cn.iocoder.yudao.module.custom.service.*;
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.order.entity.RepairOrderInfo;
@ -1782,6 +1783,28 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 记录日志
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JC.getCode(), respVO.getRemark(), respVO.getImage());
}
/**
* 根据工单ID查客户和车辆信息
*
* @author 小李
* @date 19:07 2024/11/18
* @param id id
**/
@Override
public CustomerAndCarVO getCusAndCarById(String id){
// 查工单
DlRepairTickets tickets = baseMapper.selectById(id);
// 查用户
CustomerMain customerMain = customerService.getById(tickets.getUserId());
// 查车辆
CarMain carMain = carMainService.getById(tickets.getCarId());
// 映射
CustomerAndCarVO customerAndCarVO = new CustomerAndCarVO();
customerAndCarVO.setUserInfo(customerMain);
customerAndCarVO.setCarInfo(BeanUtil.toBean(carMain, CarMainReqVO.class));
return customerAndCarVO;
}
}

View File

@ -11,6 +11,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.conf.entity.BaseType;
import cn.iocoder.yudao.module.conf.service.BaseTypeService;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
@ -33,10 +35,12 @@ import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTicketWaresRespVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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 org.springframework.context.annotation.Lazy;
@ -103,6 +107,9 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Resource
private CustomerMainService customerMainService;
@Resource
private BaseTypeService baseTypeService;
/**
* 分页查询
*
@ -627,6 +634,74 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
return rtnMap;
}
/**
* 修改是否传给保险公司
*
* @author 小李
* @date 15:48 2024/11/18
* @param respVO 对象
**/
@Override
public void updateSafe(DlTicketWaresRespVO respVO){
// 先取出状态
String toSafe = respVO.getToSafe();
// 准备更新条件
LambdaUpdateWrapper<DlTicketWares> lambdaUpdate = Wrappers.lambdaUpdate(DlTicketWares.class);
lambdaUpdate.eq(DlTicketWares::getId, respVO.getId());
lambdaUpdate.set(DlTicketWares::getToSafe, respVO.getToSafe());
// 根据状态更新
if (toSafe.equals("1")){
lambdaUpdate.set(DlTicketWares::getSafeName, respVO.getSafeName());
lambdaUpdate.set(DlTicketWares::getSafeContact, respVO.getSafeContact());
lambdaUpdate.set(DlTicketWares::getSafeMobile, respVO.getSafeMobile());
}
// 更新
baseMapper.update(lambdaUpdate);
}
/**
* 根据选择的配件生成采购单需要的数据
*
* @author 小李
* @date 18:14 2024/11/18
* @param ids ids
**/
@Override
public Map<String, List<DlTwItemRespVO>> getByIds(List<String> ids){
// 查配件申请表子表
List<DlTwItem> twItems = twItemService.listByIds(ids);
// 查配件
List<String> waresIds = twItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
List<RepairWares> wares = repairWaresService.listByIds(waresIds);
// 关联配件申请表子项和配件
List<DlTwItemRespVO> newTwItems = twItems.stream().map(item -> {
DlTwItemRespVO twItem = BeanUtil.toBean(item, DlTwItemRespVO.class);
RepairWares ware = wares.stream().filter(i -> i.getId().equals(item.getWaresId())).findFirst().orElse(null);
if (ware != null) {
twItem.setWares(ware);
}
return twItem;
}).collect(Collectors.toList());
// 分组
Map<String, List<DlTwItemRespVO>> map = newTwItems.stream().collect(Collectors.groupingBy(item -> {
String key = item.getWares().getType();
return key != null && !key.isEmpty() ? key : "default";
}));
// 查分类
List<BaseType> baseTypes = baseTypeService.listByIds(map.keySet());
Map<String, String> TypeMap = baseTypes.stream().collect(Collectors.toMap(BaseType::getId, BaseType::getName));
// 映射
Map<String, List<DlTwItemRespVO>> result = new HashMap<>();
for (Map.Entry<String, List<DlTwItemRespVO>> entry : map.entrySet()) {
String key = entry.getKey();
String newKey = TypeMap.get(key);
if (newKey == null || newKey.isEmpty()) {
newKey = "未分类";
}
result.put(newKey, entry.getValue());
}
return result;
}
}

View File

@ -22,6 +22,10 @@
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" />
<result property="images" column="images" />
<result property="toSafe" column="to_safe" />
<result property="safeName" column="safe_name" />
<result property="safeContact" column="safe_contact" />
<result property="safeMobile" column="safe_mobile" />
</resultMap>
<sql id="Base_SQL">
@ -42,7 +46,11 @@
dtw.status,
dtw.remark,
dtw.create_time,
dtw.images
dtw.images,
dtw.to_safe,
dtw.safe_name,
dtw.safe_contact,
dtw.safe_mobile
from dl_ticket_wares dtw
left join dl_repair_tickets drt
on dtw.ticket_id = drt.id