更新0826
This commit is contained in:
parent
6e3997af97
commit
8691f9e94a
@ -2,11 +2,15 @@ package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -136,4 +140,19 @@ public class RepairStatisticsController {
|
||||
return CommonResult.success(statisticsService.listWorks());
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* @Author 许
|
||||
* @Description 统计最近业务(车辆或客户)
|
||||
* @Date 11:16 2025/8/22
|
||||
* @Param [reqVO]
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/listBusiness")
|
||||
public CommonResult<?> listBusinessByCustomerOrCar(QueryBusinessReqVO reqVO,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<QueryBusinessResp> page = new Page<>(pageNo, pageSize);
|
||||
return CommonResult.success(statisticsService.listBusinessByCustomerOrCar(reqVO,page));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,10 @@ package cn.iocoder.yudao.module.base.entity;
|
||||
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -65,9 +68,11 @@ public class RepairStaff {
|
||||
/** 家庭住址 */
|
||||
private String address;
|
||||
|
||||
private String IdNumber;
|
||||
private String idNumber;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date safeDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date formalDate;
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -96,4 +101,21 @@ public interface RepairStatisticsMapper {
|
||||
**/
|
||||
List<RepairStatisticsVO> listWorks();
|
||||
|
||||
/**
|
||||
* @Author 许
|
||||
* @Description 统计最近业务
|
||||
* @Date 11:24 2025/8/22
|
||||
* @Param [reqVO]
|
||||
* @return java.util.List
|
||||
**/
|
||||
IPage<QueryBusinessResp> listBusinessByCustomer(@Param("reqVO") QueryBusinessReqVO reqVO,@Param("page") Page<QueryBusinessResp> page);
|
||||
|
||||
/**
|
||||
* @Author 许
|
||||
* @Description 统计最近业务
|
||||
* @Date 11:24 2025/8/22
|
||||
* @Param [reqVO]
|
||||
* @return java.util.List
|
||||
**/
|
||||
IPage<QueryBusinessResp> listBusinessByCar(@Param("reqVO") QueryBusinessReqVO reqVO,@Param("page") Page<QueryBusinessResp> page);
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -82,4 +86,12 @@ public interface RepairStatisticsService {
|
||||
List<RepairStatisticsVO> listWorks();
|
||||
|
||||
|
||||
/**
|
||||
* @Author 许
|
||||
* @Description 统计最近业务(车辆或客户)
|
||||
* @Date 15:04 2025/8/25
|
||||
* @Param [reqVO, page]
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryBusinessResp>
|
||||
**/
|
||||
IPage<QueryBusinessResp> listBusinessByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryBusinessResp> page);
|
||||
}
|
||||
|
@ -2,13 +2,18 @@ package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper;
|
||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO;
|
||||
import cn.iocoder.yudao.module.base.vo.QueryBusinessResp;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -128,4 +133,22 @@ public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
||||
public List<RepairStatisticsVO> listWorks() {
|
||||
return statisticsMapper.listWorks();
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author 许
|
||||
* @Description 统计最近业务(车辆或客户)
|
||||
* @Date 15:03 2025/8/25
|
||||
* @Param [reqVO, page]
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.QueryBusinessResp>
|
||||
**/
|
||||
@Override
|
||||
public IPage<QueryBusinessResp> listBusinessByCustomerOrCar(QueryBusinessReqVO reqVO, Page<QueryBusinessResp> page) {
|
||||
IPage<QueryBusinessResp> queryBusinessResps = null;
|
||||
if ("customer".equals(reqVO.getType())) {
|
||||
queryBusinessResps = statisticsMapper.listBusinessByCustomer(reqVO,page);
|
||||
}else if ("car".equals(reqVO.getType())) {
|
||||
queryBusinessResps = statisticsMapper.listBusinessByCar(reqVO,page);
|
||||
}
|
||||
return queryBusinessResps;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*@BelongsProject: lanan-system
|
||||
*@BelongsPackage: cn.iocoder.yudao.module.base.vo
|
||||
*@Author: 许
|
||||
*@CreateTime: 2025-08-22 11:14
|
||||
*@Description: 业务统计请求参数
|
||||
*@Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class QueryBusinessReqVO {
|
||||
|
||||
/**
|
||||
* 时间范围
|
||||
*/
|
||||
private String[] dateRange;
|
||||
|
||||
/**
|
||||
* 类型 car: 车辆 customer: 客户
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
private String search;
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*@BelongsProject: lanan-system
|
||||
*@BelongsPackage: cn.iocoder.yudao.module.base.vo
|
||||
*@Author: 许
|
||||
*@CreateTime: 2025-08-22 14:04
|
||||
*@Description: TODO
|
||||
*@Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class QueryBusinessResp {
|
||||
/**
|
||||
* 客户id
|
||||
*/
|
||||
private String customerId;
|
||||
|
||||
/**
|
||||
* 客户名称
|
||||
*/
|
||||
private String customerName;
|
||||
|
||||
/**
|
||||
* 客户手机号
|
||||
*/
|
||||
private String customerPhone;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String bizId;
|
||||
|
||||
/**
|
||||
* 业务编号
|
||||
*/
|
||||
private String bizNo;
|
||||
|
||||
/**
|
||||
* 业务时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date bizTime;
|
||||
|
||||
/**
|
||||
* 业务来源
|
||||
*/
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String carNum;
|
||||
}
|
@ -266,4 +266,6 @@ public class DlRepairTickets extends TenantBaseDO {
|
||||
private String settlementStr;
|
||||
@TableField(exist = false)
|
||||
private TicketsSettlementVO settlement;
|
||||
@TableField(exist = false)
|
||||
private boolean ifShow = false;
|
||||
}
|
||||
|
@ -579,118 +579,123 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
Map<String, String> typeMap = recordTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
|
||||
result.setRecords(records.stream().peek(item -> item.setType(typeMap.get(item.getType()))).collect(Collectors.toList()));
|
||||
|
||||
//查询维修工人表
|
||||
List<RepairWorker> workers = repairWorkerService.listByTicketId(id);
|
||||
//转成map
|
||||
Map<Long, RepairWorker> workerMap = workers.stream().collect(Collectors.toMap(RepairWorker::getUserId, item -> item));
|
||||
|
||||
if (!ifApp) {
|
||||
//查询维修工人表
|
||||
List<RepairWorker> workers = repairWorkerService.listByTicketId(id);
|
||||
//转成map
|
||||
Map<Long, RepairWorker> workerMap = workers.stream().collect(Collectors.toMap(RepairWorker::getUserId, item -> item));
|
||||
|
||||
|
||||
//配件总利润
|
||||
BigDecimal waresProfit = BigDecimal.ZERO;
|
||||
List<JobTypeProfitDTO> resultList = new ArrayList<>();
|
||||
//配件总利润
|
||||
BigDecimal waresProfit = BigDecimal.ZERO;
|
||||
List<JobTypeProfitDTO> resultList = new ArrayList<>();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(items)) {
|
||||
for (DlRepairTitemReqVO item : items) {
|
||||
BigDecimal itemProfit = item.getItemProfit() != null ? item.getItemProfit() : BigDecimal.ZERO;
|
||||
waresProfit = waresProfit.add(itemProfit);
|
||||
BigDecimal itemMoney = item.getItemMoney() != null ? item.getItemMoney() : BigDecimal.ZERO;
|
||||
// 成本 = 售价 - 利润(也可以直接从 item.getItemCost() 取,如果有字段)
|
||||
BigDecimal itemCost = itemMoney.subtract(itemProfit);
|
||||
if (CollectionUtil.isNotEmpty(items)) {
|
||||
for (DlRepairTitemReqVO item : items) {
|
||||
BigDecimal itemProfit = item.getItemProfit() != null ? item.getItemProfit() : BigDecimal.ZERO;
|
||||
waresProfit = waresProfit.add(itemProfit);
|
||||
BigDecimal itemMoney = item.getItemMoney() != null ? item.getItemMoney() : BigDecimal.ZERO;
|
||||
// 成本 = 售价 - 利润(也可以直接从 item.getItemCost() 取,如果有字段)
|
||||
BigDecimal itemCost = itemMoney.subtract(itemProfit);
|
||||
|
||||
if (StringUtils.isNotEmpty(item.getRepairIds())) {
|
||||
if (StringUtils.isNotEmpty(item.getRepairIds())) {
|
||||
String[] repairIdArr = item.getRepairIds().split(",");
|
||||
for (String repairIdStr : repairIdArr) {
|
||||
if (StringUtils.isNotEmpty(repairIdStr)) {
|
||||
RepairWorker repairWorker = workerMap.get(Long.valueOf(repairIdStr));
|
||||
if (repairWorker != null) {
|
||||
String jobType = repairWorker.getWorkType();
|
||||
if (StringUtils.isNotEmpty(item.getRepairIds())) {
|
||||
String[] repairIdArr = item.getRepairIds().split(",");
|
||||
for (String repairIdStr : repairIdArr) {
|
||||
if (StringUtils.isNotEmpty(repairIdStr)) {
|
||||
RepairWorker repairWorker = workerMap.get(Long.valueOf(repairIdStr));
|
||||
if (repairWorker != null) {
|
||||
String jobType = repairWorker.getWorkType();
|
||||
if (jobType == null) {
|
||||
}
|
||||
|
||||
JobTypeProfitDTO dto = resultList.stream()
|
||||
.filter(r -> r.getJobTypeCode().equals(jobType))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
JobTypeProfitDTO newDto = new JobTypeProfitDTO();
|
||||
newDto.setJobTypeCode(jobType);
|
||||
newDto.setJobTypeName(dictDataApi.getDictDataLabel(REPAIR_WORK_TYPE, jobType));
|
||||
newDto.setProfit(BigDecimal.ZERO);
|
||||
newDto.setMoney(BigDecimal.ZERO);
|
||||
newDto.setWorkMoney(BigDecimal.ZERO);
|
||||
newDto.setCost(BigDecimal.ZERO); // 新增成本字段
|
||||
resultList.add(newDto);
|
||||
return newDto;
|
||||
});
|
||||
JobTypeProfitDTO dto = resultList.stream()
|
||||
.filter(r -> r.getJobTypeCode().equals(jobType))
|
||||
.findFirst()
|
||||
.orElseGet(() -> {
|
||||
JobTypeProfitDTO newDto = new JobTypeProfitDTO();
|
||||
newDto.setJobTypeCode(jobType);
|
||||
newDto.setJobTypeName(dictDataApi.getDictDataLabel(REPAIR_WORK_TYPE, jobType));
|
||||
newDto.setProfit(BigDecimal.ZERO);
|
||||
newDto.setMoney(BigDecimal.ZERO);
|
||||
newDto.setWorkMoney(BigDecimal.ZERO);
|
||||
newDto.setCost(BigDecimal.ZERO); // 新增成本字段
|
||||
resultList.add(newDto);
|
||||
return newDto;
|
||||
});
|
||||
|
||||
if ("02".equals(item.getItemType())) { // 配件
|
||||
// 多人平摊利润/金额/成本
|
||||
int numWorkers = repairIdArr.length;
|
||||
BigDecimal profitPerWorker = itemProfit.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal moneyPerWorker = itemMoney.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal costPerWorker = itemCost.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
if ("02".equals(item.getItemType())) { // 配件
|
||||
// 多人平摊利润/金额/成本
|
||||
int numWorkers = repairIdArr.length;
|
||||
BigDecimal profitPerWorker = itemProfit.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal moneyPerWorker = itemMoney.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
BigDecimal costPerWorker = itemCost.divide(BigDecimal.valueOf(numWorkers), 4, RoundingMode.HALF_UP);
|
||||
|
||||
dto.setProfit(dto.getProfit().add(profitPerWorker));
|
||||
dto.setMoney(dto.getMoney().add(moneyPerWorker));
|
||||
dto.setCost(dto.getCost().add(costPerWorker));
|
||||
} else if ("01".equals(item.getItemType())) { // 工时
|
||||
dto.setWorkMoney(dto.getWorkMoney().add(itemMoney));
|
||||
dto.setProfit(dto.getProfit().add(profitPerWorker));
|
||||
dto.setMoney(dto.getMoney().add(moneyPerWorker));
|
||||
dto.setCost(dto.getCost().add(costPerWorker));
|
||||
} else if ("01".equals(item.getItemType())) { // 工时
|
||||
dto.setWorkMoney(dto.getWorkMoney().add(itemMoney));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ====== 计算分组毛利率 ======
|
||||
for (JobTypeProfitDTO dto : resultList) {
|
||||
BigDecimal partsProfit = dto.getProfit(); // 配件利润
|
||||
BigDecimal partsMoney = dto.getMoney(); // 配件售价
|
||||
BigDecimal workMoney = dto.getWorkMoney(); // 工时售价
|
||||
|
||||
// 不含工时
|
||||
BigDecimal profitRateWithoutWork = BigDecimal.ZERO;
|
||||
if (partsMoney.compareTo(BigDecimal.ZERO) > 0) {
|
||||
profitRateWithoutWork = partsProfit.divide(partsMoney, 4, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
// 含工时
|
||||
BigDecimal profitRateWithWork = BigDecimal.ZERO;
|
||||
BigDecimal totalMoney = partsMoney.add(workMoney);
|
||||
if (totalMoney.compareTo(BigDecimal.ZERO) > 0) {
|
||||
profitRateWithWork = partsProfit.divide(totalMoney, 4, RoundingMode.HALF_UP);
|
||||
// ====== 计算分组毛利率 ======
|
||||
for (JobTypeProfitDTO dto : resultList) {
|
||||
BigDecimal partsProfit = dto.getProfit(); // 配件利润
|
||||
BigDecimal partsMoney = dto.getMoney(); // 配件售价
|
||||
BigDecimal workMoney = dto.getWorkMoney(); // 工时售价
|
||||
|
||||
// 不含工时
|
||||
BigDecimal profitRateWithoutWork = BigDecimal.ZERO;
|
||||
if (partsMoney.compareTo(BigDecimal.ZERO) > 0) {
|
||||
profitRateWithoutWork = partsProfit.divide(partsMoney, 4, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
// 含工时
|
||||
BigDecimal profitRateWithWork = BigDecimal.ZERO;
|
||||
BigDecimal totalMoney = partsMoney.add(workMoney);
|
||||
if (totalMoney.compareTo(BigDecimal.ZERO) > 0) {
|
||||
profitRateWithWork = partsProfit.divide(totalMoney, 4, RoundingMode.HALF_UP);
|
||||
}
|
||||
|
||||
dto.setProfitRateWithoutWork(profitRateWithoutWork);
|
||||
dto.setProfitRateWithWork(profitRateWithWork);
|
||||
}
|
||||
|
||||
dto.setProfitRateWithoutWork(profitRateWithoutWork);
|
||||
dto.setProfitRateWithWork(profitRateWithWork);
|
||||
}
|
||||
|
||||
// 最终返回 list
|
||||
result.setGroupByJobType(resultList);
|
||||
|
||||
|
||||
// 最终返回 list
|
||||
result.setGroupByJobType(resultList);
|
||||
//计算含工时项目毛利率
|
||||
//配件总利润除以工单总价
|
||||
BigDecimal profitRate = new BigDecimal(0);
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getTotalPrice())) {
|
||||
if (dlRepairTickets.getTotalPrice().compareTo(BigDecimal.ZERO) != 0) {
|
||||
profitRate = waresProfit.divide(dlRepairTickets.getTotalPrice(), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
result.setProfitRate(profitRate);
|
||||
|
||||
|
||||
//计算含工时项目毛利率
|
||||
//配件总利润除以工单总价
|
||||
BigDecimal profitRate = new BigDecimal(0);
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getTotalPrice())) {
|
||||
if (dlRepairTickets.getTotalPrice().compareTo(BigDecimal.ZERO) != 0) {
|
||||
profitRate = waresProfit.divide(dlRepairTickets.getTotalPrice(), 2, RoundingMode.HALF_UP);
|
||||
// 工单成本 售价 - 利润
|
||||
result.setCost(dlRepairTickets.getTotalPrice().subtract(waresProfit));
|
||||
}
|
||||
result.setProfitRate(profitRate);
|
||||
|
||||
// 工单成本 售价 - 利润
|
||||
result.setCost(dlRepairTickets.getTotalPrice().subtract(waresProfit));
|
||||
}
|
||||
//计算不含工时项目毛利率
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getPartPrice())) {
|
||||
BigDecimal profitRateNo = new BigDecimal(0);
|
||||
if (dlRepairTickets.getPartPrice().compareTo(BigDecimal.ZERO) != 0) {
|
||||
profitRateNo = waresProfit.divide(dlRepairTickets.getPartPrice(), 2, RoundingMode.HALF_UP);
|
||||
//计算不含工时项目毛利率
|
||||
if (ObjectUtil.isNotEmpty(dlRepairTickets.getPartPrice())) {
|
||||
BigDecimal profitRateNo = new BigDecimal(0);
|
||||
if (dlRepairTickets.getPartPrice().compareTo(BigDecimal.ZERO) != 0) {
|
||||
profitRateNo = waresProfit.divide(dlRepairTickets.getPartPrice(), 2, RoundingMode.HALF_UP);
|
||||
}
|
||||
result.setProfitRateNo(profitRateNo);
|
||||
}
|
||||
result.setProfitRateNo(profitRateNo);
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,4 +123,113 @@
|
||||
GROUP BY drw.user_id,drr.ticket_id
|
||||
ORDER BY value DESC
|
||||
</select>
|
||||
<select id="listBusinessByCustomer" resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
|
||||
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
|
||||
SELECT t.*
|
||||
FROM (
|
||||
SELECT
|
||||
c.id AS customerId,
|
||||
c.cus_name AS customerName,
|
||||
c.phone_number AS customerPhone,
|
||||
r.id AS bizId,
|
||||
r.ticket_no AS bizNo,
|
||||
r.repair_type AS bizType,
|
||||
r.in_time AS bizTime,
|
||||
'repair' AS source,
|
||||
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY r.in_time DESC) AS rn
|
||||
FROM base_customer_main c
|
||||
JOIN dl_repair_tickets r ON c.id = r.user_id
|
||||
WHERE
|
||||
1 = 1 and c.deleted = 0
|
||||
<if test="reqVO.dateRange != null">
|
||||
AND r.in_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
||||
</if>
|
||||
<if test="reqVO.search != null and reqVO.search != ''">
|
||||
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
OR c.phone_number LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
OR r.ticket_no LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
)
|
||||
</if>
|
||||
<!--
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
c.id AS customerId,
|
||||
c.cus_name AS customerName,
|
||||
c.phone_number AS customerPhone,
|
||||
ri.id AS bizId,
|
||||
NULL AS bizNo,
|
||||
ri.rescue_type AS bizType,
|
||||
ri.rescue_time AS bizTime,
|
||||
'rescue' AS source,
|
||||
ROW_NUMBER() OVER (PARTITION BY c.id ORDER BY ri.rescue_time DESC) AS rn
|
||||
FROM base_customer_main c
|
||||
JOIN rescue_info ri ON c.user_id = ri.user_id
|
||||
WHERE
|
||||
1 = 1 and c.deleted = 0
|
||||
<if test="reqVO.dateRange != null">
|
||||
AND ri.rescue_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
||||
</if>
|
||||
<if test="reqVO.search != null and reqVO.search != ''">
|
||||
AND (c.cus_name LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
OR c.phone_number LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
)
|
||||
</if>-->
|
||||
) t
|
||||
WHERE t.rn = 1;
|
||||
</select>
|
||||
<select id="listBusinessByCar" resultType="cn.iocoder.yudao.module.base.vo.QueryBusinessResp"
|
||||
parameterType="cn.iocoder.yudao.module.base.vo.QueryBusinessReqVO">
|
||||
SELECT t.*
|
||||
FROM (
|
||||
-- 维修工单
|
||||
SELECT
|
||||
car.id AS carId,
|
||||
car.license_number carNum,
|
||||
c.id AS customerId,
|
||||
c.cus_name AS customerName,
|
||||
c.phone_number AS customerPhone,
|
||||
r.id AS bizId,
|
||||
r.ticket_no AS bizNo,
|
||||
r.repair_type AS bizType,
|
||||
r.create_time AS bizTime,
|
||||
'repair' AS source,
|
||||
ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY r.in_time DESC) AS rn
|
||||
FROM base_car_main car
|
||||
JOIN base_customer_car cc ON car.id = cc.car_id
|
||||
JOIN base_customer_main c ON cc.cus_id = c.id
|
||||
JOIN dl_repair_tickets r ON c.id = r.user_id
|
||||
|
||||
-- UNION ALL
|
||||
--
|
||||
-- -- 救援单
|
||||
-- SELECT
|
||||
-- car.id AS car_id,
|
||||
-- car.license_number,
|
||||
-- c.id AS customer_id,
|
||||
-- c.cus_name,
|
||||
-- c.phone_number,
|
||||
-- ri.id AS biz_id,
|
||||
-- NULL AS biz_no,
|
||||
-- ri.rescue_type AS biz_type,
|
||||
-- ri.rescue_time AS biz_time,
|
||||
-- 'rescue' AS source,
|
||||
-- ROW_NUMBER() OVER (PARTITION BY car.id ORDER BY ri.rescue_time DESC) AS rn
|
||||
-- FROM base_car_main car
|
||||
-- JOIN base_customer_car cc ON car.id = cc.car_id
|
||||
-- JOIN base_customer_main c ON cc.cus_id = c.id
|
||||
-- JOIN rescue_info ri ON c.id = ri.user_id
|
||||
-- WHERE ri.rescue_time BETWEEN '2025-01-01 00:00:00' AND '2025-01-31 23:59:59'
|
||||
) t
|
||||
WHERE t.rn = 1
|
||||
<if test="reqVO.dateRange != null">
|
||||
AND t.biz_time BETWEEN #{reqVO.dateRange[0]} AND #{reqVO.dateRange[1]}
|
||||
</if>
|
||||
<if test="reqVO.search != null and reqVO.search != ''">
|
||||
AND (t.customerName LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
OR t.customerPhone LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
OR t.carNum LIKE CONCAT('%', #{reqVO.search}, '%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -266,6 +266,10 @@
|
||||
-- 维修工需要关联操作记录,查没有总检记录的工单 --
|
||||
left join dl_repair_records drr ON drt.id = drr.ticket_id AND drr.type='zj'
|
||||
</if>
|
||||
<if test=" map.statisticsType == 'yjg'">
|
||||
-- 维修工需要关联操作记录,查没有总检记录的工单 --
|
||||
inner join dl_repair_records drr ON drt.id = drr.ticket_id AND drr.type='zj'
|
||||
</if>
|
||||
left join dl_repair_titem drti
|
||||
on drt.id = drti.ticket_id AND drti.deleted = '0'
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07','06','02')
|
||||
@ -306,6 +310,9 @@
|
||||
-- 在厂 --
|
||||
AND drt.is_handover = '0' AND drt.tickets_status != '03'
|
||||
</if>
|
||||
<if test="map.statisticsType == 'yjg'">
|
||||
-- 已竣工 --
|
||||
</if>
|
||||
</if>
|
||||
<if test="map.cusFrom != null and map.cusFrom!=''">
|
||||
<choose>
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.system.api.user.dto;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -75,10 +78,14 @@ public class UserDTO {
|
||||
/** 家庭住址 */
|
||||
private String address;
|
||||
|
||||
private String IdNumber;
|
||||
private String idNumber;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date safeDate;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date formalDate;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user