This commit is contained in:
xiaofajia 2024-10-25 22:04:31 +08:00
commit 13273992ed
11 changed files with 162 additions and 31 deletions

View File

@ -1,15 +1,13 @@
package cn.iocoder.yudao.module.supplier.controller.admin; package cn.iocoder.yudao.module.supplier.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService; import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -123,8 +121,20 @@ public class BaseSupplierController {
**/ **/
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "获得所有供应商") @Operation(summary = "获得所有供应商")
// @PreAuthorize("@ss.hasPermission('supplier:base-supplier:query')")
public CommonResult<?> getBaseSupplierList(){ public CommonResult<?> getBaseSupplierList(){
return success(baseSupplierService.list()); return success(baseSupplierService.list());
} }
/**
* 根据输入名称模糊查询供应商
* @author 小李
* @date 9:23 2024/9/13
**/
@GetMapping("/searchList")
@Operation(summary = "根据输入名称模糊查询供应商")
public CommonResult<?> searchList(String name){
LambdaQueryWrapper<BaseSupplier> queryWrapper = new LambdaQueryWrapper<BaseSupplier>()
.like(BaseSupplier::getName,name);
return success(baseSupplierService.list(queryWrapper));
}
} }

View File

@ -1,6 +1,5 @@
package cn.iocoder.yudao.module.supplier.service; package cn.iocoder.yudao.module.supplier.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
@ -9,8 +8,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
/** /**
* 供应商 Service 接口 * 供应商 Service 接口
* *
@ -28,6 +25,15 @@ public interface BaseSupplierService extends IService<BaseSupplier> {
**/ **/
void saveBaseSupplier(BaseSupplierSaveReqVO saveReqVO); void saveBaseSupplier(BaseSupplierSaveReqVO saveReqVO);
/**
* 生成采购单选择供应商
* @author PQZ
* @date 17:43 2024/10/25
* @param supplierName 供应商名称
* @return java.lang.String
**/
String appSaveSupplier(String supplierName);
/** /**
* 删除供应商信息 * 删除供应商信息
* *

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.supplier.service.impl; package cn.iocoder.yudao.module.supplier.service.impl;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplier; import cn.iocoder.yudao.module.supplier.entity.BaseSupplier;
import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount; import cn.iocoder.yudao.module.supplier.entity.BaseSupplierAccount;
import cn.iocoder.yudao.module.supplier.mapper.BaseSupplierMapper; import cn.iocoder.yudao.module.supplier.mapper.BaseSupplierMapper;
@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierPageReqVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierRespVO;
import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO; import cn.iocoder.yudao.module.supplier.vo.BaseSupplierSaveReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -51,6 +52,30 @@ public class BaseSupplierServiceImpl extends ServiceImpl<BaseSupplierMapper, Bas
baseSupplierAccountService.saveBaseSupplierAccount(baseSupplier.getId(),saveReqVO.getAccountList()); baseSupplierAccountService.saveBaseSupplierAccount(baseSupplier.getId(),saveReqVO.getAccountList());
} }
/**
* 生成采购单选择供应商
*
* @param supplierName 供应商名称
* @return java.lang.String
* @author PQZ
* @date 17:43 2024/10/25
**/
@Override
public String appSaveSupplier(String supplierName) {
LambdaQueryWrapper<BaseSupplier> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(BaseDO::getDeleted,0).eq(BaseSupplier::getName,supplierName);
List<BaseSupplier> list = list(lambdaQueryWrapper);
if (!list.isEmpty()){
//存在供应商
return list.get(0).getId();
} else {
BaseSupplier supplier = new BaseSupplier();
supplier.setName(supplierName);
save(supplier);
return supplier.getId();
}
}
/** /**
* 删除供应商信息 * 删除供应商信息

View File

@ -9,6 +9,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo; import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService; import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
@ -38,6 +40,8 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/** /**
* 请填写功能名称Service业务层处理 * 请填写功能名称Service业务层处理
* *
@ -68,7 +72,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private IDelOrderInfoService delInspectionOrderService; private IDelOrderInfoService delInspectionOrderService;
@Autowired @Autowired
private IDelInspectionInfoService delInspectionInfoService; private IDelInspectionInfoService delInspectionInfoService;
@Resource
private CustomerMainService customerMainService;
/** /**
* 查询请填写功能名称 * 查询请填写功能名称
* *
@ -195,6 +200,12 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
customerInfo.setCustomerName(user.getNickname()); customerInfo.setCustomerName(user.getNickname());
customerInfo.setSex("0"); customerInfo.setSex("0");
customerInfo.setUserAge(user.getUserAge()); customerInfo.setUserAge(user.getUserAge());
// 设置客户来源
CustomerMain customerMain = new CustomerMain();
customerMain.setDataFrom("01");
customerMainService.saveOrUpdate(customerMain);
customerInfoService.insertPartnerCustomerInfo(customerInfo); customerInfoService.insertPartnerCustomerInfo(customerInfo);
} }
//追加订单明细记录 //追加订单明细记录

View File

@ -248,7 +248,7 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
customerMain.setIsHangAccount("0"); customerMain.setIsHangAccount("0");
customerMain.setTypeCode("01"); customerMain.setTypeCode("01");
// 设置客户初始来源 // 设置客户初始来源
customerMain.setDataFrom("01"); //customerMain.setDataFrom("01");
// 设置注册方式 // 设置注册方式
customerMain.setInviterType("01"); customerMain.setInviterType("01");

View File

@ -16,4 +16,6 @@ public class RepairCons {
public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type"; public static final String DICT_REPAIR_RECORDS_TYPE = "repair_records_type";
/**数据字典常量-repair_type-*/ /**数据字典常量-repair_type-*/
public static final String DICT_REPAIR_TYPE = "repair_type"; public static final String DICT_REPAIR_TYPE = "repair_type";
/**数据字典常量-repair_unit-*/
public static final String DICT_REPAIR_UNIT = "repair_unit";
} }

View File

@ -64,9 +64,9 @@ public class DlRepairSoController {
/** /**
* 采购单/领料单 作废 * 采购单/领料单 作废
* *
* @param repairSoReqVO 作废对象
* @author 小李 * @author 小李
* @date 11:12 2024/9/18 * @date 11:12 2024/9/18
* @param repairSoReqVO 作废对象
**/ **/
@PostMapping("/void") @PostMapping("/void")
@Operation(summary = "采购单/领料单 作废") @Operation(summary = "采购单/领料单 作废")
@ -78,26 +78,26 @@ public class DlRepairSoController {
/** /**
* 采购单/领料单 查看 * 采购单/领料单 查看
* *
* @param id 主键
* @author 小李 * @author 小李
* @date 9:34 2024/9/22 * @date 9:34 2024/9/22
* @param id 主键
**/ **/
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "采购单/领料单 查看") @Operation(summary = "采购单/领料单 查看")
public CommonResult<?> getRepairSoById(@RequestParam("id") String id){ public CommonResult<?> getRepairSoById(@RequestParam("id") String id) {
return success(dlRepairSoService.getRepairSoById(id)); return success(dlRepairSoService.getRepairSoById(id));
} }
/** /**
* 员工确认领料 * 员工确认领料
* *
* @param id 单据ID 领料单主表
* @author 小李 * @author 小李
* @date 11:58 2024/10/21 * @date 11:58 2024/10/21
* @param id 单据ID 领料单主表
**/ **/
@GetMapping("/confirmGet") @GetMapping("/confirmGet")
@Operation(summary = "员工确认领料") @Operation(summary = "员工确认领料")
public CommonResult<?> confirmGet(@RequestParam("id") String id){ public CommonResult<?> confirmGet(@RequestParam("id") String id) {
dlRepairSoService.confirmGet(id); dlRepairSoService.confirmGet(id);
return CommonResult.ok(); return CommonResult.ok();
} }
@ -105,15 +105,31 @@ public class DlRepairSoController {
/** /**
* 员工确认退料 * 员工确认退料
* *
* @param id 退料单主表ID
* @author 小李 * @author 小李
* @date 19:41 2024/10/21 * @date 19:41 2024/10/21
* @param id 退料单主表ID
**/ **/
@GetMapping("/confirmBack") @GetMapping("/confirmBack")
@Operation(summary = "员工确认退料") @Operation(summary = "员工确认退料")
public CommonResult<?> confirmBack(@RequestParam("id") String id){ public CommonResult<?> confirmBack(@RequestParam("id") String id) {
dlRepairSoService.confirmBack(id); dlRepairSoService.confirmBack(id);
return CommonResult.ok(); return CommonResult.ok();
} }
/**
* 采购入库
*
* @param repairSoReqVO DlRepairSoReqVO实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
* @author PQZ
* @date 10:43 2024/10/25
**/
@PostMapping("/inWare")
@Operation(summary = "采购入库")
public CommonResult<?> inWare(@RequestBody DlRepairSoReqVO repairSoReqVO) {
dlRepairSoService.inWare(repairSoReqVO);
return CommonResult.ok();
}
} }

View File

@ -18,6 +18,7 @@ import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService; import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
@ -36,6 +37,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -91,6 +93,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
private RepairWorkerService repairWorkerService; private RepairWorkerService repairWorkerService;
@Resource @Resource
private AdminUserApi userApi; private AdminUserApi userApi;
@Resource
private BaseSupplierService supplierService;
@Resource @Resource
@Lazy @Lazy
@ -107,6 +111,16 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override @Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) { public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date()); repairSoRespVO.setSoTime(new Date());
//保存供应商
if (StringUtils.isEmpty(repairSoRespVO.getSupplierId())){
//采购单中录入供应商或无供应商情况
if (StringUtils.isNotEmpty(repairSoRespVO.getSupplierName())){
//没有选择直接录入的情况
String supplierId = supplierService.appSaveSupplier(repairSoRespVO.getSupplierName());
//为供应商id赋值
repairSoRespVO.setSupplierId(supplierId);
}
}
// 取当前登录用户的门店信息 // 取当前登录用户的门店信息
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId(); Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
repairSoRespVO.setDeptId(deptId); repairSoRespVO.setDeptId(deptId);

View File

@ -70,8 +70,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME; import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_RECORDS_TYPE; import static cn.iocoder.yudao.common.RepairCons.*;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
@ -299,9 +298,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
// 取配件 // 取配件
List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList()); List<DlRepairTitemReqVO> wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(wares)) { if (CollectionUtil.isNotEmpty(wares)) {
// 单位字典
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
Map<String,String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet()); Set<String> ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet());
List<RepairWares> repairWares = waresService.listByIds(ids); List<RepairWares> repairWares = waresService.listByIds(ids);
items.forEach(item -> repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare)); items.forEach(item -> {
repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare);
item.setItemUnit(unitMap.get(item.getItemUnit()));
});
} }
result.setWares(wares); result.setWares(wares);
// 取附加 // 取附加

View File

@ -4,9 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService; import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
import cn.iocoder.yudao.module.tickets.entity.DlTwItem; import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper; import cn.iocoder.yudao.module.tickets.mapper.DlTwItemMapper;
import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService;
import cn.iocoder.yudao.module.tickets.service.DlTwItemService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO; import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO; import cn.iocoder.yudao.module.tickets.vo.DlTwItemRespVO;
@ -20,6 +21,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_UNIT;
/** /**
* 针对表dl_tw_item(工单配件申请/退回子表)的数据库操作Service实现 * 针对表dl_tw_item(工单配件申请/退回子表)的数据库操作Service实现
* *
@ -32,10 +35,8 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
@Resource @Resource
private RepairWaresService repairWaresService; private RepairWaresService repairWaresService;
@Resource @Resource
@Lazy private DictDataApi dictDataApi;
private DlTicketWaresService ticketWaresService;
@Resource @Resource
@Lazy @Lazy
private RepairWaresService waresService; private RepairWaresService waresService;
@ -57,6 +58,9 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
for(Map<String,String> map:typeMapList){ for(Map<String,String> map:typeMapList){
typeMap.put(map.get("id"),map.get("name")); typeMap.put(map.get("id"),map.get("name"));
} }
// 单位字典
List<DictDataRespDTO> recordTypeList = dictDataApi.getDictDataList(DICT_REPAIR_UNIT);
Map<String,String> unitMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
// 查配件详情 // 查配件详情
List<String> ids = dlTwItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList()); List<String> ids = dlTwItems.stream().map(DlTwItem::getWaresId).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(ids)){ if (CollectionUtil.isNotEmpty(ids)){
@ -68,6 +72,7 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
.findFirst() .findFirst()
.ifPresent(bean::setWares); .ifPresent(bean::setWares);
bean.setTypeName(typeMap.get(bean.getWares().getType())); bean.setTypeName(typeMap.get(bean.getWares().getType()));
bean.getWares().setUnit(unitMap.get(bean.getWares().getUnit()));
return bean; return bean;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

View File

@ -3,9 +3,14 @@ package cn.iocoder.yudao.module.rescue.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.CoordinateUtil; import cn.hutool.core.util.CoordinateUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
import cn.iocoder.yudao.module.rescue.domain.*; import cn.iocoder.yudao.module.rescue.domain.*;
import cn.iocoder.yudao.module.rescue.mapper.RescueDriverInfoMapper; import cn.iocoder.yudao.module.rescue.mapper.RescueDriverInfoMapper;
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue; import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
import cn.iocoder.yudao.module.shop.entity.ShopUserCar;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi; import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
@ -72,6 +77,10 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
private WechatPayConfig wechatPayConfig; private WechatPayConfig wechatPayConfig;
@Resource @Resource
private RedissonDelayQueue redissonDelayQueue; private RedissonDelayQueue redissonDelayQueue;
@Autowired
private IPartnerCustomerInfoService customerInfoService;
@Resource
private CustomerMainService customerMainService;
public static String Redis_Driver_Key = "Rescue:Driver:"; public static String Redis_Driver_Key = "Rescue:Driver:";
public static String Redis_Driver_Position_Key = "DriverPosition:"; public static String Redis_Driver_Position_Key = "DriverPosition:";
@ -581,6 +590,33 @@ public class RescueDriverInfoServiceImpl extends ServiceImpl<RescueDriverInfoMap
//处理redis //处理redis
DriverInfo driverInfo = driverInfoService.getById(rescueInfo.getDriverId()); DriverInfo driverInfo = driverInfoService.getById(rescueInfo.getDriverId());
AdminUserRespDTO user = userService.getUser(driverInfo.getUserId()); AdminUserRespDTO user = userService.getUser(driverInfo.getUserId());
// 收集客户信息
PartnerCustomerInfo customerInfo = new PartnerCustomerInfo();
customerInfo.setCustomerName(rescueInfo.getConnectionName());
customerInfo.setCustomerPhone(rescueInfo.getConnectionPhone());
customerInfo.setUserId(rescueInfo.getUserId());
// 收集客户车辆信息
List<ShopUserCar> userCarList = new ArrayList<>();
ShopUserCar userCar = new ShopUserCar();
userCar.setCarNo(rescueInfo.getLicenseNum());
userCar.setCarModel(rescueInfo.getCarType());
userCar.setCarBrand(rescueInfo.getCarBrand());
userCar.setUserId(user.getId());
userCarList.add(userCar);
customerInfo.setUserCarList(userCarList);
// 设置客户来源
CustomerMain customerMain = new CustomerMain();
customerMain.setDataFrom("02");
customerMainService.saveOrUpdate(customerMain);
// 调用插入客户信息的方法
customerInfoService.insertPartnerCustomerInfo(customerInfo);
//所在顶级机构 //所在顶级机构
String redisKey = Redis_Driver_Key + driverInfo.getTenantId() + ":" + rescueInfo.getDriverId(); String redisKey = Redis_Driver_Key + driverInfo.getTenantId() + ":" + rescueInfo.getDriverId();
Object temp = redisCache.getCacheMapValue(redisKey, "rescueIds"); Object temp = redisCache.getCacheMapValue(redisKey, "rescueIds");