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