Merge branch 'insp'

This commit is contained in:
xyc 2025-06-13 17:07:45 +08:00
commit 6f9a2986f9
33 changed files with 584 additions and 71 deletions

View File

@ -95,4 +95,9 @@ public class InspectionConstants {
*/
public static final String INSPECTION_NOTICE_TEMPLATE_ASSIGN_STAFF_MEET_CAR_NO_CAR_NO = "您有的新的接车订单需要处理 接车时间:%s 详细信息请前往接车列表";
/**
* 检测站内信模板-提示业务经理 接车订单已被创建
*/
public static final String INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE = "%s的工单已创建详细信息请前往列表查看";
}

View File

@ -125,6 +125,19 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.geStelectInspection(page, inspectionInfo));
}
/**
* 根据当前登陆人获取可以选择的工单业务经理查询
*
* @return
*/
@GetMapping("geStelectInspectionByBusiness")
public CommonResult geStelectInspectionByBusiness(InspectionInfo inspectionInfo,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<InspectionInfo> page = new Page<>(pageNum, pageSize);
return success(inspectionInfoService.geStelectInspectionByBusiness(page, inspectionInfo));
}
/**
* 获取工单详情
*
@ -376,6 +389,17 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.getCountByType(partnerId));
}
/**
* 获得不同状态的数据的数量
*
* @author 小李
* @date 16:22 2024/12/18
**/
@GetMapping("/getBusinessCountByType")
public CommonResult<?> getBusinessCountByType(@RequestParam("partnerId") Integer partnerId) {
return success(inspectionInfoService.getBusinessCountByType(partnerId));
}
/**
* 接车拍照
*
@ -387,6 +411,17 @@ public class InspectionInfoController extends BaseController {
return success(inspectionInfoService.meetCarPhoto(inspectionWorkNode));
}
/**
* 还车拍照
*
* @param inspectionWorkNode
* @return
*/
@PostMapping("/returnCarPhoto")
public CommonResult<?> returnCarPhoto(@RequestBody InspectionWorkNode inspectionWorkNode) {
return success(inspectionInfoService.returnCarPhoto(inspectionWorkNode));
}
/**
* 修改异常工单
*

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.enums.DriverLicenseType;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
@ -181,15 +182,15 @@ public class InspectionStaffController extends BaseController {
/**
* 获取已完成项目
* @param userId 用户id
* @param query 请求参数
* @return
*/
@GetMapping("/getFinishProjectByUserId")
public CommonResult<?> getFinishProjectByUserId(@RequestParam("userId") Long userId,
public CommonResult<?> getFinishProjectByUserId(InspectionListQuery query,
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
Page<Map<String, Object>> page = new Page<>(pageNo, pageSize);
return success(inspectionStaffService.getFinishProjectByUserId(page, userId));
return success(inspectionStaffService.getFinishProjectByUserId(page, query));
}
/**

View File

@ -7,6 +7,7 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.inspection.query.FileByTypeQuery;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.inspection.vo.*;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
@ -922,4 +923,14 @@ public class PartnerOwnController extends BaseController {
@RequestParam(value = "endTime", required = false) String endTime){
return success(partnerList.fileStatistics(servicePackageId,startTime, endTime));
}
/**
* 文件统计
* @param fileByTypeQuery
* @return
*/
@GetMapping("/getFileByType")
public CommonResult<?> getFileByType(FileByTypeQuery fileByTypeQuery){
return success(partnerList.fileStatisticsList(fileByTypeQuery.getServicePackageId(),fileByTypeQuery.getStartTime(),fileByTypeQuery.getEndTime()));
}
}

View File

@ -8,7 +8,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/channel")
@ -23,6 +25,7 @@ public class InspectionBusinessChannelController {
@GetMapping("/tree")
public CommonResult<List<InspectionBusinessChannel>> getChannelTree(InspectionBusinessChannel channel) {
return CommonResult.success(inspectionBusinessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.eq(ObjectUtil.isNotEmpty(channel.getType()), InspectionBusinessChannel::getType, channel.getType())
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())));
}
@ -39,7 +42,18 @@ public class InspectionBusinessChannelController {
*/
@GetMapping("/{id}")
public CommonResult<InspectionBusinessChannel> getChannelById(@PathVariable("id") Long id) {
return CommonResult.success(inspectionBusinessChannelService.getById(id));
InspectionBusinessChannel info = inspectionBusinessChannelService.getById(id);
//将字符串转为集合
if (ObjectUtil.isNotEmpty(info.getUserIds())) {
List<Long> userIdList = Arrays.stream(info.getUserIds().split(","))
.filter(s -> s != null && !s.isEmpty()) // 可选避免空字符串
.map(Long::valueOf)
.collect(Collectors.toList());
info.setUserIdList(userIdList);
}
return CommonResult.success(info);
}
/**
@ -47,6 +61,13 @@ public class InspectionBusinessChannelController {
*/
@PutMapping("/update")
public CommonResult<?> updateChannel(@RequestBody InspectionBusinessChannel channel) {
if (ObjectUtil.isNotEmpty(channel.getUserIdList())) {
String userIds = channel.getUserIdList().stream()
.map(String::valueOf)
.collect(Collectors.joining(","));
channel.setUserIds(userIds);
}
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
}
@ -60,10 +81,11 @@ public class InspectionBusinessChannelController {
/**
* 获取业务渠道或客户来源列表(app)
*
* @return
*/
@GetMapping("/list")
public CommonResult<?> list(){
public CommonResult<?> list() {
return CommonResult.success(inspectionBusinessChannelService.getChannelTree());
}
}

View File

@ -48,4 +48,7 @@ public class DlInspectionProject extends TenantBaseDO {
@TableField(exist = false)
private List<ProjectRoyalty> projectRoyaltyList;
}
@TableField(exist = false)
private List<String> datetimeRange;
}

View File

@ -17,7 +17,12 @@ public class InspectionBusinessChannel extends TenantBaseDO {
private Integer type; // 0-业务渠道 1-客户来源
private String userIds; // 绑定的用户ID
// 子节点
@TableField(exist = false)
private List<InspectionBusinessChannel> children;
@TableField(exist = false)
private List<Long> userIdList;
}

View File

@ -163,6 +163,10 @@ public class InspectionInfo extends TenantBaseDO
private String isPickCar;
/** 当前流程节点 */
private Integer nowOrderNum;
/** 还车人id */
private Long returnCarUserId;
/** 是否还车 */
private Integer isReturnCar;
/** 开始检测时需要 传入 选择项目的id、角色id、排序 */
@TableField(exist = false)

View File

@ -99,4 +99,10 @@ public class InspectionStaff extends TenantBaseDO {
*/
@TableField("folder_id")
private Long folderId;
/**
* 唯一码
*/
@TableField("unique_code")
private String uniqueCode;
}

View File

@ -23,4 +23,6 @@ public interface InspectionFileRecordMapper extends BaseMapper<InspectionFileRec
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(@Param("servicePackageId") String servicePackageId,@Param("startTime") String startTime, @Param("endTime") String endTime);
List<InspectionFileRecord> query(@Param("servicePackageId") String servicePackageId, @Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@ -94,4 +94,7 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
*/
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);
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.DlInspectionProject;
import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -50,5 +51,5 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
*/
List<Map<String, Object>> selectExceptionNodesByInspectionIds(@Param("ids") List<Long> idList);
IPage<Map<String, Object>> selectStaffProjectByUserId(@Param("page")Page<Map<String, Object>> page, @Param("userId") Long userId);
IPage<Map<String, Object>> selectStaffProjectByUserId(@Param("page")Page<Map<String, Object>> page, @Param("query") InspectionListQuery query);
}

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.inspection.query;
import lombok.Data;
@Data
public class FileByTypeQuery {
/**
* 服务包id
*/
private String servicePackageId;
/**
* 查询类型 add-新增 update-修改
*/
private String type;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.inspection.query;
import lombok.Data;
import java.util.List;
@Data
public class InspectionListQuery {
/**
* 用户id
*/
private Long userId;
/**
* 客户来源
*/
private String customerSource;
/**
* 时间范围
*/
private List<String> datetimeRange;
/**
* 客户来源
*/
private String customSource;
/**
* 业务
*/
private String bussiness;
/**
* 项目id
*/
private String projectId;
}

View File

@ -43,4 +43,7 @@ public class OrderTableQuery {
/** 检测时长 */
private String[] inspectionTime;
/** 时间范围 */
private String[] datetimeRange;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.query.FileByTypeQuery;
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
@ -262,4 +263,13 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
* @return
*/
List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId);
/**
* 文件统计列表
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
Map<String, Object> fileStatisticsList(String servicePackageId, String startTime, String endTime);
}

View File

@ -154,9 +154,25 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
*/
Boolean meetCarPhoto(InspectionWorkNode inspectionWorkNode);
/**
* 还车拍照
* @param inspectionWorkNode
*/
Boolean returnCarPhoto(InspectionWorkNode inspectionWorkNode);
/**
* 引车
* @param inspectionInfo
*/
void leadCar(InspectionInfo inspectionInfo);
/**
* 获取业务方工单
* @param page
* @param inspectionInfo
* @return
*/
IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo);
Map<String, Long> getBusinessCountByType(Integer partnerId);
}

View File

@ -21,4 +21,6 @@ public interface InspectionFileRecordService extends IService<InspectionFileReco
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(String servicePackageId, String startTime, String endTime);
List<InspectionFileRecord> query(String servicePackageId, String startTime, String endTime);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.*;
import cn.iocoder.yudao.module.inspection.query.GoodsQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.vo.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -81,6 +82,6 @@ public interface InspectionStaffService extends IService<InspectionStaff> {
* @param userId
* @return
*/
IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, Long userId);
IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, InspectionListQuery query);
}

View File

@ -1549,11 +1549,12 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
Set<Long> userIds = new HashSet<>();
userIds.add(info.getUserId());
userIds.add(info.getWorkId());
userIds.add(info.getReturnCarUserId());
if (info.getLeadManId() != null) userIds.add(info.getLeadManId());
if (info.getMeetManId() != null) userIds.add(info.getMeetManId());
List<AdminUserDO> userList = userService.list(Wrappers.<AdminUserDO>lambdaQuery()
.in(AdminUserDO::getId,userIds)); // 你需新增 getUsers(Collection<Long> ids)
.in(AdminUserDO::getId, userIds)); // 你需新增 getUsers(Collection<Long> ids)
//转为map
Map<Long, AdminUserDO> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, Function.identity()));
@ -1564,11 +1565,13 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
AdminUserDO meetMan = userMap.get(info.getMeetManId());
InspectionInfoVo res = new InspectionInfoVo();
BeanUtils.copyProperties(order, res); // 建议手动复制必要字段
BeanUtils.copyProperties(order, res); // 建议手动复制必要字段
res.setInspectionId(info.getId());
res.setBuyUserName(buyUser != null ? buyUser.getNickname() : "");
res.setBuyUserPhone(buyUser != null ? buyUser.getMobile() : "");
res.setReturnCarUserId(info.getReturnCarUserId());
res.setReturnCarUserName(userMap.get(info.getReturnCarUserId()) != null ? userMap.get(info.getReturnCarUserId()).getNickname() : "");
if (worker != null) {
res.setWorkerAvatar(worker.getAvatar());
@ -1597,7 +1600,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
if (leadMan != null) {
res.setLeadManName(leadMan.getNickname());
res.setLeadManId(leadMan.getId());
@ -1673,7 +1675,6 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
@Override
public List<InspectionInfo> workerInspectionList(Long workerId, String status, String searchValue) {
return baseMapper.workerInspectionList(workerId, status, searchValue);
@ -2027,7 +2028,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
startTime = startTime + " 00:00:00";
endTime = endTime + " 23:59:59";
// List<Map<String, Object>> res = baseMapper.staticsTable3(partnerId, startTime, endTime);
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics( startTime, endTime);
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics(startTime, endTime);
return res;
}
@ -2307,16 +2308,46 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
Map<Long, Long> meetManIdCountMap = list.stream()
.filter(info -> info.getMeetManId() != null) // 过滤 null
.collect(Collectors.groupingBy(InspectionInfo::getMeetManId, Collectors.counting()));
// 根据userId查询还车人
List<InspectionInfo> returnCarList = inspectionInfoService.list(Wrappers.<InspectionInfo>lambdaQuery()
.eq(InspectionInfo::getIsReturnCar, 1));
// 统计每个 returnCarUserId 的数量避免 null key 异常
Map<Long, Long> returnCarUserIdCountMap = returnCarList.stream()
.filter(info -> info.getReturnCarUserId() != null) // 过滤 null
.collect(Collectors.groupingBy(InspectionInfo::getReturnCarUserId, Collectors.counting()));
for (Map<String, Object> stringObjectMap : staffCount) {
Long userId = (Long) stringObjectMap.get("userId");
List<Map<String, Object>> children = (List<Map<String, Object>>) stringObjectMap.get("children");
stringObjectMap.put("meetCarCount", meetManIdCountMap.get(userId));
// stringObjectMap.put("meetCarCount", meetManIdCountMap.get(userId));
stringObjectMap.put("totalCount", (Long) stringObjectMap.get("totalCount") == null ? 0 : (Long) stringObjectMap.get("totalCount") + (meetManIdCountMap.get(userId) == null ? 0 : meetManIdCountMap.get(userId)));
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
objectObjectHashMap.put("count", meetManIdCountMap.get(userId) == null ? 0 : meetManIdCountMap.get(userId));
objectObjectHashMap.put("projectName", "接车");
children.add(objectObjectHashMap);
//还车
//设置totalCount
stringObjectMap.put("totalCount", (Long) stringObjectMap.get("totalCount") == null ? 0 : (Long) stringObjectMap.get("totalCount") + (returnCarUserIdCountMap.get(userId) == null ? 0 : returnCarUserIdCountMap.get(userId)));
Map<String, Object> objectObjectHashMap1 = new HashMap<>();
objectObjectHashMap1.put("count", returnCarUserIdCountMap.get(userId) == null ? 0 : returnCarUserIdCountMap.get(userId));
objectObjectHashMap1.put("projectName", "还车");
children.add(objectObjectHashMap1);
}
// meetCarCount 降序排序员工
staffCount.sort(Comparator.comparingLong(
(Map<String, Object> staff) -> (Long) staff.getOrDefault("totalCount", 0L)
).reversed());
// 对每个员工的 children count 降序排序
staffCount.forEach(staff -> {
List<Map<String, Object>> children = (List<Map<String, Object>>) staff.get("children");
if (children != null) {
children.sort(Comparator.comparingLong(
(Map<String, Object> child) -> (Long) child.getOrDefault("count", 0L)
).reversed());
}
});
return staffCount;
}
@ -2328,7 +2359,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
* @return 结果
*/
@Override
public Map<String, Object> fileStatistics(String servicePackageId,String startTime, String endTime) {
public Map<String, Object> fileStatistics(String servicePackageId, String startTime, String endTime) {
// 判断开始时间与结束时间如果为空 默认查询本月
if (StringUtils.isEmpty(startTime)) {
startTime = DateUtil.format(DateUtil.beginOfMonth(new Date()), "yyyy-MM-dd");
@ -2337,7 +2368,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
endTime = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
}
long addCount = inspectionFileService.count(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getServicePackageId, servicePackageId)
.eq(InspectionFile::getServicePackageId, servicePackageId)
.between(InspectionFile::getCreateTime, startTime, endTime));
// 查询文件记录表
@ -2370,4 +2401,35 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
maps.sort(Comparator.comparingInt(map -> -Integer.parseInt(map.get("theNum").toString())));
return maps;
}
/**
* 文件统计列表
*
* @param servicePackageId
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
@Override
public Map<String, Object> fileStatisticsList(String servicePackageId, String startTime, String endTime) {
Map<String, Object> result = new HashMap<>();
// 根据开始时间与结束时间查询新增文件
if (StringUtils.isEmpty(startTime)) {
startTime = DateUtil.format(DateUtil.beginOfMonth(new Date()), "yyyy-MM-dd");
}
if (StringUtils.isEmpty(endTime)) {
endTime = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
}
List<InspectionFile> insertFile = inspectionFileService.list(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getServicePackageId, servicePackageId)
.between(InspectionFile::getCreateTime, startTime, endTime));
result.put("insertFile", insertFile);
// 根据开始时间与结束时间查询修改文件
List<InspectionFileRecord> query = inspectionFileRecordService.query(servicePackageId, startTime, endTime);
result.put("updateFile", query);
return result;
}
}

View File

@ -39,4 +39,15 @@ public class InspectionFileRecordServiceImpl extends ServiceImpl<InspectionFileR
public long queryCount(String servicePackageId, String startTime, String endTime) {
return baseMapper.queryCount(servicePackageId, startTime, endTime);
}
/**
* @param servicePackageId
* @param startTime
* @param endTime
* @return
*/
@Override
public List<InspectionFileRecord> query(String servicePackageId, String startTime, String endTime) {
return baseMapper.query(servicePackageId, startTime, endTime);
}
}

View File

@ -419,6 +419,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionInfo.getId())
.set(InspectionInfo::getIsMeetCar, 1));
// 查询接车标
InspectionMeetCarOrder inspectionMeetCarOrder = inspectionMeetCarOrderService.getById(inspectionInfo.getMeetCarId());
// 判断接车类型是否是业务接车
if (inspectionMeetCarOrder.getMeetType() == 2) {
// 给对应的业务经理发送消息
String message = String.format(InspectionConstants.INSPECTION_NOTICE_TEMPLATE_BUSINESS_MANAGER_MEET_CAR_ORDER_CREATE, inspectionInfo.getBuyName() == null ? inspectionInfo.getBuyPhone() : inspectionInfo.getBuyName());
noticeService.sentMessage(inspectionMeetCarOrder.getMeetManId(), message);
}
}
workNodeService.saveBatch(inspectionWorkNodes);
@ -830,7 +839,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
@Override
public Map<String, Long> getCountByType(Integer partnerId) {
// 创建线程池
ExecutorService executor = Executors.newFixedThreadPool(6);
ExecutorService executor = Executors.newFixedThreadPool(10);
try {
InspectionInfo inspectionInfo = new InspectionInfo();
@ -850,9 +859,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[9];
CompletableFuture<Void>[] futures = new CompletableFuture[10];
for (int i = 0; i < 9; i++) { // 改为 `0~4`
for (int i = 0; i < 10; i++) { // 改为 `0~4`
final String status = String.valueOf(i + 1);
// 深拷贝对象防止多线程修改冲突
@ -927,6 +936,38 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
return true;
}
/**
* 还车拍照
*
* @param inspectionWorkNode
*/
@Override
public Boolean returnCarPhoto(InspectionWorkNode inspectionWorkNode) {
//图片和描述
String remark = StrUtil.isNotEmpty(inspectionWorkNode.getRemark()) ? inspectionWorkNode.getRemark() : "";
String dealImages = StrUtil.isNotEmpty(inspectionWorkNode.getDealImages()) ? inspectionWorkNode.getDealImages() : "";
//存入步骤表
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(inspectionWorkNode.getInspectionInfoId());
stepInfo.setTitle("还车拍照");
stepInfo.setContent(remark);
stepInfo.setImages(dealImages);
stepInfo.setCreator(Math.toIntExact(SecurityFrameworkUtils.getLoginUserId()));
stepInfo.setUpdater(Math.toIntExact(SecurityFrameworkUtils.getLoginUserId()));
stepInfo.setCreateTime(new Date());
stepInfo.setUpdateTime(new Date());
inspectionStepInfoService.save(stepInfo);
// 修改主表为已还车
int update = baseMapper.update(Wrappers.<InspectionInfo>lambdaUpdate()
.eq(InspectionInfo::getId, inspectionWorkNode.getInspectionInfoId())
.set(InspectionInfo::getIsReturnCar, InspectionConstants.INSPECTION_MEET_CAR_ORDER_IS_MEET_CAR_YES)
.set(InspectionInfo::getReturnCarUserId, SecurityFrameworkUtils.getLoginUserId()));
return true;
}
/**
* 引车
*
@ -942,6 +983,83 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
saveLeadRecord(inspectionInfo.getId(), loginUser.getId());
}
/**
* 获取业务方工单
*
* @param page
* @param inspectionInfo
* @return
*/
@Override
public IPage<InspectionInfo> geStelectInspectionByBusiness(Page<InspectionInfo> page, InspectionInfo inspectionInfo) {
return baseMapper.geStelectInspectionByBusiness(page, inspectionInfo);
}
/**
* @param partnerId
* @return
*/
@Override
public Map<String, Long> getBusinessCountByType(Integer partnerId) {
// 创建线程池
ExecutorService executor = Executors.newFixedThreadPool(10);
try {
InspectionInfo inspectionInfo = new InspectionInfo();
inspectionInfo.setPartnerId(partnerId.longValue());
// 获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// 获取当前登陆人的角色
// List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
// inspectionInfo.setLeadManId(loginUser.getId());
// List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
inspectionInfo.setUserId(loginUser.getId());
if (!"1".equals(inspectionInfo.getStatus())) {
inspectionInfo.setDealUserId(loginUser.getId());
}
Map<String, Long> result = new ConcurrentHashMap<>(); // 线程安全
// 这里 `5` 而不是 `6`因为 i `0` 开始
CompletableFuture<Void>[] futures = new CompletableFuture[3];
for (int i = 0; i < 3; 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, 1);
futures[i] = CompletableFuture.runAsync(() -> {
IPage<InspectionInfo> inspectionInfoIPage = baseMapper.geStelectInspectionByBusiness(page, infoCopy);
Long count = inspectionInfoIPage.getTotal();
result.put(status, count);
}, executor);
}
// 等待所有任务完成
CompletableFuture.allOf(futures).join();
return result;
} catch (Exception e) {
throw new RuntimeException("Failed to execute tasks in parallel", e);
} finally {
executor.shutdown();
try {
if (!executor.awaitTermination(10, TimeUnit.SECONDS)) {
executor.shutdownNow();
}
} catch (InterruptedException e) {
executor.shutdownNow();
}
}
}
/**
* 保存引车员记录
*

View File

@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.inspection.entity.InspectionPickCar;
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
import cn.iocoder.yudao.module.inspection.mapper.InspectionStaffMapper;
import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper;
import cn.iocoder.yudao.module.inspection.query.InspectionListQuery;
import cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery;
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
import cn.iocoder.yudao.module.inspection.service.InspectionStaffService;
@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.inspection.vo.ImportStaffVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo;
import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
import cn.iocoder.yudao.module.staff.service.UniqueCodeService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
@ -38,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
@ -68,6 +71,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Autowired
private InspectionWorkNodeMapper inspectionWorkNodeMapper;
@Resource
private UniqueCodeService uniqueCodeService;
/**
* 获取检测员工分页
*
@ -137,6 +143,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Override
public InspectionStaffSaveVo get(Long id) {
InspectionStaffSaveVo inspectionStaffSaveVo = baseMapper.get(id);
if (inspectionStaffSaveVo == null) {
return null;
}
// 查询用户角色集合
List<UserRoleDTO> userRoleDTOS = permissionService.userRoleDTOList(Collections.singletonList(id));
inspectionStaffSaveVo.setRoleIds(userRoleDTOS.stream()
@ -145,6 +154,8 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
.map(UserRoleDTO::getRoleId)
.collect(Collectors.toList()));
inspectionStaffSaveVo.setUserRoles(userRoleDTOS);
//将驾驶证类型转为数组
if (ObjectUtil.isNotEmpty(inspectionStaffSaveVo.getDriverLicenseType())) {
inspectionStaffSaveVo.setDriverLicenseTypeArr(Arrays.asList(inspectionStaffSaveVo.getDriverLicenseType().split(",")));
@ -156,6 +167,12 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
inspectionStaffSaveVo.setFolderId(null);
}
}
// 生成唯一推广码
if (inspectionStaffSaveVo.getUniqueCode() == null) {
inspectionStaffSaveVo.setUniqueCode(uniqueCodeService.createUniqueCode());
baseMapper.update(Wrappers.<InspectionStaff>lambdaUpdate().eq(InspectionStaff::getUserId, inspectionStaffSaveVo.getId()).set(InspectionStaff::getUniqueCode, inspectionStaffSaveVo.getUniqueCode()));
}
return inspectionStaffSaveVo;
}
@ -259,8 +276,8 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
* @return
*/
@Override
public IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, Long userId) {
return inspectionWorkNodeMapper.selectStaffProjectByUserId(page,userId);
public IPage<Map<String, Object>> getFinishProjectByUserId(Page<Map<String, Object>> page, InspectionListQuery query) {
return inspectionWorkNodeMapper.selectStaffProjectByUserId(page,query);
}
/**

View File

@ -112,4 +112,9 @@ public class InspectionInfoVo {
private String isMeetCar;
private String otherName;
private String otherPhone;
/** 还车人id */
private Long returnCarUserId;
private String returnCarUserName;
/** 是否还车 */
private Integer isReturnCar;
}

View File

@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.inspection.vo;
import cn.iocoder.yudao.annotation.Excel;
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@ -106,7 +108,12 @@ public class InspectionStaffSaveVo extends InspectionStaff {
private List<FileDO> fileList;
/**
* 角色集合
* 角色ID集合
*/
private List<Long> roleIds;
/**
* 角色集合
*/
private List<UserRoleDTO> userRoles;
}

View File

@ -241,23 +241,27 @@
<!-- </select>-->
<select id="getStaffCount" resultType="cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO"
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
SELECT
ip.id,ip.project_name, count(iwn.id) as count,is2.user_id,su.nickname
FROM inspection_staff is2
LEFT JOIN inspection_work_node iwn ON is2.user_id = iwn.deal_user_id
LEFT JOIN inspection_project ip ON iwn.project_id = ip.id
LEFT JOIN system_users su on su.id = is2.user_id
WHERE
ip.id in (
SELECT
ip2.id
FROM
inspection_project ip2
WHERE
ip2.deleted = 0
)
group by is2.user_id,ip.project_name
SELECT
ip.id AS project_id,
ip.project_name,
is2.user_id,
su.nickname,
COUNT(iwn.id) AS count
FROM inspection_staff is2
CROSS JOIN inspection_project ip
LEFT JOIN system_users su ON su.id = is2.user_id
LEFT JOIN inspection_work_node iwn ON
iwn.deal_user_id = is2.user_id
AND iwn.project_id = ip.id
<if test="datetimeRange != null">
AND iwn.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
</if>
WHERE
is2.deleted = 0
AND ip.deleted = 0
GROUP BY is2.user_id, ip.id
</select>
<select id="selectExceptionNodesByInspectionIds" resultType="java.util.Map">
SELECT
w.inspection_info_id AS inspectionInfoId,
@ -285,36 +289,54 @@
</select>
<select id="selectStaffProjectByUserId" resultType="java.util.Map">
SELECT
ii.id AS inspectionInfoId,
ii.user_id AS userId,
ii.user_name AS userName,
ii.buy_name AS buyName,
ii.buy_phone AS buyPhone,
ii.car_num AS carNum,
ii.car_model AS carModel,
ii.car_status AS carStatus,
ii.start_time AS startTime,
ii.end_time AS endTime,
ii.unit_name AS unitName,
ii.partner_id,
ii.work_id AS workId,
ii.worker_name AS workerName,
ii.worker_phone AS workerPhone,
ii.worker_avatar AS workerAvatar,
CASE
WHEN ii.is_pass = '0' THEN '不通过'
WHEN ii.is_pass = '1' THEN '通过'
WHEN ii.is_pass IS NULL THEN '进行中'
ELSE '未知'
END AS status,
GROUP_CONCAT(ip.project_name ORDER BY iwn.order_num SEPARATOR ',') AS projectName
ii.id AS inspectionInfoId,
ii.user_id AS userId,
ii.user_name AS userName,
ii.buy_name AS buyName,
ii.buy_phone AS buyPhone,
ii.car_num AS carNum,
ii.car_model AS carModel,
ii.car_status AS carStatus,
ii.start_time AS startTime,
ii.end_time AS endTime,
ii.unit_name AS unitName,
ii.partner_id,
ii.work_id AS workId,
ii.worker_name AS workerName,
ii.worker_phone AS workerPhone,
ii.worker_avatar AS workerAvatar,
CASE
WHEN ii.is_pass = '0' THEN '不通过'
WHEN ii.is_pass = '1' THEN '通过'
WHEN ii.is_pass IS NULL THEN '进行中'
ELSE '未知'
END AS status,
GROUP_CONCAT(ip.project_name ORDER BY iwn.order_num SEPARATOR ',') AS projectName
FROM inspection_work_node iwn
LEFT JOIN inspection_info ii ON iwn.inspection_info_id = ii.id
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
WHERE
iwn.deal_user_id = #{userId}
AND iwn.status = '2'
AND iwn.deleted = b'0'
LEFT JOIN inspection_info ii ON iwn.inspection_info_id = ii.id
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
<where>
<if test="query.userId != null">
AND iwn.deal_user_id = #{query.userId}
</if>
<if test="query.customerSource != null">
AND ii.customer_source = #{query.customerSource}
</if>
<if test="query.datetimeRange != null">
AND ii.create_time BETWEEN #{query.datetimeRange[0]} AND #{query.datetimeRange[1]}
</if>
<if test="query.customSource != null">
AND ii.customer_source = #{query.customSource}
</if>
<if test="query.bussiness != null">
AND ii.business_channel = #{query.bussiness}
</if>
<if test="query.projectId != null">
AND ip.id = #{query.projectId}
</if>
AND iwn.status = '2'
AND iwn.deleted = b'0'
</where>
GROUP BY ii.id
ORDER BY ii.start_time DESC;
</select>

View File

@ -265,7 +265,7 @@ where sig.partner_id =#{partnerId}
<!-- 待复检 -->
<if test="status == 4">
AND iwn.status = '3'
AND iwn.type = '0'
AND info.status != '1'
</if>
@ -476,6 +476,7 @@ FROM
count(1) allNum,
IFNULL(SUM(ii.status='0'),0) jxzNum,
IFNULL(SUM(ii.status='1'),0) ywcNum,
IFNULL(SUM(ii.status='1' and ii.is_pass='0'),0) tblNum,
IFNULL(SUM(oi.sku_name LIKE '%年审%'),0) nsNum,
IFNULL(SUM(oi.sku_name LIKE '%上户%'),0) shNum,
IFNULL(SUM(oi.sku_name LIKE '%非定检%'),0) fdjNum,
@ -710,7 +711,16 @@ FROM
AND TIMESTAMPDIFF(MINUTE, ii.start_time, ii.end_time)
BETWEEN #{query.inspectionTime[0]} AND #{query.inspectionTime[1]}
</if>
<if test="query.chooseStatus == '5'.toString()">
AND ii.reinspect_count != 0 AND ii.reinspect_count IS NOT NULL
</if>
<if test="query.chooseStatus == '6'.toString()">
AND ii.recheck_count != 0 AND ii.recheck_count IS NOT NULL
</if>
<if test="query.datetimeRange != null">
AND ii.create_time
BETWEEN CONCAT(#{query.datetimeRange[0]},' 00:00:00') AND CONCAT(#{query.datetimeRange[1]},' 23:59:59')
</if>
<if test="query.inspectionTime[0] !=null and query.inspectionTime.length == 1">
AND ii.start_time IS NOT NULL AND ii.end_time IS NOT NULL
AND TIMESTAMPDIFF(MINUTE, ii.start_time, ii.end_time) >= #{query.inspectionTime[0]}

View File

@ -20,4 +20,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND record.create_time between #{startTime} and #{endTime}
</if>
</select>
<select id="query" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionFileRecord">
select record.*
from inspection_file_record record
INNER JOIN inspection_file file on record.file_id = file.id
where record.deleted = 0
AND file.service_package_id = #{servicePackageId}
<if test="startTime != null">
AND record.create_time between #{startTime} and #{endTime}
</if>
order by record.create_time desc
</select>
</mapper>

View File

@ -375,6 +375,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ii.status = '0'
ORDER BY ii.update_time DESC
</if>
<!-- 还车 -->
<if test="inspectionInfo.status == 10">
AND ii.is_return_car != 1
AND ii.status = '1'
ORDER BY ii.update_time DESC
</if>
</where>
) AS subquery
WHERE rn = 1;
@ -566,6 +572,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND ii.lead_man_id IS NULL
AND ii.status = '0'
</if>
<!-- 还车 -->
<if test="inspectionInfo.status == 10">
AND ii.is_return_car != 1
AND ii.status = '1'
ORDER BY ii.update_time DESC
</if>
</where>
</if>
<if test="inspectionInfo.status == 6">
@ -605,4 +617,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
</select>
<select id="geStelectInspectionByBusiness"
resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT imco.meet_man_id,imco.buy_name,imco.buy_phone, imco.car_num,imco.other_phone
<if test="info.status != 1">
,ii.id AS id,imco.id AS meetCarId,oi.sku_name AS skuName,oi.goods_title,ii.*
</if>
<if test="info.status == 1">
,imco.id AS id
</if>
FROM inspection_meet_car_order imco
JOIN inspection_business_channel ibc
ON imco.customer_source_id = ibc.id
<if test="info.status != 1">
INNER JOIN inspection_info ii ON imco.inspection_info_id = ii.id AND ii.deleted = 0
LEFT JOIN order_info oi ON ii.inspection_order_id = oi.id AND oi.deleted = 0
</if>
<where>
ibc.deleted = 0
AND imco.deleted = 0
<if test="info.userId != null and info.userId != ''">
AND FIND_IN_SET(#{info.userId}, ibc.user_ids)
AND imco.creator = #{info.userId}
</if>
<if test="info.carNum != null and info.carNum != ''">
AND imco.car_num LIKE CONCAT('%', #{info.carNum}, '%')
</if>
<if test="info.status == 2">
AND ii.status = '0'
</if>
<if test="info.status == 3">
AND ii.status = '1'
</if>
</where>
</select>
</mapper>

View File

@ -68,7 +68,8 @@
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type,
iss.folder_id
iss.folder_id,
iss.unique_code
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id

View File

@ -589,6 +589,9 @@ public class SysLoginController {
Map<String, Object> map = new HashMap<>();
map.put("partnerId", user.getTenantId());
map.put("user", user);
// 查询用户表信息
AdminUserDO selectUser = userService.getUser(user.getId());
map.put("userInfo", selectUser);
return CommonResult.success(map);
}

View File

@ -44,4 +44,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
return selectList(new LambdaQueryWrapperX<RoleDO>().in(RoleDO::getCode, codes));
}
default List<RoleDO> selectListByPackageIds(@Nullable Collection<String> packageIds){
return selectList(new LambdaQueryWrapperX<RoleDO>().in(RoleDO::getServicePackageId, packageIds).eq(RoleDO::getTenantId, CommonStr.TENANT_ID));
}
}

View File

@ -259,7 +259,8 @@ public class RoleServiceImpl implements RoleService {
if (CollectionUtil.isEmpty(codes)) {
return Collections.emptyList();
}
return roleMapper.selectListByCodes(codes);
// return roleMapper.selectListByCodes(codes);
return roleMapper.selectListByPackageIds(codes);
}
/**