This commit is contained in:
许允枞 2025-04-11 17:57:48 +08:00
parent 323405ea20
commit d2c520c243
22 changed files with 566 additions and 168 deletions

View File

@ -42,4 +42,24 @@ public class InspectionConstants {
* key的类型为设备
*/
public static final String INSPECTION_STAFF_EQUIPMENT_KEY = "equipment";
/**
* 检测接车订单表-没有接车
*/
public static final Integer INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_NO = 0;
/**
* 检测接车订单表-已接车
*/
public static final Integer INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES = 1;
/**
* 接车完成类型 - 工单表
*/
public static final Integer INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_COMPLETE_TYPE_ORDER = 0;
/**
* 接车完成类型 - 接车订单表
*/
public static final Integer INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_COMPLETE_TYPE_MEET_CAR_ORDER = 1;
}

View File

@ -100,8 +100,9 @@ public class InspectionInfoController extends BaseController {
public CommonResult edit(@RequestBody InspectionInfo inspectionInfo) throws Exception {
return toAjax(inspectionInfoService.updateInspectionInfo(inspectionInfo));
}
@PostMapping("/updateLeadMan")
public CommonResult updateLeadMan(@RequestBody InspectionInfo inspectionInfo){
public CommonResult updateLeadMan(@RequestBody InspectionInfo inspectionInfo) {
return toAjax(inspectionInfoService.updateLeadMan(inspectionInfo));
}
@ -257,11 +258,12 @@ public class InspectionInfoController extends BaseController {
/**
* 重新审核
*
* @param inspectionWorkNode
* @return
*/
@PostMapping("recheck")
public CommonResult recheck(@RequestBody InspectionWorkNode inspectionWorkNode){
public CommonResult recheck(@RequestBody InspectionWorkNode inspectionWorkNode) {
inspectionWorkNodeService.recheck(inspectionWorkNode);
//发送消息提醒
return success("操作成功");
@ -269,44 +271,47 @@ public class InspectionInfoController extends BaseController {
/**
* 判断当前登陆人是否有重检重审退办理的权限app
*
* @return
*/
@GetMapping("isExamine")
public CommonResult isExamine(){
public CommonResult isExamine() {
return success(inspectionInfoService.isExamine());
}
/**
* 获取某个工单针对当前操作用户某个状态的项目们
*
* @param id 工单ID
* @param status 状态
* @param flag 状态字段是否生效默认生效
* @author 小李
* @date 10:48 2024/12/11
* @param id 工单ID
* @param status 状态
* @param flag 状态字段是否生效默认生效
**/
**/
@GetMapping("/getWorkNodeByIdAndNow")
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status, @RequestParam(value = "flag", defaultValue = "true") Boolean flag){
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status, @RequestParam(value = "flag", defaultValue = "true") Boolean flag) {
return success(inspectionInfoService.getWorkNodeByIdAndNow(id, status, flag));
}
/**
* 判断是否可以修改引车员
*
* @param id 工单ID
* @author 小李
* @date 15:22 2024/12/11
* @param id 工单ID
**/
**/
@GetMapping("/judgeUpdateLeadMan")
public CommonResult<?> judgeUpdateLeadMan(Long id){
public CommonResult<?> judgeUpdateLeadMan(Long id) {
return success(inspectionInfoService.judgeUpdateLeadMan(id));
}
/**
* 判断当前登陆人是否有重检重审退办理的权限app
*
* @return
*/
@GetMapping("getRoleList")
public CommonResult getRoleList(){
@GetMapping("getRoleList")
public CommonResult getRoleList() {
return success(inspectionInfoService.getRoleList());
}
@ -328,10 +333,10 @@ public class InspectionInfoController extends BaseController {
map.put("vin", inspectionInfos.getCarIdNo());
map.put("day", day);
map.put("one","");
map.put("two","");
map.put("three","");
map.put("four","");
map.put("one", "");
map.put("two", "");
map.put("three", "");
map.put("four", "");
map.put("month", month);
map.put("year", year);
map.put("carNum", inspectionInfoVo.getCarNum());
@ -354,8 +359,8 @@ public class InspectionInfoController extends BaseController {
* 根据模板导出word
*/
@PostMapping("/exportWord")
public CommonResult exportWord(HttpServletRequest request, HttpServletResponse response,@RequestBody Map map){
String str = UUID.randomUUID().toString()+".docx";
public CommonResult exportWord(HttpServletRequest request, HttpServletResponse response, @RequestBody Map map) {
String str = UUID.randomUUID().toString() + ".docx";
String name = inspectionInfoService.easyPoiExport("template/word/四川省超标排放汽车维护修理告知书.docx", str, map, request, response);
return CommonResult.success(name);
}
@ -365,19 +370,20 @@ public class InspectionInfoController extends BaseController {
*
* @author 小李
* @date 16:22 2024/12/18
**/
**/
@GetMapping("/getCountByType")
public CommonResult<?> getCountByType(@RequestParam("partnerId")Integer partnerId){
public CommonResult<?> getCountByType(@RequestParam("partnerId") Integer partnerId) {
return success(inspectionInfoService.getCountByType(partnerId));
}
/**
* 接车拍照
*
* @param inspectionWorkNode
* @return
*/
@PostMapping("/meetCarPhoto")
public CommonResult<?> meetCarPhoto(@RequestBody InspectionWorkNode inspectionWorkNode){
public CommonResult<?> meetCarPhoto(@RequestBody InspectionWorkNode inspectionWorkNode) {
return success(inspectionInfoService.meetCarPhoto(inspectionWorkNode));
}
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.inspection.controller;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.entity.InspectionMeetCarOrder;
import cn.iocoder.yudao.module.inspection.service.InspectionMeetCarOrderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description: 接车订单
* @Author: 86187
* @Date: 2025/04/11 11:20
* @Version: 1.0
*/
@RestController
@RequestMapping("/admin-api/inspection-meet-car-order")
@RequiredArgsConstructor
public class InspectionMeetCarOrderController {
private final InspectionMeetCarOrderService inspectionMeetCarOrderService;
/**
* 新增接车订单
*
* @param order 接车订单
* @return
*/
@PostMapping("/add")
public CommonResult<?> add(@RequestBody InspectionMeetCarOrder order) {
// 设置接车员id
order.setMeetManId(SecurityFrameworkUtils.getLoginUserId());
inspectionMeetCarOrderService.add(order);
return CommonResult.ok();
}
}

View File

@ -472,7 +472,9 @@ public class PartnerOwnController extends BaseController {
//获取到店预约的数据
@GetMapping("/getAppointmentList")
public CommonResult getAppointmentList(Long partnerId, String phoneNum, Integer pageSize, Integer pageNum, String carNo) throws Exception {
public CommonResult getAppointmentList(Long partnerId, String phoneNum,
Integer pageSize, Integer pageNum,
String carNo,@RequestParam(required = false) String startTime,@RequestParam(required = false) String endTime) throws Exception {
// LoginUser user = SecurityFrameworkUtils.getLoginUser();
// ShopMallPartners partnersTmp = partnerList.getById(partnerId);
// if (!partnersTmp.getUserId().equals(user.getId())){
@ -480,7 +482,7 @@ public class PartnerOwnController extends BaseController {
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
// ShopMallPartners shopMallPartners = partnerList.shopInfo();
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, null, phoneNum, carNo);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, null, phoneNum, carNo,startTime,endTime);
return success(appointments);
}
@ -817,8 +819,8 @@ public class PartnerOwnController extends BaseController {
* @date 14:52 2024/12/10
**/
@GetMapping("/getProjectBelowStandardByIds")
public CommonResult<?> getProjectBelowStandardByIds(Long[] ids) {
return success(partnerList.getProjectBelowStandardByIds(ids));
public CommonResult<?> getProjectBelowStandardByIds(@RequestParam(value = "ids") Long[] ids,@RequestParam(value = "status") String status,@RequestParam(value = "type") String type) {
return success(partnerList.getProjectBelowStandardByIds(ids,status,type));
}
/**

View File

@ -474,7 +474,7 @@ public class AppPartnerOwnController extends BaseController {
// return null;
// }
Page<InspectionAppointment> page = new Page<>(pageNum, pageSize);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, partnerId, phoneNum,carNo);
IPage<InspectionAppointment> appointments = partnerList.getAppointmentList(page, partnerId, phoneNum,carNo,null,null);
return success(appointments);
}

View File

@ -177,4 +177,11 @@ public class InspectionInfo extends TenantBaseDO
private String orderId;
@TableField(exist = false)
private Long appointmentId;
/**
* 类型 0- 工单表 1- 接车临时表 只有查询待接车时会有
*/
@TableField(exist = false)
private Integer sourceType;
@TableField(exist = false)
private String meetCarId;
}

View File

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.inspection.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @Description: 检测接车订单
* @Author: 86187
* @Date: 2025/04/11 11:01
* @Version: 1.0
*/
@Data
@TableName("inspection_meet_car_order")
public class InspectionMeetCarOrder extends TenantBaseDO {
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String buyName; // 用户名称
private String userAddress; // 用户地址
private String carNum; // 车牌号
private String carNature; // 使用性质
private String carModel; // 车辆型号
private String carIdNo; // 车架号
private Date carRegisterDate; // 车辆注册日期
private String buyPhone; // 手机号
private Long meetManId; // 接车员id
private Integer isMeet; // 是否接车 0未接 1已接
private String inspectionInfoId;
}

View File

@ -22,7 +22,7 @@ public class InspectionStepInfo extends Model<InspectionStepInfo> {
@TableId(type=IdType.AUTO)
private Integer id;
//检测订单主键
private Integer inspectionInfoId;
private Object inspectionInfoId;
//步骤名称
private String title;
//检测结果

View File

@ -103,4 +103,9 @@ public class InspectionWorkNode extends TenantBaseDO {
/*重检或复检时需要传*/
@TableField(exist = false)
private List<InspectionWorkNode> workNodes;
@TableField(exist = false)
private Integer sourceType;
/** 接车时所传的id*/
@TableField(exist = false)
private String meetCarId;
}

View File

@ -65,7 +65,7 @@ public interface InspectionAppointmentMapper extends BaseMapper<InspectionAppoin
* @return 结果
*/
public int deleteInspectionAppointmentByIds(Long[] ids);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, @Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum, @Param("carNo")String carNo);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, @Param("partnerId") Long partnerId, @Param("phoneNum")String phoneNum, @Param("carNo")String carNo,@Param("startTime") String startTime, @Param("endTime") String endTime);
List<InspectionAppointment> getAppointmentOwn(@Param("userId") Long userId);

View File

@ -93,4 +93,5 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
* @return
*/
IPage<InspectionInfo> selectByUser(@Param("page") IPage page, @Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
Long countByUser(@Param("roleIds") List<Long> roleIds,@Param("inspectionInfo") InspectionInfo inspectionInfo);
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionInfo;
import cn.iocoder.yudao.module.inspection.entity.InspectionMeetCarOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 接车订单
* @Author: 86187
* @Date: 2025/04/11 11:04
* @Version: 1.0
*/
@Mapper
public interface InspectionMeetCarOrderMapper extends BaseMapper<InspectionMeetCarOrder> {
}

View File

@ -121,7 +121,7 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
void makeCertOk(Long inspectionId);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo);
IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime);
IPage<OrderInfo> validationList(Page<OrderInfo> page, Long partnerId, String searchValue);
@ -185,7 +185,7 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
* @author 小李
* @date 14:52 2024/12/10
**/
Map<Long, String> getProjectBelowStandardByIds(Long[] ids);
Map<Long, List<Map<String, String>>> getProjectBelowStandardByIds(Long[] ids, String status, String type);
/**
* 根据时间查订单

View File

@ -74,6 +74,6 @@ public interface IInspectionAppointmentService extends IService<InspectionAppoi
JSONObject pickCarInfo();
JSONObject computeDistanceAndPrice(Long goodsId,Double longitude,Double latitude,String type ) throws Exception;
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo);
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime);
List<InspectionAppointment> getAppointmentOwn();
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionGoodsSku;
import cn.iocoder.yudao.module.inspection.entity.InspectionMeetCarOrder;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 接车订单
* @Author: 86187
* @Date: 2025/04/11 11:05
* @Version: 1.0
*/
public interface InspectionMeetCarOrderService extends IService<InspectionMeetCarOrder> {
/**
* 添加接车订单
*
* @param order 接车订单
*/
void add(InspectionMeetCarOrder order);
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
@ -1694,8 +1695,15 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo) {
return appointmentService.getAppointmentList(page, partnerId, phoneNum,carNo);
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime) {
if (StrUtil.isNotEmpty(startTime) && StrUtil.isNotEmpty(endTime)) {
// 拼接时分秒
startTime = startTime + " 00:00:00";
// 拼接时分秒
endTime = endTime + " 23:59:59";
}
return appointmentService.getAppointmentList(page, partnerId, phoneNum, carNo, startTime, endTime);
}
@Override
@ -2034,33 +2042,51 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
* @date 14:52 2024/12/10
**/
@Override
public Map<Long, String> getProjectBelowStandardByIds(Long[] ids) {
List<InspectionWorkNode> inspectionWorkNodes = inspectionWorkNodeService.
list(new LambdaQueryWrapper<InspectionWorkNode>()
public Map<Long, List<Map<String, String>>> getProjectBelowStandardByIds(Long[] ids, String status, String type) {
// 1. 查询符合条件的 InspectionWorkNode
List<InspectionWorkNode> inspectionWorkNodes = inspectionWorkNodeService
.list(new LambdaQueryWrapper<InspectionWorkNode>()
.in(InspectionWorkNode::getInspectionInfoId, Arrays.asList(ids))
.eq(InspectionWorkNode::getType, "0"));
.eq(StrUtil.isNotEmpty(status),InspectionWorkNode::getStatus, status)
.eq(StrUtil.isNotEmpty(type),InspectionWorkNode::getType, type));
if (ObjectUtil.isEmpty(inspectionWorkNodes)) {
return null;
return Collections.emptyMap(); // 返回空Map而非null避免NPE
}
List<String> projectIds = inspectionWorkNodes.stream().map(InspectionWorkNode::getProjectId).collect(Collectors.toList());
// 2. 提取所有项目ID
List<String> projectIds = inspectionWorkNodes.stream()
.map(InspectionWorkNode::getProjectId)
.distinct() // 去重
.collect(Collectors.toList());
if (CollUtil.isEmpty(projectIds)) {
return null;
return Collections.emptyMap();
}
// 3. 批量查询项目信息
List<DlInspectionProject> projects = projectService.listByIds(projectIds);
if (CollUtil.isEmpty(projects)) {
return null;
return Collections.emptyMap();
}
Map<String, String> projectMap = projects.stream().collect(Collectors.toMap(DlInspectionProject::getId, DlInspectionProject::getProjectName));
Map<Long, String> result = new HashMap<>();
Map<Long, List<String>> map = inspectionWorkNodes.stream().collect(Collectors
.groupingBy(InspectionWorkNode::getInspectionInfoId,
Collectors.mapping(InspectionWorkNode::getProjectId, Collectors.toList())));
for (Long id : ids) {
List<String> values = map.get(id);
String names = values.stream().filter(projectMap::containsKey).map(projectMap::get).collect(Collectors.joining(","));
result.put(id, names);
}
return result;
// 4. 构建项目ID -> 项目名称的映射
Map<String, String> projectIdToNameMap = projects.stream()
.collect(Collectors.toMap(
DlInspectionProject::getId,
DlInspectionProject::getProjectName));
// 5. inspectionInfoId 分组并转换为 List<Map<String, String>>
return inspectionWorkNodes.stream()
.collect(Collectors.groupingBy(
InspectionWorkNode::getInspectionInfoId,
Collectors.mapping(
node -> {
Map<String, String> projectInfo = new HashMap<>();
projectInfo.put("id", node.getId());
projectInfo.put("name", projectIdToNameMap.get(node.getProjectId()));
return projectInfo;
},
Collectors.toList())));
}
/**

View File

@ -356,8 +356,8 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl<InspectionAppo
}
@Override
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo) {
return baseMapper.getAppointmentList(page,partnerId,phoneNum,carNo);
public IPage<InspectionAppointment> getAppointmentList(Page<InspectionAppointment> page, Long partnerId, String phoneNum, String carNo, String startTime, String endTime) {
return baseMapper.getAppointmentList(page,partnerId,phoneNum,carNo,startTime,endTime);
}
@Override

View File

@ -20,10 +20,12 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.appBase.controller.admin.InspectionSocket;
import cn.iocoder.yudao.module.constant.InspectionConstants;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.infra.service.file.FileService;
@ -124,6 +126,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private FileService fileService;
@Autowired
private IInspectionAppointmentService inspectionAppointmentService;
@Autowired
private InspectionMeetCarOrderService inspectionMeetCarOrderService;
/**
* 查询请填写功能名称
@ -354,6 +358,23 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
stepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
save = inspectionStepInfoService.save(stepInfo);
}
// 判断meetCarId是否有值
if (StrUtil.isNotEmpty(inspectionInfo.getMeetCarId())) {
// 如果有值修改步骤表中的id
inspectionStepInfoService.update(Wrappers.<InspectionStepInfo>lambdaUpdate()
.eq(InspectionStepInfo::getInspectionInfoId, inspectionInfo.getMeetCarId())
.set(InspectionStepInfo::getInspectionInfoId, inspectionInfo.getId()));
//修改接车订单表中的检测主键id
inspectionMeetCarOrderService.update(Wrappers.<InspectionMeetCarOrder>lambdaUpdate()
.eq(InspectionMeetCarOrder::getId, inspectionInfo.getMeetCarId())
.set(InspectionMeetCarOrder::getInspectionInfoId, inspectionInfo.getId()));
// 修改工单表的是否接车为已接车
update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionInfo.getId())
.set(InspectionInfo::getIsMeetCar, 1));
}
workNodeService.saveBatch(inspectionWorkNodes);
// //获取第一个节点的角色
@ -763,20 +784,20 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[7];
CompletableFuture<Void>[] futures = new CompletableFuture[8];
for (int i = 0; i < 7; i++) { // 改为 `0~4`
for (int i = 0; i < 8; i++) { // 改为 `0~4`
final String status = String.valueOf(i + 1);
// 深拷贝对象防止多线程修改冲突
InspectionInfo infoCopy = JSON.parseObject(JSON.toJSONString(inspectionInfo), InspectionInfo.class);
infoCopy.setStatus(status);
Page<InspectionInfo> page = new Page<>(1, 10);
// Page<InspectionInfo> page = new Page<>(1, 10);
futures[i] = CompletableFuture.runAsync(() -> {
IPage<InspectionInfo> iPage = baseMapper.selectByUser(page, roleIds, infoCopy);
result.put(status, iPage.getTotal());
Long count = baseMapper.countByUser(roleIds, infoCopy);
result.put(status, count);
}, executor);
}
@ -805,14 +826,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
* @param inspectionWorkNode
*/
@Override
@Transactional
public Boolean meetCarPhoto(InspectionWorkNode inspectionWorkNode) {
//图片和描述
String remark = inspectionWorkNode.getRemark();
String dealImages = inspectionWorkNode.getDealImages();
String remark = StrUtil.isNotEmpty(inspectionWorkNode.getRemark()) ? inspectionWorkNode.getRemark() : "";
String dealImages = StrUtil.isNotEmpty(inspectionWorkNode.getDealImages()) ? inspectionWorkNode.getDealImages() : "";
//存入步骤表
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionWorkNode.getInspectionInfoId())));
stepInfo.setInspectionInfoId(inspectionWorkNode.getMeetCarId());
stepInfo.setTitle("接车拍照");
stepInfo.setContent(remark);
stepInfo.setImages(dealImages);
@ -823,10 +845,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
inspectionStepInfoService.save(stepInfo);
//修改主表为已接车
int update = baseMapper.update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionWorkNode.getInspectionInfoId())
.set(InspectionInfo::getIsMeetCar, "1"));
// 判断接车类型是工单表还是接车订单表
if (Objects.equals(inspectionWorkNode.getSourceType(), InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_COMPLETE_TYPE_ORDER)) {
//修改主表为已接车
int update = baseMapper.update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionWorkNode.getMeetCarId())
.set(InspectionInfo::getIsMeetCar, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES));
}else if (Objects.equals(inspectionWorkNode.getSourceType(), InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_COMPLETE_TYPE_MEET_CAR_ORDER)) {
// 修改接车订单表为已接车
inspectionMeetCarOrderService.update(Wrappers.<InspectionMeetCarOrder>lambdaUpdate()
.eq(InspectionMeetCarOrder::getId, inspectionWorkNode.getMeetCarId())
.set(InspectionMeetCarOrder::getIsMeet, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES));
}
return true;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.module.inspection.entity.InspectionMeetCarOrder;
import cn.iocoder.yudao.module.inspection.entity.ShopInspectionGoods;
import cn.iocoder.yudao.module.inspection.mapper.AppInspectionGoodsMapper;
import cn.iocoder.yudao.module.inspection.mapper.InspectionMeetCarOrderMapper;
import cn.iocoder.yudao.module.inspection.service.AppInspectionGoodsService;
import cn.iocoder.yudao.module.inspection.service.InspectionMeetCarOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* @Description: 接车订单
* @Author: 86187
* @Date: 2025/04/11 11:06
* @Version: 1.0
*/
@Service
public class InspectionMeetCarOrderServiceImpl extends ServiceImpl<InspectionMeetCarOrderMapper, InspectionMeetCarOrder> implements InspectionMeetCarOrderService {
/**
* 添加接车订单
*
* @param order 接车订单
*/
@Override
public void add(InspectionMeetCarOrder order) {
save(order);
}
}

View File

@ -113,6 +113,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="carNo != null and carNo != ''">
and ip.car_no like concat('%',#{carNo},'%')
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and ip.appointment_day between #{startTime} and #{endTime}
</if>
order by ip.create_time desc
</select>
<select id="getAppointmentOwn" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionAppointment">

View File

@ -269,107 +269,155 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by ins.start_time desc
</select>
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT *
FROM (
SELECT
ii.*,
iwn.id AS workNodeId,
iwn.status AS workNodeStatus,
oi.order_no AS orderNo,
oi.phonenumber AS buyPhone,
oi.goods_title as goodsTitle,
oi.sku_name as skuName,
ip.project_name AS projectName,
su.nickname AS leadManName,
ROW_NUMBER() OVER (PARTITION BY ii.id ORDER BY iwn.update_time DESC) as rn -- 根据需要调整排序逻辑
FROM
inspection_info ii
LEFT JOIN
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
LEFT JOIN
order_info oi ON ii.inspection_order_id = oi.id
LEFT JOIN
inspection_project ip ON iwn.project_id = ip.id
LEFT JOIN
system_users su ON ii.lead_man_id = su.id
<where>
ii.deleted = 0
<!-- 车牌号模糊查询 -->
<if test="inspectionInfo.carNum != null">
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
</if>
<!-- 待支付 -->
<if test="inspectionInfo.status == '0'.toString()">
AND (oi.pay_time is null)
ORDER BY iwn.update_time DESC
</if>
<!-- 待接受(待检测) -->
<if test="inspectionInfo.status == 1">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '0'
AND iwn.status = '0'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.create_time DESC
</if>
<!-- 进行中(检测中) -->
<if test="inspectionInfo.status == 2">
AND (ii.status = '0' OR ii.status = '2')
AND iwn.status = '1'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待重检 -->
<if test="inspectionInfo.status == 3">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '2'
-- AND iwn.status = '1'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 待复检 -->
<if test="inspectionInfo.status == 4">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
-- AND ii.status = '2'
AND iwn.status = '3'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 已完成 -->
<if test="inspectionInfo.status == 5">
AND iwn.status = '2'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待接车 -->
<if test="inspectionInfo.status == 6">
AND ii.is_meet_car = '0'
AND ii.meet_man_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待审核不合格项目 -->
<if test="inspectionInfo.status == 7">
AND iwn.type = '0'
AND ii.status != '1'
ORDER BY iwn.update_time DESC
</if>
</where>
) AS subquery
WHERE rn = 1;
<if test="inspectionInfo.status != 6 and inspectionInfo.status != 8">
SELECT *
FROM (
SELECT
ii.*,
iwn.id AS workNodeId,
iwn.status AS workNodeStatus,
oi.order_no AS orderNo,
oi.phonenumber AS buyPhone,
oi.goods_title as goodsTitle,
oi.sku_name as skuName,
ip.project_name AS projectName,
su.nickname AS leadManName,
ROW_NUMBER() OVER (PARTITION BY ii.id ORDER BY iwn.update_time DESC) as rn -- 根据需要调整排序逻辑
FROM
inspection_info ii
LEFT JOIN
inspection_work_node iwn ON ii.id = iwn.inspection_info_id
LEFT JOIN
order_info oi ON ii.inspection_order_id = oi.id
LEFT JOIN
inspection_project ip ON iwn.project_id = ip.id
LEFT JOIN
system_users su ON ii.lead_man_id = su.id
<where>
ii.deleted = 0
<!-- 车牌号模糊查询 -->
<if test="inspectionInfo.carNum != null">
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
</if>
<!-- 待支付 -->
<if test="inspectionInfo.status == '0'.toString()">
AND (oi.pay_time is null)
ORDER BY iwn.update_time DESC
</if>
<!-- 待接受(待检测) -->
<if test="inspectionInfo.status == 1">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '0'
AND iwn.status = '0'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.create_time DESC
</if>
<!-- 进行中(检测中) -->
<if test="inspectionInfo.status == 2">
AND (ii.status = '0' OR ii.status = '2')
AND iwn.status = '1'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待重检 -->
<if test="inspectionInfo.status == 3">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '2'
-- AND iwn.status = '1'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 待复检 -->
<if test="inspectionInfo.status == 4">
AND <!-- 工单负责人或角色ID匹配 -->
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
-- AND ii.status = '2'
AND iwn.status = '3'
AND ii.status != '1'
-- AND ii.now_order_num = iwn.order_num
ORDER BY ii.update_time DESC
</if>
<!-- 已完成 -->
<if test="inspectionInfo.status == 5">
AND iwn.status = '2'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待接车 -->
<if test="inspectionInfo.status == 6">
AND ii.is_meet_car = '0'
AND ii.meet_man_id = #{inspectionInfo.dealUserId}
ORDER BY iwn.update_time DESC
</if>
<!-- 待审核不合格项目 -->
<if test="inspectionInfo.status == 7">
AND iwn.type = '0'
AND ii.status != '1'
ORDER BY iwn.update_time DESC
</if>
</where>
) AS subquery
WHERE rn = 1;
</if>
<!-- 待接车 -->
<if test="inspectionInfo.status == 6">
SELECT
ii.id AS id,
ii.buy_name,
ii.user_address,
ii.car_num,
ii.car_nature,
ii.car_model,
ii.car_id_no,
ii.car_register_date,
ii.buy_phone,
ii.meet_man_id AS meet_id,
ii.tenant_id,
ii.create_time,
0 AS source_type
FROM inspection_info ii
WHERE ii.deleted = 0 AND ii.meet_man_id = #{inspectionInfo.dealUserId} AND ii.is_meet_car = '0'
UNION ALL
SELECT
imco.id AS id,
imco.buy_name,
imco.user_address,
imco.car_num,
imco.car_nature,
imco.car_model,
imco.car_id_no,
imco.car_register_date,
imco.buy_phone,
imco.meet_man_id,
imco.tenant_id,
imco.create_time,
1 AS source_type
FROM inspection_meet_car_order imco
WHERE imco.deleted = 0 AND imco.meet_man_id = #{inspectionInfo.dealUserId} AND imco.is_meet = '0' ;
</if>
<!-- 接车订单转工单 -->
<if test="inspectionInfo.status == 8">
SELECT imco.*
FROM inspection_meet_car_order imco
WHERE imco.deleted = 0 AND imco.inspection_info_id IS NULL AND imco.is_meet = '1';
</if>
<!-- 之前的查询,修改为了一个工单只出现一条,不分项目 -->
<!-- SELECT-->
<!-- ii.*,-->
@ -422,4 +470,93 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- </if>-->
<!-- </where>-->
</select>
<select id="countByUser" resultType="java.lang.Long">
<if test="inspectionInfo.status != 6 and inspectionInfo.status != 8">
SELECT COUNT(DISTINCT ii.id)
FROM inspection_info ii
LEFT JOIN inspection_work_node iwn ON ii.id = iwn.inspection_info_id
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id
LEFT JOIN inspection_project ip ON iwn.project_id = ip.id
LEFT JOIN system_users su ON ii.lead_man_id = su.id
<where>
ii.deleted = 0
<!-- 车牌号模糊查询 -->
<if test="inspectionInfo.carNum != null">
AND ii.car_num LIKE CONCAT('%', #{inspectionInfo.carNum}, '%')
</if>
<!-- 待支付 -->
<if test="inspectionInfo.status == '0'.toString()">
AND (oi.pay_time is null)
</if>
<!-- 待接受(待检测) -->
<if test="inspectionInfo.status == 1">
AND (ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '0'
AND iwn.status = '0'
</if>
<!-- 进行中(检测中) -->
<if test="inspectionInfo.status == 2">
AND (ii.status = '0' OR ii.status = '2')
AND iwn.status = '1'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
</if>
<!-- 待重检 -->
<if test="inspectionInfo.status == 3">
AND (ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND ii.status = '2'
</if>
<!-- 待复检 -->
<if test="inspectionInfo.status == 4">
AND (ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>)
AND iwn.status = '3'
AND ii.status != '1'
</if>
<!-- 已完成 -->
<if test="inspectionInfo.status == 5">
AND iwn.status = '2'
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
</if>
<!-- 待审核不合格项目 -->
<if test="inspectionInfo.status == 7">
AND iwn.type = '0'
AND ii.status != '1'
</if>
</where>
</if>
<if test="inspectionInfo.status == 6">
SELECT COUNT(*) FROM (
SELECT ii.id
FROM inspection_info ii
WHERE ii.deleted = 0
AND ii.meet_man_id = #{inspectionInfo.dealUserId}
AND ii.is_meet_car = '0'
UNION ALL
SELECT imco.id
FROM inspection_meet_car_order imco
WHERE imco.deleted = 0
AND imco.meet_man_id = #{inspectionInfo.dealUserId}
AND imco.is_meet = '0'
) AS combined_results
</if>
<!-- 接车订单转工单 -->
<if test="inspectionInfo.status == 8">
SELECT COUNT(*)
FROM inspection_meet_car_order imco
WHERE imco.deleted = 0 AND imco.inspection_info_id IS NULL AND imco.is_meet = '1';
</if>
</select>
</mapper>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.inspection.mapper.InspectionMeetCarOrderMapper">
</mapper>