This commit is contained in:
xyc 2025-06-13 17:06:48 +08:00
parent e65d3e4972
commit c22edb5c6d
7 changed files with 52 additions and 3 deletions

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

@ -2308,16 +2308,31 @@ 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(

View File

@ -21,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;
@ -39,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;
@ -69,6 +71,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
@Autowired
private InspectionWorkNodeMapper inspectionWorkNodeMapper;
@Resource
private UniqueCodeService uniqueCodeService;
/**
* 获取检测员工分页
*
@ -138,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()
@ -146,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(",")));
@ -157,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;
}

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

@ -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,

View File

@ -640,6 +640,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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>

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