更新
This commit is contained in:
parent
423869f6ab
commit
31b8047cff
@ -1,10 +1,13 @@
|
||||
package cn.iocoder.yudao.module.inspection.controller;
|
||||
|
||||
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.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.OrderTableQuery;
|
||||
import cn.iocoder.yudao.module.inspection.vo.*;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
|
||||
@ -771,6 +774,10 @@ public class PartnerOwnController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/queryInspectionSkuList")
|
||||
public CommonResult<?> queryInspectionSkuList(String startTime, String endTime) {
|
||||
if (StrUtil.isEmpty(startTime) || StrUtil.isEmpty(endTime)) {
|
||||
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
}
|
||||
return success(partnerList.queryInspectionSkuList(startTime, endTime));
|
||||
}
|
||||
|
||||
@ -797,13 +804,31 @@ public class PartnerOwnController extends BaseController {
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
@GetMapping("/getOrderByDate")
|
||||
public CommonResult<?> getOrderByDate(@RequestParam(value = "startTime", required = false) String startTime,
|
||||
public CommonResult<?> getOrderByDate(OrderTableQuery query,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<OrderTable> page = new Page<>(pageNum, pageSize);
|
||||
return success(partnerList.getOrderByDate(query, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据时间查订单
|
||||
*
|
||||
* @param startTime 开始时间 非必传
|
||||
* @param endTime 结束时间 非必传
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 条数
|
||||
* @author 小李
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
@GetMapping("/getOrderApp")
|
||||
public CommonResult<?> getOrderApp(@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime,
|
||||
@RequestParam(value = "chooseStatus", required = false) String chooseStatus,
|
||||
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<OrderTable> page = new Page<>(pageNum, pageSize);
|
||||
return success(partnerList.getOrderByDate(startTime, endTime, chooseStatus, page));
|
||||
return success(partnerList.getOrderApp(startTime, endTime, chooseStatus, page));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.inspection.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerWorker;
|
||||
import cn.iocoder.yudao.module.payment.entity.OrderInfo;
|
||||
@ -110,12 +111,11 @@ public interface AppInspectionPartnerMapper extends BaseMapper<ShopMallPartners>
|
||||
/**
|
||||
* 根据时间查订单
|
||||
*
|
||||
* @param startTime 开始时间 非必传
|
||||
* @param endTime 结束时间 非必传
|
||||
* @param query 查询条件
|
||||
* @author 小李
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
IPage<OrderTable> getOrderByDate(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chooseStatus") String chooseStatus, Page<OrderTable> page);
|
||||
IPage<OrderTable> getOrderByDate(@Param("query")OrderTableQuery query, Page<OrderTable> page);
|
||||
|
||||
/**
|
||||
* 分类计数
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.inspection.query;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: app订单查询
|
||||
* @Author: 86187
|
||||
* @Date: 2025/02/26 11:33
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class OrderTableQuery {
|
||||
|
||||
/** 开始时间 */
|
||||
private String startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
private String endTime;
|
||||
|
||||
/** 检测状态 */
|
||||
private String chooseStatus;
|
||||
|
||||
/** 支付方式 */
|
||||
private String payType;
|
||||
|
||||
/** 车辆型号或车龄 */
|
||||
private String carModelOrCarYear;
|
||||
|
||||
/** 客户来源 */
|
||||
private String customerSource;
|
||||
|
||||
/** 商品id */
|
||||
private Long goods;
|
||||
|
||||
/** 车龄 */
|
||||
private Integer carYear;
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerBalance;
|
||||
@ -185,7 +186,17 @@ public interface AppInspectionPartnerService extends IService<ShopMallPartners>
|
||||
* @author 小李
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
IPage<OrderTable> getOrderByDate(String startTime, String endTime, String chooseStatus, Page<OrderTable> page);
|
||||
IPage<OrderTable> getOrderByDate(OrderTableQuery query, Page<OrderTable> page);
|
||||
|
||||
/**
|
||||
* 根据时间查订单
|
||||
*
|
||||
* @param startTime 开始时间 非必传
|
||||
* @param endTime 结束时间 非必传
|
||||
* @author 小李
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
IPage<OrderTable> getOrderApp(String startTime, String endTime, String chooseStatus, Page<OrderTable> page);
|
||||
|
||||
/**
|
||||
* 分类计数
|
||||
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.config.service.IInspSysConfigService;
|
||||
import cn.iocoder.yudao.module.inspection.query.OrderTableQuery;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerBalance;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerBalanceDetail;
|
||||
@ -1954,6 +1955,28 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据时间查订单
|
||||
*
|
||||
* @param query 请求参数
|
||||
* @author 小李
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
@Override
|
||||
public IPage<OrderTable> getOrderByDate(OrderTableQuery query, Page<OrderTable> page) {
|
||||
if (StringUtils.isNotEmpty(query.getStartTime())) {
|
||||
query.setStartTime(query.getStartTime() + " 00:00:00");
|
||||
query.setEndTime(query.getEndTime() + " 23:59:59");
|
||||
}
|
||||
IPage<OrderTable> orderByDate = baseMapper.getOrderByDate(query, page);
|
||||
orderByDate.getRecords().forEach(orderTable -> {
|
||||
if (StringUtils.isNotEmpty(orderTable.getCarModel())) {
|
||||
orderTable.setCarModel(orderTable.getCarModel().replaceAll("牌.*", ""));
|
||||
}
|
||||
});
|
||||
return orderByDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据时间查订单
|
||||
*
|
||||
@ -1963,14 +1986,14 @@ public class AppInspectionPartnerServiceImpl extends ServiceImpl<AppInspectionPa
|
||||
* @date 14:39 2024/12/12
|
||||
**/
|
||||
@Override
|
||||
public IPage<OrderTable> getOrderByDate(String startTime, String endTime, String chooseStatus, Page<OrderTable> page) {
|
||||
public IPage<OrderTable> getOrderApp(String startTime, String endTime, String chooseStatus, Page<OrderTable> page) {
|
||||
if (StringUtils.isEmpty(startTime)) {
|
||||
startTime = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
endTime = DateUtil.format(new Date(), "yyyy-MM-dd");
|
||||
}
|
||||
startTime = startTime + " 00:00:00";
|
||||
endTime = endTime + " 23:59:59";
|
||||
return baseMapper.getOrderByDate(startTime, endTime, chooseStatus, page);
|
||||
return baseMapper.getOrderByDate(null, page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo;
|
||||
import cn.iocoder.yudao.module.inspection.vo.StaffImportExcelVO;
|
||||
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;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
@ -130,6 +131,9 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
@Override
|
||||
public InspectionStaffSaveVo get(Long id) {
|
||||
InspectionStaffSaveVo inspectionStaffSaveVo = baseMapper.get(id);
|
||||
// 查询用户角色集合
|
||||
List<UserRoleDTO> userRoleDTOS = permissionService.userRoleDTOList(Collections.singletonList(id));
|
||||
inspectionStaffSaveVo.setRoleIds(userRoleDTOS.stream().map(UserRoleDTO::getRoleId).collect(Collectors.toList()));
|
||||
//将驾驶证类型转为数组
|
||||
if (ObjectUtil.isNotEmpty(inspectionStaffSaveVo.getDriverLicenseType())) {
|
||||
inspectionStaffSaveVo.setDriverLicenseTypeArr(Arrays.asList(inspectionStaffSaveVo.getDriverLicenseType().split(",")));
|
||||
@ -246,21 +250,19 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
*/
|
||||
private int saveImportStaff(List<StaffImportExcelVO> successList) {
|
||||
//将员工插入主表
|
||||
List<AdminUserDO> userDTOList = new ArrayList<>();
|
||||
Map<String, Long> users = new HashMap<>();
|
||||
for (StaffImportExcelVO staffImportExcelVO : successList) {
|
||||
AdminUserDO userDTO = new AdminUserDO();
|
||||
userDTO.setUsername(staffImportExcelVO.getUsername());
|
||||
userDTO.setNickname(staffImportExcelVO.getUsername());
|
||||
userDTO.setMobile(staffImportExcelVO.getMobile());
|
||||
userDTO.setPassword("123456");
|
||||
userDTO.setUserType(USER_TYPE_STAFF);
|
||||
|
||||
userDTOList.add(userDTO);
|
||||
UserSaveReqVO createReqVO = new UserSaveReqVO();
|
||||
createReqVO.setUsername(staffImportExcelVO.getMobile());
|
||||
createReqVO.setMobile(staffImportExcelVO.getMobile());
|
||||
createReqVO.setNickname(staffImportExcelVO.getUsername());
|
||||
createReqVO.setPassword("123456");
|
||||
|
||||
Long userId = userService.createUser(createReqVO);
|
||||
users.put(staffImportExcelVO.getMobile(), userId);
|
||||
}
|
||||
userService.saveBatch(userDTOList);
|
||||
|
||||
Map<String, Long> users = userDTOList.stream().collect(Collectors.toMap(AdminUserDO::getMobile, AdminUserDO::getId));
|
||||
|
||||
|
||||
//插入检测员工子表
|
||||
List<InspectionStaff> inspectionStaffList = new ArrayList<>();
|
||||
|
@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionStaff;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@ -103,4 +104,9 @@ public class InspectionStaffSaveVo extends InspectionStaff {
|
||||
* 文件集合
|
||||
*/
|
||||
private List<FileDO> fileList;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
private List<Long> roleIds;
|
||||
}
|
||||
|
@ -31,4 +31,16 @@ public class OrderTable {
|
||||
|
||||
/** 支付方式 */
|
||||
private String payType;
|
||||
|
||||
/** 支付时间 */
|
||||
private String payTime;
|
||||
|
||||
/** 创建时间 */
|
||||
private String createTime;
|
||||
|
||||
/** 客户来源 */
|
||||
private String customerSource;
|
||||
|
||||
/** 车辆型号 */
|
||||
private String carModel;
|
||||
}
|
||||
|
@ -121,26 +121,60 @@
|
||||
</select>
|
||||
<select id="getStaffCount" resultType="java.util.Map"
|
||||
parameterType="cn.iocoder.yudao.module.inspection.entity.DlInspectionProject">
|
||||
SELECT iwn.deal_user_id, -- 处理人员ID
|
||||
su.nickname, -- 处理人员名称
|
||||
COUNT(iwn.deal_user_id) AS orderCount, -- 统计每个员工接单的数量
|
||||
SUM(IFNULL(royalty.royalty_amount, 0) / 100) AS royaltyAmount -- 计算每个员工的总佣金
|
||||
FROM inspection_work_node iwn
|
||||
LEFT JOIN inspection_project AS proj -- Assuming this is the table for project details
|
||||
ON iwn.project_id = proj.id
|
||||
LEFT JOIN system_users su ON su.id = iwn.deal_user_id
|
||||
LEFT JOIN inspection_info AS info ON iwn.inspection_info_id = info.id
|
||||
LEFT JOIN order_info orders ON info.inspection_order_id = orders.id
|
||||
LEFT JOIN inspection_project_royalty AS royalty ON iwn.project_id = royalty.project_id
|
||||
AND orders.goods_id = royalty.goods_id
|
||||
SELECT
|
||||
iwn.deal_user_id, -- 处理人员ID
|
||||
su.nickname, -- 处理人员名称
|
||||
su.avatar, -- 处理人员头像
|
||||
COUNT(DISTINCT iwn.id) AS orderCount, -- 统计每个员工的唯一订单数量
|
||||
SUM(IFNULL(royalty.royalty_amount, 0) / 100) AS royaltyAmount, -- 计算每个员工的总佣金
|
||||
su.mobile, -- 处理人员手机号
|
||||
COALESCE(waijianCount, 0) AS waijianCount, -- 包含“外检”的订单数量
|
||||
COALESCE(anjianCount, 0) AS anjianCount, -- 包含“安检”的订单数量
|
||||
COALESCE(proj_stats.otherCount, 0) AS otherCount -- 其他订单数量(排除“外检”和“安检”)
|
||||
FROM
|
||||
inspection_work_node iwn
|
||||
LEFT JOIN system_users su ON su.id = iwn.deal_user_id -- 处理人员信息
|
||||
LEFT JOIN inspection_info AS info ON iwn.inspection_info_id = info.id
|
||||
LEFT JOIN order_info orders ON info.inspection_order_id = orders.id
|
||||
LEFT JOIN inspection_project_royalty AS royalty
|
||||
ON iwn.project_id = royalty.project_id
|
||||
AND orders.goods_id = royalty.goods_id
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
iwn.deal_user_id,
|
||||
SUM(CASE WHEN proj.project_name LIKE '%外检%' THEN 1 ELSE 0 END) AS waijianCount,
|
||||
SUM(CASE WHEN proj.project_name LIKE '%安检%' THEN 1 ELSE 0 END) AS anjianCount,
|
||||
SUM(
|
||||
CASE
|
||||
WHEN proj.project_name NOT LIKE '%外检%'
|
||||
AND proj.project_name NOT LIKE '%安检%'
|
||||
THEN 1 ELSE 0
|
||||
END
|
||||
) AS otherCount -- 统计不包含“外检”和“安检”的订单
|
||||
FROM
|
||||
inspection_work_node iwn
|
||||
LEFT JOIN inspection_project AS proj ON iwn.project_id = proj.id
|
||||
LEFT JOIN inspection_info AS info ON iwn.inspection_info_id = info.id
|
||||
WHERE iwn.deleted = 0 -- 排除已删除的数据
|
||||
AND iwn.deal_user_id IS NOT NULL -- 排除 deal_user_id 为 NULL 的记录
|
||||
AND iwn.status = 2
|
||||
AND info.status = 1
|
||||
GROUP BY
|
||||
iwn.deal_user_id
|
||||
) proj_stats ON iwn.deal_user_id = proj_stats.deal_user_id -- 获取“外检”和“安检”的统计
|
||||
<where>
|
||||
iwn.deleted = 0 -- 排除已删除的数据
|
||||
AND iwn.deal_user_id IS NOT NULL -- 排除 deal_user_id 为 NULL 的记录
|
||||
AND iwn.status = 2
|
||||
AND info.status = 1
|
||||
<if test="id != null and id != ''">
|
||||
AND iwn.project_id = #{id} -- 只在这里加上id过滤
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
iwn.deal_user_id -- 根据处理人员ID进行分组
|
||||
ORDER BY
|
||||
orderCount DESC; -- 根据接单数量进行降序排序
|
||||
|
||||
WHERE iwn.deleted = 0 -- 排除已删除的数据
|
||||
AND iwn.deal_user_id IS NOT NULL -- 排除 deal_user_id 为 NULL 的记录
|
||||
AND iwn.`status` = 2
|
||||
AND info.`status` = 1
|
||||
|
||||
GROUP BY iwn.deal_user_id -- 根据处理人员ID和名称进行分组
|
||||
|
||||
ORDER BY orderCount DESC; -- 根据接单数量进行降序排序
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -537,62 +537,92 @@ FROM
|
||||
|
||||
<select id="getOrderByDate" resultType="cn.iocoder.yudao.module.inspection.vo.OrderTable">
|
||||
SELECT t.id,
|
||||
t.carNum,
|
||||
t.type,
|
||||
t.pay,
|
||||
t.payType,
|
||||
CASE
|
||||
WHEN t.status = '已完成' AND t.is_pass = 0 THEN '不合格'
|
||||
WHEN t.status = '已完成' AND t.is_pass = 1 THEN '合格'
|
||||
WHEN t.status = '已完成' THEN '未知'
|
||||
ELSE ''
|
||||
END AS result,
|
||||
t.status
|
||||
FROM (SELECT ii.id,
|
||||
ii.car_num AS carNum,
|
||||
oi.sku_name AS type,
|
||||
oi.pay_type as payType,
|
||||
CASE
|
||||
WHEN oi.pay_type IS NULL THEN '未支付'
|
||||
ELSE '已支付'
|
||||
END AS pay,
|
||||
CASE
|
||||
WHEN oi.pay_type IS NOT NULL THEN '已完成'
|
||||
WHEN has_status_0_or_null THEN '检测中'
|
||||
WHEN (ii.status = 0 OR ii.status = 2) AND has_status_1 THEN '检测中'
|
||||
WHEN (COALESCE(max_iwn_status, 0) = 2 OR ii.status = 1) THEN '已完成'
|
||||
WHEN (ii.status = 0 OR ii.status = 2) AND COALESCE(max_iwn_status, 0) = 0 THEN '待检测'
|
||||
ELSE '未知状态' -- 这是为了处理任何未预期的情况
|
||||
END AS status,
|
||||
ii.is_pass,
|
||||
COALESCE(max_iwn_status, 0) AS max_iwn_status,
|
||||
oi.create_time
|
||||
FROM order_info oi
|
||||
INNER JOIN
|
||||
inspection_info ii
|
||||
ON
|
||||
oi.id = ii.inspection_order_id
|
||||
LEFT JOIN (SELECT inspection_info_id,
|
||||
MAX(COALESCE(status, 0)) AS max_iwn_status,
|
||||
MAX(CASE WHEN COALESCE(status, 0) = 1 THEN 1 ELSE 0 END) AS has_status_1,
|
||||
MAX(CASE WHEN COALESCE(status, 0) = 0 THEN 1 ELSE 0 END) AS has_status_0_or_null
|
||||
FROM inspection_work_node
|
||||
GROUP BY inspection_info_id) iwn_agg
|
||||
ON
|
||||
ii.id = iwn_agg.inspection_info_id
|
||||
WHERE oi.create_time BETWEEN #{startTime} AND #{endTime}
|
||||
AND oi.deleted = '0') t
|
||||
t.carNum,
|
||||
t.type,
|
||||
t.pay,
|
||||
t.payType,
|
||||
t.payTime, -- 新增字段
|
||||
t.createTime,
|
||||
t.customerSource,
|
||||
t.carModel,
|
||||
CASE
|
||||
WHEN t.status = '已完成' AND t.is_pass = 0 THEN '不合格'
|
||||
WHEN t.status = '已完成' AND t.is_pass = 1 THEN '合格'
|
||||
WHEN t.status = '已完成' THEN '未知'
|
||||
ELSE ''
|
||||
END AS result,
|
||||
t.status
|
||||
FROM (
|
||||
SELECT ii.id,
|
||||
ii.car_num AS carNum,
|
||||
oi.sku_name AS type,
|
||||
oi.pay_type AS payType,
|
||||
oi.pay_time AS payTime, -- 新增字段
|
||||
oi.create_time AS createTime,
|
||||
ii.customer_source AS customerSource,
|
||||
ii.car_model AS carModel,
|
||||
CASE
|
||||
WHEN oi.pay_type IS NULL THEN '未支付'
|
||||
ELSE '已支付'
|
||||
END AS pay,
|
||||
CASE
|
||||
WHEN oi.pay_type IS NOT NULL THEN '已完成'
|
||||
WHEN has_status_0_or_null THEN '检测中'
|
||||
WHEN (ii.status = 0 OR ii.status = 2) AND has_status_1 THEN '检测中'
|
||||
WHEN (COALESCE(max_iwn_status, 0) = 2 OR ii.status = 1) THEN '已完成'
|
||||
WHEN (ii.status = 0 OR ii.status = 2) AND COALESCE(max_iwn_status, 0) = 0 THEN '待检测'
|
||||
ELSE '未知状态'
|
||||
END AS status,
|
||||
ii.is_pass,
|
||||
COALESCE(max_iwn_status, 0) AS max_iwn_status,
|
||||
oi.create_time
|
||||
FROM order_info oi
|
||||
INNER JOIN inspection_info ii
|
||||
ON oi.id = ii.inspection_order_id
|
||||
LEFT JOIN (
|
||||
SELECT inspection_info_id,
|
||||
MAX(COALESCE(status, 0)) AS max_iwn_status,
|
||||
MAX(CASE WHEN COALESCE(status, 0) = 1 THEN 1 ELSE 0 END) AS has_status_1,
|
||||
MAX(CASE WHEN COALESCE(status, 0) = 0 THEN 1 ELSE 0 END) AS has_status_0_or_null
|
||||
FROM inspection_work_node
|
||||
GROUP BY inspection_info_id
|
||||
) iwn_agg
|
||||
ON ii.id = iwn_agg.inspection_info_id
|
||||
<where>
|
||||
<if test="query.payType!=null and query.payType!=''">
|
||||
AND oi.pay_type = #{query.payType}
|
||||
</if>
|
||||
<if test="query.customerSource!=null and query.customerSource!=''">
|
||||
AND ii.customer_source = #{query.customerSource}
|
||||
</if>
|
||||
<if test="query.carModelOrCarYear!=null and query.carModelOrCarYear!=''">
|
||||
AND ( ii.car_model LIKE concat('%',#{query.carModelOrCarYear},'%')
|
||||
OR ii.car_num LIKE concat('%',#{query.carModelOrCarYear},'%') )
|
||||
</if>
|
||||
<if test="query.startTime!=null and query.startTime!=''">
|
||||
AND oi.create_time BETWEEN #{query.startTime} AND #{query.endTime}
|
||||
</if>
|
||||
<if test="query.goods!=null and query.goods!=''">
|
||||
AND oi.goods_id = #{query.goods}
|
||||
</if>
|
||||
<if test="query.carYear!=null and query.carYear!=''">
|
||||
AND (TIMESTAMPDIFF(YEAR, ii.car_register_date, CURDATE()) >= #{query.carYear}
|
||||
AND TIMESTAMPDIFF(YEAR, ii.car_register_date, CURDATE()) < #{query.carYear} + 1)
|
||||
</if>
|
||||
</where>
|
||||
AND oi.deleted = '0'
|
||||
) t
|
||||
<where>
|
||||
<choose>
|
||||
<when test="chooseStatus == '2'.toString()">
|
||||
<when test="query.chooseStatus == '2'.toString()">
|
||||
t.status = '检测中'
|
||||
</when>
|
||||
<when test="chooseStatus == '3'.toString()">
|
||||
<when test="query.chooseStatus == '3'.toString()">
|
||||
t.status = '已完成'
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY t.create_time DESC
|
||||
ORDER BY t.create_time DESC;
|
||||
</select>
|
||||
|
||||
<select id="getTypeCount" resultType="java.util.Map">
|
||||
|
@ -6,4 +6,5 @@ import lombok.Data;
|
||||
public class UserRoleDTO {
|
||||
private Long userId;
|
||||
private String roleCode;
|
||||
private Long roleId;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
<select id="userCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO">
|
||||
SELECT
|
||||
su.id AS userId,sr.code AS roleCode
|
||||
su.id AS userId,sr.code AS roleCode,sr.id AS roleId
|
||||
FROM
|
||||
system_users su
|
||||
LEFT JOIN system_user_role sur ON su.id = sur.user_id AND sur.deleted = 0
|
||||
|
Loading…
Reference in New Issue
Block a user