Compare commits

...

7 Commits

Author SHA1 Message Date
Lihx
691c3f3220 0608 2025-06-08 15:57:00 +08:00
xyc
5a8b8e92c3 Merge branch 'driver' 2025-06-06 17:38:57 +08:00
xyc
c226a8692a Merge branch 'driver' 2025-05-28 17:31:51 +08:00
xyc
beb37ddd78 更新 2025-05-28 16:05:10 +08:00
xyc
8802208c01 更新 2025-05-27 17:51:23 +08:00
xyc
ca9bdc21cc 更新 2025-05-27 14:24:04 +08:00
xyc
843a21a44e 更新 2025-05-24 17:07:24 +08:00
29 changed files with 543 additions and 49 deletions

View File

@ -33,7 +33,12 @@ public class InspectionMeetCarOrderController {
}
@GetMapping("/get")
public CommonResult<?> get(Long id){
public CommonResult<?> get(Long id) {
return CommonResult.success(inspectionMeetCarOrderService.getById(id));
}
@DeleteMapping("/delete")
public CommonResult<?> delete(Long id) {
return CommonResult.success(inspectionMeetCarOrderService.removeById(id));
}
}

View File

@ -756,6 +756,17 @@ public class PartnerOwnController extends BaseController {
return success(partnerList.staticsTable3(partners.getPartnerId(), startTime, endTime));
}
/**
* 客户来源统计
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@GetMapping("/customerSourceCount")
public CommonResult<?> customerSourceCount(String startTime, String endTime, Long businessId) {
return success(partnerList.customerSourceCount(startTime, endTime, businessId));
}
//新统计表格3
@GetMapping("/newStaticsTable3")
public CommonResult newStaticsTable3(String startTime, String endTime) throws Exception {
@ -899,4 +910,16 @@ public class PartnerOwnController extends BaseController {
public CommonResult<?> getStaffCount(@RequestBody DlInspectionProject dlInspectionProject) {
return success(partnerList.getStaffCount(dlInspectionProject));
}
/**
* 文件统计
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@GetMapping("/fileStatistics")
public CommonResult<?> fileStatistics(String servicePackageId,@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime){
return success(partnerList.fileStatistics(servicePackageId,startTime, endTime));
}
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.inspection.controller.admin;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessChannelService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/channel")
@RequiredArgsConstructor
public class InspectionBusinessChannelController {
private final InspectionBusinessChannelService inspectionBusinessChannelService;
/**
* 获取业务渠道/客户来源树结构
*/
@GetMapping("/tree")
public CommonResult<List<InspectionBusinessChannel>> getChannelTree(InspectionBusinessChannel channel) {
return CommonResult.success(inspectionBusinessChannelService.list(Wrappers.<InspectionBusinessChannel>lambdaQuery()
.like(ObjectUtil.isNotEmpty(channel.getName()), InspectionBusinessChannel::getName, channel.getName())));
}
/**
* 新增业务渠道或客户来源
*/
@PostMapping("/add")
public boolean addChannel(@RequestBody InspectionBusinessChannel channel) {
return inspectionBusinessChannelService.save(channel);
}
/**
* 获取业务渠道或客户来源
*/
@GetMapping("/{id}")
public CommonResult<InspectionBusinessChannel> getChannelById(@PathVariable("id") Long id) {
return CommonResult.success(inspectionBusinessChannelService.getById(id));
}
/**
* 修改业务渠道或客户来源
*/
@PutMapping("/update")
public CommonResult<?> updateChannel(@RequestBody InspectionBusinessChannel channel) {
return CommonResult.success(inspectionBusinessChannelService.updateById(channel));
}
/**
* 删除业务渠道或客户来源
*/
@DeleteMapping("/delete/{id}")
public CommonResult<?> deleteChannel(@PathVariable("id") Long id) {
return CommonResult.success(inspectionBusinessChannelService.removeById(id));
}
/**
* 获取业务渠道或客户来源列表(app)
* @return
*/
@GetMapping("/list")
public CommonResult<?> list(){
return CommonResult.success(inspectionBusinessChannelService.getChannelTree());
}
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.inspection.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.List;
@Data
public class InspectionBusinessChannel extends TenantBaseDO {
private Integer id; // 主键ID
private Integer pid; // 父ID
private String name; // 名称
private Integer type; // 0-业务渠道 1-客户来源
// 子节点
@TableField(exist = false)
private List<InspectionBusinessChannel> children;
}

View File

@ -34,6 +34,8 @@ public class InspectionInfo extends TenantBaseDO
private String buyPhone;
private String userAddress;
private String unitName;
private Integer customerSourceId; //客户来源id
private Integer businessChannelId; //业务渠道id
private Long partnerId;
/** 检测工主键 */
@ -69,6 +71,8 @@ public class InspectionInfo extends TenantBaseDO
private Integer recheckCount;
/** 重检次数 */
private Integer reinspectCount;
private String businessChannel; //业务渠道
private String otherName;
/** 0进行中1已结束 */
@Excel(name = "0进行中1已结束")

View File

@ -65,6 +65,11 @@ public class InspectionMeetCarOrder extends TenantBaseDO {
private String goodsTitle;
private Long skuId;
private String skuName;
private String otherPhone;
private String otherName;
private String businessChannel; //业务渠道
private Integer customerSourceId; //客户来源id
private Integer businessChannelId; //业务渠道id
/**
* 接车类型 0接待 1上门取车

View File

@ -135,4 +135,14 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
* @param endTime 结束时间
*/
List<Map<String, Object>> queryInspectionSkuList(@Param("startTime") String startTime, @Param("endTime") String endTime);
/**
* 获取业务统计
* @param startTime
* @param endTime
* @return
*/
List<Map<String, Object>> selectBusinessStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime);
List<Map<String, Object>> customerSourceCount(@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("businessId") Long businessId);
}

View File

@ -0,0 +1,9 @@
package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface InspectionBusinessChannelMapper extends BaseMapper<InspectionBusinessChannel> {
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.inspection.mapper;
import cn.iocoder.yudao.module.inspection.entity.InspectionFileRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -20,4 +21,6 @@ public interface InspectionFileRecordMapper extends BaseMapper<InspectionFileRec
* @return
*/
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(@Param("servicePackageId") String servicePackageId,@Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@ -40,4 +40,7 @@ public class OrderTableQuery {
/** 等于1时是查询预约转订单 */
private String type;
/** 检测时长 */
private String[] inspectionTime;
}

View File

@ -243,4 +243,23 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
* @return 结果
*/
List<Map<String, Object>> getStaffCount(DlInspectionProject dlInspectionProject);
/**
* 文件统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
Map<String, Object> fileStatistics(String servicePackageId, String startTime, String endTime);
/**
* 客户来源统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @param businessId 业务渠道id
* @return
*/
List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId);
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.inspection.service;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface InspectionBusinessChannelService extends IService<InspectionBusinessChannel> {
List<InspectionBusinessChannel> getChannelTree();
}

View File

@ -19,4 +19,6 @@ public interface InspectionFileRecordService extends IService<InspectionFileReco
* @return 检测文档记录列表
*/
List<InspectionFileRecord> getRecordList(Long id);
long queryCount(String servicePackageId, String startTime, String endTime);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.inspection.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
@ -74,6 +75,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service("appInspectionPartnerService")
@ -139,6 +141,10 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
private InspectionSocket inspectionSocket;
@Autowired
private IInspectionWorkNodeService workNodeService;
@Autowired
private IInspectionFileService inspectionFileService;
@Autowired
private InspectionFileRecordService inspectionFileRecordService;
@Override
public IPage<PartnerListVo> partnerList(Page<PartnerListVo> page, PartnerListQuery partnerListQuery) {
@ -1530,73 +1536,144 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
@Override
public InspectionInfoVo inspectionDetail(Long inspectionInfoId) {
InspectionInfo info = inspectionInfoService.getById(inspectionInfoId);
if (info == null) return null;
OrderInfo order = orderService.getById(info.getInspectionOrderId());
if (order == null) return null;
InspectionGoodsSku sku = skuService.getById(order.getSkuId());
AdminUserDO buyUser = userService.getUser(info.getUserId());
AdminUserDO worker = userService.getUser(info.getWorkId());
ShopInspectionGoods goods = goodsService.getById(order.getGoodsId());
ShopInspectionCategory category = categoryService.getById(info.getCategoryId());
// 批量查询用户信息
Set<Long> userIds = new HashSet<>();
userIds.add(info.getUserId());
userIds.add(info.getWorkId());
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)
//转为map
Map<Long, AdminUserDO> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, Function.identity()));
AdminUserDO buyUser = userMap.get(info.getUserId());
AdminUserDO worker = userMap.get(info.getWorkId());
AdminUserDO leadMan = userMap.get(info.getLeadManId());
AdminUserDO meetMan = userMap.get(info.getMeetManId());
InspectionInfoVo res = new InspectionInfoVo();
BeanUtils.copyProperties(order, res);
BeanUtils.copyProperties(order, res); // 建议手动复制必要字段
res.setInspectionId(info.getId());
if (ObjectUtil.isNotNull(worker)) {
res.setWorkerAvatar(Optional.ofNullable(worker.getAvatar()).orElse(null));
res.setWorkerName(Optional.ofNullable(worker.getNickname()).orElse(null));
res.setBuyUserName(buyUser != null ? buyUser.getNickname() : "");
res.setBuyUserPhone(buyUser != null ? buyUser.getMobile() : "");
if (worker != null) {
res.setWorkerAvatar(worker.getAvatar());
res.setWorkerName(worker.getNickname());
res.setWorkerPhone(worker.getMobile());
}
/*根据工单表中的leadManId查询对应的引车员*/
if (ObjectUtil.isNotNull(info.getLeadManId())) {
AdminUserDO leadMan = adminUserService.getById(info.getLeadManId());
if (ObjectUtil.isNotNull(leadMan)) {
res.setLeadManName(leadMan.getNickname());
res.setLeadManId(info.getLeadManId());
}
res.setOtherName(info.getOtherName());
res.setOtherPhone(info.getOtherPhone());
res.setCustomerSource(info.getCustomerSource());
res.setBusinessChannel(info.getBusinessChannel());
// 车系处理
res.setCarModel(extractCarModel(info.getCarModel()));
// 处理检测时长
if ("1".equals(info.getStatus())) {
long durationMs = calculateInspectionDuration(info);
res.setInspectionDuration(formatDuration(durationMs));
}
if (info.getCarRegisterDate() != null) {
long days = DateUtil.between(info.getCarRegisterDate(), new Date(), DateUnit.DAY);
long carAge = days / 365; // 向下取整
res.setCarAge(carAge);
}
if (leadMan != null) {
res.setLeadManName(leadMan.getNickname());
res.setLeadManId(leadMan.getId());
} else {
res.setLeadManName("");
}
/*根据工单表中的meetManId查询对应的 MeetMan*/
if (ObjectUtil.isNotNull(info.getMeetManId())) {
AdminUserDO meetMan = adminUserService.getById(info.getMeetManId());
if (ObjectUtil.isNotNull(meetMan)) {
res.setMeetManName(meetMan.getNickname());
res.setMeetManId(info.getMeetManId());
}
if (meetMan != null) {
res.setMeetManName(meetMan.getNickname());
res.setMeetManId(meetMan.getId());
} else {
res.setMeetManName("");
}
res.setBuyUserName(Optional.ofNullable(buyUser.getNickname()).orElse(""));
res.setBuyUserPhone(buyUser.getMobile());
// 设置订单相关字段
res.setGoodsId(order.getGoodsId());
res.setGoodsPrice(order.getGoodsPrice());
res.setIsOnline(order.getIsOnline());
res.setOrderStatus(order.getOrderStatus());
// SKU 信息
res.setGoodsName(sku != null ? sku.getSkuName() : null);
// 图片
res.setGoodsImage(goods != null ? goods.getImage() : null);
// 检测信息字段
res.setCarNum(info.getCarNum());
res.setCategoryId(info.getCategoryId());
res.setCarType(category != null ? category.getCategoryName() : null);
res.setStartTime(info.getStartTime());
res.setEndTime(info.getEndTime());
res.setStatus(info.getStatus());
res.setGoodsId(order.getGoodsId());
res.setGoodsPrice(order.getGoodsPrice());
res.setGoodsName(sku.getSkuName());
res.setIsOnline(order.getIsOnline());
res.setRecheckCount(info.getRecheckCount());
res.setReinspectCount(info.getReinspectCount());
res.setIsRetrial(info.getIsRetrial());
res.setIsPass(info.getIsPass());
res.setRemark(info.getRemark());
res.setMakeCert(info.getMakeCert());
res.setOrderStatus(order.getOrderStatus());
ShopInspectionGoods goods = goodsService.getById(order.getGoodsId());
res.setGoodsImage(goods.getImage());
LambdaQueryWrapper<InspectionStepInfo> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(InspectionStepInfo::getInspectionInfoId, inspectionInfoId).orderByAsc(InspectionStepInfo::getStepNum);
queryWrapper.orderBy(true, false, InspectionStepInfo::getId);
// 步骤信息
List<InspectionStepInfo> list = stepInfoService.listByInspectionInfoId(inspectionInfoId);
if (CollectionUtil.isNotEmpty(list)) {
res.setStepInfos(list);
}
ShopInspectionCategory category = categoryService.getById(info.getCategoryId());
res.setCarType(category.getCategoryName());
// 查询节点表
List<InspectionWorkNode> workNodes = inspectionWorkNodeService.getWeorkNodesById(Integer.parseInt(String.valueOf(inspectionInfoId)));
// 工作节点
List<InspectionWorkNode> workNodes = inspectionWorkNodeService.getWeorkNodesById(inspectionInfoId.intValue());
res.setWorkNodes(workNodes);
return res;
}
private String extractCarModel(String carModel) {
if (StrUtil.isBlank(carModel)) return null;
int idx = carModel.indexOf("");
return idx > 0 ? carModel.substring(0, idx) : carModel;
}
private long calculateInspectionDuration(InspectionInfo info) {
if (info.getEndTime() != null) {
return DateUtil.betweenMs(info.getStartTime(), info.getEndTime());
}
InspectionStepInfo latest = stepInfoService.getOne(Wrappers.<InspectionStepInfo>lambdaQuery()
.eq(InspectionStepInfo::getInspectionInfoId, info.getId())
.orderByDesc(InspectionStepInfo::getCreateTime).last("LIMIT 1"));
return latest != null ? DateUtil.betweenMs(info.getStartTime(), latest.getUpdateTime()) : 0;
}
private String formatDuration(long ms) {
long minutes = ms / (1000 * 60);
return (minutes / 60) + "小时" + (minutes % 60) + "";
}
@Override
public List<InspectionInfo> workerInspectionList(Long workerId, String status, String searchValue) {
return baseMapper.workerInspectionList(workerId, status, searchValue);
@ -1949,7 +2026,8 @@ 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.staticsTable3(partnerId, startTime, endTime);
List<Map<String, Object>> res = baseMapper.selectBusinessStatistics( startTime, endTime);
return res;
}
@ -2241,4 +2319,55 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
}
return staffCount;
}
/**
* 文件统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return 结果
*/
@Override
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");
}
if (StringUtils.isEmpty(endTime)) {
endTime = DateUtil.format(DateUtil.endOfMonth(new Date()), "yyyy-MM-dd");
}
long addCount = inspectionFileService.count(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getServicePackageId, servicePackageId)
.between(InspectionFile::getCreateTime, startTime, endTime));
// 查询文件记录表
long updateCount = inspectionFileRecordService.queryCount(servicePackageId, startTime, endTime);
Map<String, Object> map = new HashMap<>();
map.put("addCount", addCount);
map.put("updateCount", updateCount);
return map;
}
/**
* 客户来源统计
*
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@Override
public List<Map<String, Object>> customerSourceCount(String startTime, String endTime, Long businessId) {
// 判断开始时间与结束时间如果为空 默认查询本月
if (StringUtils.isNotEmpty(startTime)) {
startTime = startTime + " 00:00:00";
}
if (StringUtils.isNotEmpty(endTime)) {
endTime = endTime + " 23:59:59";
}
List<Map<String, Object>> maps = baseMapper.customerSourceCount(startTime, endTime, businessId);
// 根据map中的theNum从大到小排序
maps.sort(Comparator.comparingInt(map -> -Integer.parseInt(map.get("theNum").toString())));
return maps;
}
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.inspection.service.impl;
import cn.iocoder.yudao.module.inspection.entity.InspectionBusinessChannel;
import cn.iocoder.yudao.module.inspection.mapper.InspectionBusinessChannelMapper;
import cn.iocoder.yudao.module.inspection.service.InspectionBusinessChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class InspectionBusinessChannelServiceImpl extends ServiceImpl<InspectionBusinessChannelMapper, InspectionBusinessChannel> implements InspectionBusinessChannelService {
@Override
public List<InspectionBusinessChannel> getChannelTree() {
// 查询所有业务渠道父节点
return this.list();
}
}

View File

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

View File

@ -221,9 +221,9 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
// 更新或插入步骤信息
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, workNode.getProjectId()));
// 判断检测项目是否包含制证
// 判断检测项目是否包含制证 并且是合格
if (ObjectUtil.isNotEmpty(project)) {
if (project.getProjectName().contains("制证")) {
if (project.getProjectName().contains("制证") && "1".equals(inspectionWorkNode.getType())) {
flag = false;
}
}

View File

@ -68,6 +68,15 @@ public class InspectionInfoVo {
private Date validationTime;
// 核销人
private String validationRealName;
private String businessChannel; //业务渠道
//客户来源
private String customerSource;
//车辆品牌型号
private String carModel;
//检测时长
private String inspectionDuration;
//车龄
private Long carAge;
//优惠金额
private Long couponDiscount = 0L;
//实付金额
@ -101,4 +110,6 @@ public class InspectionInfoVo {
private String meetManName;
/** 是否接车*/
private String isMeetCar;
private String otherName;
private String otherPhone;
}

View File

@ -41,6 +41,12 @@ public class OrderTable {
/** 客户来源 */
private String customerSource;
/** 业务渠道 */
private String businessChannel;
/** 车辆型号 */
private String carModel;
/** 检测次数 */
private Integer inspectionCount;
}

View File

@ -163,10 +163,10 @@ public class OrderController extends BaseController {
@RequestParam(value = "pageNum" ,required = false ,defaultValue = "1") Integer pageNum,
@RequestParam(value ="pageSize" ,required = false ,defaultValue = "10") Integer pageSize) {
//判断商家是否开启评论区
ShopMallPartners partners = partnerService.getById(partnerId);
if (StringUtils.isEmpty(partners.getOpenComment())||partners.getOpenComment().equals("0")){
return success(new ArrayList<>());
}
// ShopMallPartners partners = partnerService.getById(partnerId);
// if (StringUtils.isEmpty(partners.getOpenComment())||partners.getOpenComment().equals("0")){
// return success(new ArrayList<>());
// }
Page<commentVo> page = new Page<>(pageNum, pageSize);
IPage<commentVo> commentOrderList = orderInfoService.getCommentOrderList(page,partnerId);
return success(commentOrderList);

View File

@ -15,4 +15,5 @@ public class commentVo extends TenantBaseDO {
private String realName;
private String goodsTitle;
private String userImg="http://www.nuoyunr.com/lananRsc/xlg.png";
private Long inspectionInfoId;
}

View File

@ -629,6 +629,8 @@ FROM
t.createTime,
t.customerSource,
t.carModel,
t.inspectionCount,
t.businessChannel,
CASE
WHEN t.status = '已完成' AND t.is_pass = 0 THEN '不合格'
WHEN t.status = '已完成' AND t.is_pass = 1 THEN '合格'
@ -644,7 +646,9 @@ FROM
oi.pay_time AS payTime, -- 新增字段
oi.create_time AS createTime,
ii.customer_source AS customerSource,
ii.business_channel AS businessChannel,
ii.car_model AS carModel,
IFNULL(ii.recheck_count, 0) + IFNULL(ii.reinspect_count, 0) + 1 AS inspectionCount,
CASE
WHEN oi.pay_type IS NULL THEN '未支付'
ELSE '已支付'
@ -701,6 +705,16 @@ FROM
AND (TIMESTAMPDIFF(YEAR, ii.car_register_date, CURDATE()) >= #{query.carYear}
AND TIMESTAMPDIFF(YEAR, ii.car_register_date, CURDATE()) &lt; #{query.carYear} + 1)
</if>
<if test="query.inspectionTime != null and query.inspectionTime.length == 2">
AND ii.start_time IS NOT NULL AND ii.end_time IS NOT NULL
AND TIMESTAMPDIFF(MINUTE, ii.start_time, ii.end_time)
BETWEEN #{query.inspectionTime[0]} AND #{query.inspectionTime[1]}
</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]}
</if>
</where>
AND oi.deleted = '0'
) t
@ -801,4 +815,54 @@ FROM
GROUP BY
s.sku_name
</select>
<select id="selectBusinessStatistics" resultType="java.util.Map">
SELECT
ibc.id,
ibc.name,
COUNT(ii.id) AS theNum,
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount
FROM
inspection_business_channel ibc
LEFT JOIN
inspection_info ii
ON ibc.name = ii.business_channel AND ii.deleted = '0'
<if test="startTime != null">
AND ii.create_time BETWEEN #{startTime} AND #{endTime}
</if>
LEFT JOIN
order_info oi
ON oi.id = ii.inspection_order_id AND oi.deleted = '0'
WHERE
ibc.deleted = '0'
AND ibc.type = '0'
GROUP BY
ibc.name
</select>
<select id="customerSourceCount" resultType="java.util.Map">
SELECT
ibc.id,
ibc.name,
COUNT(ii.id) AS theNum,
ROUND(IFNULL(SUM(oi.goods_price),0)/100) theAmount
FROM
inspection_business_channel ibc
LEFT JOIN
inspection_info ii
ON ibc.name = ii.customer_source AND ii.deleted = '0'
<if test="startTime != null">
AND ii.create_time BETWEEN #{startTime} AND #{endTime}
</if>
LEFT JOIN
order_info oi
ON oi.id = ii.inspection_order_id AND oi.deleted = '0'
WHERE
ibc.deleted = '0'
AND ibc.type = '1'
<if test="businessId != null">
AND ibc.pid = #{businessId}
</if>
GROUP BY
ibc.name
</select>
</mapper>

View File

@ -0,0 +1,7 @@
<?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.InspectionBusinessChannelMapper">
</mapper>

View File

@ -10,4 +10,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where record.file_id = #{id}
and record.deleted = 0
</select>
<select id="queryCount" resultType="java.lang.Long">
select count(1)
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>
</select>
</mapper>

View File

@ -231,10 +231,11 @@
</select>
<select id="getCommentOrderList" resultType = "cn.iocoder.yudao.module.payment.entity.commentVo">
SELECT
real_name,comment_desc ,comment_star,comment_time,goods_title
oi.real_name,oi.comment_desc ,oi.comment_star,oi.comment_time,oi.goods_title,info.id inspectionInfoId
FROM
order_info
where partner_id = #{partnerId} and comment_star is not null
order_info oi
LEFT JOIN inspection_info info ON oi.id = info.inspection_order_id
where comment_star is not null
ORDER BY comment_time desc
</select>
<select id="pageOrderListSystem" resultType="cn.iocoder.yudao.module.payment.entity.OrderInfo">

View File

@ -457,6 +457,45 @@ public class DataViewServiceImpl implements DataViewService {
List<DlDriveSchoolStaffVO> list = studentMapper.selectStudentListCount();
Map<String, Object> rtnMap = new HashMap<>();
rtnMap.put("all", list.size());
// courseType 分组
Map<String, List<DlDriveSchoolStaffVO>> courseTypeMap = list.stream()
.filter(item -> item.getCourseType() != null)
.collect(Collectors.groupingBy(DlDriveSchoolStaffVO::getCourseType));
// 统计各 courseType 的总人数
for (String courseType : courseTypeMap.keySet()) {
rtnMap.put(courseType, courseTypeMap.get(courseType).size());
}
// 按毕业状态分组gradTime 是否为空
Map<String, List<DlDriveSchoolStaffVO>> graduatedMap = list.stream()
.filter(item -> item.getCourseType() != null)
.collect(Collectors.groupingBy(
item -> item.getGradTime() != null ? "graduated" : "notGraduated"
));
// 统计总毕业/未毕业人数
rtnMap.put("graduated", graduatedMap.getOrDefault("graduated", Collections.emptyList()).size());
rtnMap.put("notGraduated", graduatedMap.getOrDefault("notGraduated", Collections.emptyList()).size());
// courseType + 毕业状态分组例如C1_graduated, C2_notGraduated
Map<String, Long> courseTypeGraduatedCount = list.stream()
.filter(item -> item.getCourseType() != null)
.collect(Collectors.groupingBy(
item -> item.getCourseType() + "_" + (item.getGradTime() != null ? "graduated" : "notGraduated"),
Collectors.counting()
));
// courseType + 毕业状态的统计结果放入 rtnMap
courseTypeGraduatedCount.forEach((key, count) -> rtnMap.put(key, count));
return rtnMap;
}
/*public Map<String, Object> getStudentCount() {
List<DlDriveSchoolStaffVO> list = studentMapper.selectStudentListCount();
Map<String, Object> rtnMap = new HashMap<>();
rtnMap.put("all", list.size());
//按courseType分组
Map<String, List<DlDriveSchoolStaffVO>> map = list.stream()
.filter(item -> item.getCourseType() != null) // 过滤掉 courseType null 的元素
@ -487,5 +526,5 @@ public class DataViewServiceImpl implements DataViewService {
rtnMap.put("graduated", graduatedCount);
rtnMap.put("notGraduated", notGraduatedCount);
return rtnMap;
}
}*/
}

View File

@ -64,4 +64,8 @@ public class DlDriveSchoolStaffVO {
private List<String> age;
/**拿证天数*/
private Integer passDays;
/**毕业时间*/
private Date gradTime;
/**拿证时间*/
private Date passTime;
}

View File

@ -476,7 +476,9 @@
<select id="selectStudentListCount" resultType="cn.iocoder.yudao.module.base.vo.DlDriveSchoolStaffVO">
SELECT
main.id AS id,
dsco.course_type
dsco.course_type,
dsco.grad_time,
dsco.pass_time
FROM
drive_school_student main
LEFT JOIN drive_school_course_order dsco ON main.user_id = dsco.user_id

View File

@ -58,6 +58,8 @@
<if test="entity.courseName != null and entity.courseName != '' "> and dsp.name like concat('%', #{entity.courseName}, '%')</if>
<if test="entity.userId != null "> and dsp.user_id = #{entity.userId}</if>
<if test="entity.courseId != null and entity.courseId != '' "> and dsp.course_id = #{entity.courseId}</if>
<if test="entity.subject != null "> and dsp.subject = #{entity.subject}</if>
<if test="entity.examStatus != null and entity.examStatus != '' "> and dsp.exam_status = #{entity.examStatus}</if>
<!--<if test="entity.studentIdCard != null and entity.studentIdCard != '' "> AND RIGHT(dss.id_card, 4) = RIGHT(#{entity.studentIdCard}, 4) </if>-->
<if test="entity.studentIdCard != null and entity.studentIdCard != '' ">
<choose>