更新
This commit is contained in:
parent
69aecb2693
commit
09d46e1b02
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspection.controller.admin;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
|
||||||
|
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessMeetAddressRecordService;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/inspection-business-meet-address-record")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class InspectionBusinessMeetAddressRecordController {
|
||||||
|
|
||||||
|
private final InspectionBusinessMeetAddressRecordService inspectionBusinessMeetAddressRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取地址列表
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public CommonResult<?> list(Long userId) {
|
||||||
|
return CommonResult.success(inspectionBusinessMeetAddressRecordService.list(Wrappers.<InspectionBusinessMeetAddressRecord>lambdaQuery()
|
||||||
|
.eq(InspectionBusinessMeetAddressRecord::getUserId, userId)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspection.entity;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class InspectionBusinessMeetAddressRecord extends TenantBaseDO {
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务经理的userId
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上门接车地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
}
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspection.mapper;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface InspectionBusinessMeetAddressRecordMapper extends BaseMapper<InspectionBusinessMeetAddressRecord> {
|
||||||
|
}
|
||||||
@ -98,5 +98,5 @@ public interface InspectionInfoMapper extends BaseMapper<InspectionInfo>
|
|||||||
|
|
||||||
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
|
IPage<InspectionInfo> geStelectInspectionByBusiness(@Param("page") Page<InspectionInfo> page,@Param("info") InspectionInfo inspectionInfo);
|
||||||
|
|
||||||
List<InspectionInfo> selectMeetCarList();
|
List<InspectionInfo> selectMeetCarList(@Param("datetimeRange") List<String> datetimeRange);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,5 +176,5 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
|
|||||||
|
|
||||||
Map<String, Long> getBusinessCountByType(Integer partnerId);
|
Map<String, Long> getBusinessCountByType(Integer partnerId);
|
||||||
|
|
||||||
List<InspectionInfo> selectMeetCarList();
|
List<InspectionInfo> selectMeetCarList(List<String> datetimeRange);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,7 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspection.service;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface InspectionBusinessMeetAddressRecordService extends IService<InspectionBusinessMeetAddressRecord> {
|
||||||
|
}
|
||||||
@ -2302,7 +2302,7 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
|||||||
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
|
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
|
||||||
List<Map<String, Object>> staffCount = inspectionWorkNodeService.getStaffCount(dlInspectionProject);
|
List<Map<String, Object>> staffCount = inspectionWorkNodeService.getStaffCount(dlInspectionProject);
|
||||||
// 根据userId查询检测工单表 接车人
|
// 根据userId查询检测工单表 接车人
|
||||||
List<InspectionInfo> list = inspectionInfoService.selectMeetCarList();
|
List<InspectionInfo> list = inspectionInfoService.selectMeetCarList(dlInspectionProject.getDatetimeRange());
|
||||||
// 统计每个 meetManId 的数量,避免 null key 异常
|
// 统计每个 meetManId 的数量,避免 null key 异常
|
||||||
Map<Long, List<InspectionInfo>> meetManIdCountMap = list.stream()
|
Map<Long, List<InspectionInfo>> meetManIdCountMap = list.stream()
|
||||||
.filter(info -> info.getMeetManId() != null) // 过滤 null 值
|
.filter(info -> info.getMeetManId() != null) // 过滤 null 值
|
||||||
@ -2317,17 +2317,27 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
|||||||
.collect(Collectors.groupingBy(InspectionInfo::getReturnCarUserId));
|
.collect(Collectors.groupingBy(InspectionInfo::getReturnCarUserId));
|
||||||
|
|
||||||
for (Map<String, Object> stringObjectMap : staffCount) {
|
for (Map<String, Object> stringObjectMap : staffCount) {
|
||||||
|
Set<Long> inspectionInfoIds = new HashSet<>();
|
||||||
|
|
||||||
Long userId = (Long) stringObjectMap.get("userId");
|
Long userId = (Long) stringObjectMap.get("userId");
|
||||||
List<Map<String, Object>> children = (List<Map<String, Object>>) stringObjectMap.get("children");
|
List<Map<String, Object>> children = (List<Map<String, Object>>) stringObjectMap.get("children");
|
||||||
// stringObjectMap.put("meetCarCount", meetManIdCountMap.get(userId));
|
inspectionInfoIds.addAll(
|
||||||
|
children.stream()
|
||||||
|
.map(map -> (String) map.get("inspectionInfoId")) // 获取逗号分隔的字符串
|
||||||
|
.flatMap(idsStr -> Arrays.stream(idsStr.split(","))) // 拆分成单个ID字符串
|
||||||
|
.map(String::trim) // 去除前后空格
|
||||||
|
.filter(idStr -> !idStr.isEmpty()) // 过滤空字符串
|
||||||
|
.map(Long::valueOf) // 转换为Long类型
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
// 获取所有接车信息
|
// 获取所有接车信息
|
||||||
List<InspectionInfo> inspectionInfos = meetManIdCountMap.get(userId);
|
List<InspectionInfo> inspectionInfos = meetManIdCountMap.get(userId);
|
||||||
stringObjectMap.put("totalCount", (Long) stringObjectMap.get("totalCount") == null ? 0 : (Long) stringObjectMap.get("totalCount") + (meetManIdCountMap.get(userId) == null ? 0 : meetManIdCountMap.get(userId).size()));
|
|
||||||
long meetCount = 0;
|
long meetCount = 0;
|
||||||
long meetGoCount = 0;
|
long meetGoCount = 0;
|
||||||
if (CollUtil.isNotEmpty(inspectionInfos)) {
|
if (CollUtil.isNotEmpty(inspectionInfos)) {
|
||||||
meetCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(0).equals(inspectionInfo.getMeetType())).count();
|
meetCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(0).equals(inspectionInfo.getMeetType())).count();
|
||||||
meetGoCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(1).equals(inspectionInfo.getMeetType())).count();
|
meetGoCount = inspectionInfos.stream().filter(inspectionInfo -> Integer.valueOf(1).equals(inspectionInfo.getMeetType())).count();
|
||||||
|
inspectionInfoIds.addAll(inspectionInfos.stream().map(InspectionInfo::getId).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
||||||
objectObjectHashMap.put("count", meetCount);
|
objectObjectHashMap.put("count", meetCount);
|
||||||
@ -2344,6 +2354,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
|||||||
long returnCount = 0;
|
long returnCount = 0;
|
||||||
long returnGoCount = 0;
|
long returnGoCount = 0;
|
||||||
if (CollUtil.isNotEmpty(returnCarInfoList)) {
|
if (CollUtil.isNotEmpty(returnCarInfoList)) {
|
||||||
|
inspectionInfoIds.addAll(returnCarInfoList.stream().map(InspectionInfo::getId).collect(Collectors.toList()));
|
||||||
|
|
||||||
returnCount = Optional.ofNullable(returnCarInfoList)
|
returnCount = Optional.ofNullable(returnCarInfoList)
|
||||||
.orElse(Collections.emptyList())
|
.orElse(Collections.emptyList())
|
||||||
.stream()
|
.stream()
|
||||||
@ -2358,7 +2370,8 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
|||||||
.filter(i -> i.getReturnType() != null && i.getReturnType() == 1)
|
.filter(i -> i.getReturnType() != null && i.getReturnType() == 1)
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
stringObjectMap.put("totalCount", (Long) stringObjectMap.get("totalCount") == null ? 0 : (Long) stringObjectMap.get("totalCount") + (returnCarUserIdCountMap.get(userId) == null ? 0 : returnCarUserIdCountMap.get(userId).size()));
|
stringObjectMap.put("totalCount", Long.parseLong(String.valueOf(inspectionInfoIds.size())));
|
||||||
|
|
||||||
Map<String, Object> objectObjectHashMap1 = new HashMap<>();
|
Map<String, Object> objectObjectHashMap1 = new HashMap<>();
|
||||||
objectObjectHashMap1.put("count", returnCount);
|
objectObjectHashMap1.put("count", returnCount);
|
||||||
objectObjectHashMap1.put("projectName", "还车拍照");
|
objectObjectHashMap1.put("projectName", "还车拍照");
|
||||||
|
|||||||
@ -0,0 +1,11 @@
|
|||||||
|
package cn.iocoder.yudao.module.inspection.service.impl;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessMeetAddressRecord;
|
||||||
|
import cn.iocoder.yudao.module.inspection.mapper.InspectionBusinessMeetAddressRecordMapper;
|
||||||
|
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessMeetAddressRecordService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class InspectionBusinessMeetAddressRecordServiceImpl extends ServiceImpl<InspectionBusinessMeetAddressRecordMapper, InspectionBusinessMeetAddressRecord> implements InspectionBusinessMeetAddressRecordService {
|
||||||
|
}
|
||||||
@ -1070,8 +1070,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<InspectionInfo> selectMeetCarList() {
|
public List<InspectionInfo> selectMeetCarList(List<String> datetimeRange) {
|
||||||
return baseMapper.selectMeetCarList();
|
return baseMapper.selectMeetCarList(datetimeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -445,6 +445,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
|
public List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject) {
|
||||||
Map<Long, Map<String, Object>> tempMap = new LinkedHashMap<>();
|
Map<Long, Map<String, Object>> tempMap = new LinkedHashMap<>();
|
||||||
List<StaffProjectCountVO> staffCount = baseMapper.getStaffCount(dlInspectionProject);
|
List<StaffProjectCountVO> staffCount = baseMapper.getStaffCount(dlInspectionProject);
|
||||||
|
|
||||||
for (StaffProjectCountVO vo : staffCount) {
|
for (StaffProjectCountVO vo : staffCount) {
|
||||||
Map<String, Object> userEntry = tempMap.computeIfAbsent(vo.getUserId(), k -> {
|
Map<String, Object> userEntry = tempMap.computeIfAbsent(vo.getUserId(), k -> {
|
||||||
Map<String, Object> m = new HashMap<>();
|
Map<String, Object> m = new HashMap<>();
|
||||||
@ -464,6 +465,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
project.put("projectName", vo.getProjectName());
|
project.put("projectName", vo.getProjectName());
|
||||||
project.put("count", vo.getCount());
|
project.put("count", vo.getCount());
|
||||||
project.put("id", vo.getId());
|
project.put("id", vo.getId());
|
||||||
|
project.put("inspectionInfoId", vo.getInspectionInfoIds());
|
||||||
children.add(project);
|
children.add(project);
|
||||||
|
|
||||||
// 累加总数
|
// 累加总数
|
||||||
|
|||||||
@ -10,4 +10,6 @@ public class StaffProjectCountVO {
|
|||||||
private String nickname;
|
private String nickname;
|
||||||
private String projectName;
|
private String projectName;
|
||||||
private Long nodeCount;
|
private Long nodeCount;
|
||||||
|
// private Long inspectionInfoId;
|
||||||
|
private String inspectionInfoIds;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.util;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
public class ListUtil {
|
||||||
|
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||||
|
Set<Object> seen = ConcurrentHashMap.newKeySet();
|
||||||
|
return t -> {
|
||||||
|
Object key = keyExtractor.apply(t);
|
||||||
|
return key != null && seen.add(key); // 关键是这一行
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -242,10 +242,40 @@
|
|||||||
<select id="getStaffCount" resultType="cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO"
|
<select id="getStaffCount" resultType="cn.iocoder.yudao.module.inspection.vo.StaffProjectCountVO"
|
||||||
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
|
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
|
||||||
SELECT
|
SELECT
|
||||||
|
staff.user_id,
|
||||||
|
iwn.id,
|
||||||
|
ip.project_name,
|
||||||
|
ip.id AS project_id,
|
||||||
|
GROUP_CONCAT(iwn.inspection_info_id) AS inspectionInfoIds,
|
||||||
|
su.nickname,
|
||||||
|
SUM(IF(iwn.node_count = 0,1,iwn.node_count)) count
|
||||||
|
FROM
|
||||||
|
inspection_staff staff
|
||||||
|
LEFT JOIN inspection_work_node iwn ON iwn.deal_user_id = staff.user_id
|
||||||
|
LEFT JOIN inspection_project ip ON ip.id = iwn.project_id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT sur.user_id
|
||||||
|
FROM system_user_role sur
|
||||||
|
JOIN system_role sr ON sur.role_id = sr.id
|
||||||
|
WHERE sr.service_package_id = 'jiance'
|
||||||
|
AND sr.CODE NOT IN ('jcyh', 'jcywjl')
|
||||||
|
) valid_roles ON staff.user_id = valid_roles.user_id
|
||||||
|
LEFT JOIN system_users su ON su.id = staff.user_id
|
||||||
|
<where>
|
||||||
|
staff.deleted = 0
|
||||||
|
AND (valid_roles.user_id IS NOT NULL) -- 只保留有合格角色的用户
|
||||||
|
<if test="datetimeRange != null">
|
||||||
|
AND iwn.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
GROUP BY staff.user_id ,ip.id
|
||||||
|
|
||||||
|
<!--SELECT
|
||||||
ip.id AS project_id,
|
ip.id AS project_id,
|
||||||
ip.project_name,
|
ip.project_name,
|
||||||
is2.user_id,
|
is2.user_id,
|
||||||
su.nickname,
|
su.nickname,
|
||||||
|
iwn.inspection_info_id,
|
||||||
COUNT(iwn.id) AS count,
|
COUNT(iwn.id) AS count,
|
||||||
SUM(iwn.node_count) AS nodeCount
|
SUM(iwn.node_count) AS nodeCount
|
||||||
FROM inspection_staff is2
|
FROM inspection_staff is2
|
||||||
@ -253,7 +283,7 @@
|
|||||||
LEFT JOIN system_users su ON su.id = is2.user_id
|
LEFT JOIN system_users su ON su.id = is2.user_id
|
||||||
left join system_user_role sr on su.id = sr.user_id
|
left join system_user_role sr on su.id = sr.user_id
|
||||||
left join system_role sr2 on sr.role_id = sr2.id
|
left join system_role sr2 on sr.role_id = sr2.id
|
||||||
LEFT JOIN inspection_work_node iwn ON
|
INNER JOIN inspection_work_node iwn ON
|
||||||
iwn.deal_user_id = is2.user_id
|
iwn.deal_user_id = is2.user_id
|
||||||
AND iwn.project_id = ip.id
|
AND iwn.project_id = ip.id
|
||||||
<if test="datetimeRange != null">
|
<if test="datetimeRange != null">
|
||||||
@ -262,7 +292,7 @@
|
|||||||
WHERE
|
WHERE
|
||||||
is2.deleted = 0
|
is2.deleted = 0
|
||||||
AND su.deleted = 0 and sr2.service_package_id = 'jiance' and sr2.code != 'jcyh' and sr2.code != 'jcywjl'
|
AND su.deleted = 0 and sr2.service_package_id = 'jiance' and sr2.code != 'jcyh' and sr2.code != 'jcywjl'
|
||||||
GROUP BY is2.user_id, ip.id
|
GROUP BY is2.user_id, ip.id-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectExceptionNodesByInspectionIds" resultType="java.util.Map">
|
<select id="selectExceptionNodesByInspectionIds" resultType="java.util.Map">
|
||||||
|
|||||||
@ -656,6 +656,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
SELECT ii.*, imco.meet_type
|
SELECT ii.*, imco.meet_type
|
||||||
FROM inspection_info ii
|
FROM inspection_info ii
|
||||||
LEFT JOIN inspection_meet_car_order imco ON ii.id = imco.inspection_info_id
|
LEFT JOIN inspection_meet_car_order imco ON ii.id = imco.inspection_info_id
|
||||||
WHERE ii.deleted = 0 AND imco.deleted = 0 AND imco.is_meet = '1'
|
<where>
|
||||||
|
ii.deleted = 0 AND imco.deleted = 0 AND imco.is_meet = '1'
|
||||||
|
<if test="datetimeRange != null">
|
||||||
|
AND imco.create_time BETWEEN #{datetimeRange[0]} AND #{datetimeRange[1]}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user