This commit is contained in:
xuyuncong 2025-10-17 15:46:36 +08:00
parent 80834d2040
commit f787275e97
26 changed files with 265 additions and 29 deletions

View File

@ -57,4 +57,13 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
*/
List<CarMain> isDataKeyValueRepeat(@Param("dto") CarMain carMain);
/**
* @description : 查询车辆信息
* @author xyc
* @date 14:15 2025/10/17
* @param cusId {@link String}
* @param carNumber {@link String}
* @return cn.iocoder.yudao.module.custom.entity.CarMain
**/
CarMain selectByCusIdAndCarNumber(@Param("cusId") String cusId,@Param("carNumber") String carNumber);
}

View File

@ -120,4 +120,14 @@ public interface CarMainService extends IService<CarMain> {
**/
CarMain selectByUserIdAndCarNumber(Long userId,String carNumber);
/**
* @description :根据客户id+车牌号查询车辆信息
* @author xyc
* @date 14:14 2025/10/17
* @param cusId {@link String}
* @param carNumber {@link String}
* @return cn.iocoder.yudao.module.custom.entity.CarMain
**/
CarMain selectByCusIdAndCarNumber(String cusId,String carNumber);
}

View File

@ -346,6 +346,19 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}
/**
* @param cusId {@link String}
* @param carNumber {@link String}
* @return cn.iocoder.yudao.module.custom.entity.CarMain
* @description :根据客户id+车牌号查询车辆信息
* @author xyc
* @date 14:14 2025/10/17
**/
@Override
public CarMain selectByCusIdAndCarNumber(String cusId, String carNumber) {
return baseMapper.selectByCusIdAndCarNumber(cusId,carNumber);
}
/**
* 根据品牌型号获取保养规则
*

View File

@ -150,7 +150,7 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
customerMainService.save(customerMain);
}
//根据客户信息+车牌号查这个客户是否已有这个车
CarMain carMain = carMainService.selectByUserIdAndCarNumber(userId,saveReqVO.getCar().getLicenseNumber());
CarMain carMain = carMainService.selectByCusIdAndCarNumber(saveReqVO.getId(),saveReqVO.getCar().getLicenseNumber());
if(null==carMain){
//这个客户不存在这个车辆信息新增
carMain = saveReqVO.getCar();
@ -158,7 +158,7 @@ public class CustomerCarServiceImpl extends ServiceImpl<CustomerCarMapper, Custo
carMainService.save(carMain);
//客户和车的关联关系
CustomerCar customerCar = new CustomerCar();
customerCar.setCusId(customerMain.getId());
customerCar.setCusId(saveReqVO.getId());
customerCar.setCarId(carMain.getId());
//默认车主
customerCar.setIsOwner("1");

View File

@ -148,5 +148,13 @@
AND tbcm.insurance_expiry_date BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 45 DAY)
</if>
</select>
<select id="selectByCusIdAndCarNumber" resultType="cn.iocoder.yudao.module.custom.entity.CarMain">
SELECT main.*
FROM base_car_main main
INNER JOIN base_customer_car cus ON main.id = cus.car_id
where main.deleted = 0 and cus.deleted = 0
and cus.cus_id = #{cusId}
and main.license_number = #{carNumber}
</select>
</mapper>

View File

@ -70,7 +70,7 @@
LEFT JOIN base_car_brand bcb ON bcb.deleted = 0 AND tbcarm.car_brand = bcb.id
LEFT JOIN base_car_model bcm ON bcm.deleted = 0 AND tbcarm.car_model = bcm.id
WHERE
main.deleted = 0
main.deleted = 0 and tbcarm.deleted = 0
AND
main.cus_id = #{cusId}
ORDER BY

View File

@ -37,4 +37,6 @@ public interface RepairDictConstants {
/** 基础业务配置 */
String BASE_BUSINESS_CONFIG = "base_business_config";
String REPAIR_TICKETS_WORK_STATUS = "repair_tickets_work_status";
}

View File

@ -75,6 +75,8 @@ public class RepairStaffController {
.collect(Collectors.toList());
repairStaff.setRoles(weixiuRoleDOS);
repairStaff.setRoleIds(weixiuRoleDOS.stream().map(RoleDO::getId).collect(Collectors.toList()));
return success(repairStaff);
}

View File

@ -60,6 +60,8 @@ public class RepairStaff {
private String roleNames;
List<RoleDO> roles;
private List<Long> roleIds;
/**
* 文件夹id
*/

View File

@ -245,8 +245,13 @@ public class RepairStaffServiceImpl implements RepairStaffService {
companyStaff.setCreateTime(null);
companyStaff.setDeptId(null);
companyStaff.setId(null);
companyStaff.setName(staff.getNickname());
companyStaffService.update(companyStaff, Wrappers.<CompanyStaff>lambdaUpdate()
.eq(CompanyStaff::getUserId, staff.getId()));
// 修改用户表
adminUserApi.updateUser(BeanUtil.copyProperties(staff, AdminUserRespDTO.class));
}
/**

View File

@ -265,4 +265,16 @@ public class RepairWaresController {
ExcelUtils.write(response, "维修配件数据.xls", "数据", RepairWaresExcelVO.class, list);
}
/**
* 统计库存总数量和总金额
*
* @param pageReqVO 查询条件
* @return 统计结果
*/
@GetMapping("/statistics")
@Operation(summary = "统计库存总数量和总金额")
public CommonResult<RepairWaresStatisticsVO> getWaresStatistics(RepairWaresPageReqVO pageReqVO) {
return success(waresService.getWaresStatistics(pageReqVO));
}
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.project.mapper;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.vo.RepairWaresPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresRespVO;
import cn.iocoder.yudao.module.project.vo.RepairWaresStatisticsVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -46,4 +47,12 @@ public interface RepairWaresMapper extends BaseMapper<RepairWares> {
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
**/
List<Map<String,String>> selectAllType();
/**
* 统计库存总数量和总金额
*
* @param pageReqVO 查询条件
* @return 统计结果
*/
RepairWaresStatisticsVO getWaresStatistics(@Param("entity") RepairWaresPageReqVO pageReqVO);
}

View File

@ -102,4 +102,12 @@ public interface RepairWaresService extends IService<RepairWares> {
* @date 15:54 2024/11/30
**/
void stockBelow();
/**
* 统计库存总数量和总金额
*
* @param pageReqVO 查询条件
* @return 统计结果
*/
RepairWaresStatisticsVO getWaresStatistics(RepairWaresPageReqVO pageReqVO);
}

View File

@ -317,4 +317,9 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
admin.forEach(item -> workerService.sentMessage(SystemEnum.REPAIR.getCode(),item.getId(), message));
}
}
@Override
public RepairWaresStatisticsVO getWaresStatistics(RepairWaresPageReqVO pageReqVO) {
return waresMapper.getWaresStatistics(pageReqVO);
}
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.project.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 配件库统计信息 Response VO")
@Data
public class RepairWaresStatisticsVO {
@Schema(description = "配件总数量")
private BigDecimal totalStock;
@Schema(description = "配件总金额")
private BigDecimal totalAmount;
}

View File

@ -73,6 +73,19 @@ public class DlRepairSoController {
return success(dlRepairSoService.getRepairSoPage(repairSoReqVO, page));
}
/**
* 统计采购金额
*
* @param repairSoReqVO 查询条件
* @author 系统管理员
* @date 2024/12/10
**/
@GetMapping("/purchase-amount")
@Operation(summary = "统计采购金额")
public CommonResult<?> getPurchaseAmount(DlRepairSoReqVO repairSoReqVO) {
return success(dlRepairSoService.getPurchaseAmount(repairSoReqVO));
}
/**
* 采购单/领料单 作废
*

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/**
@ -21,6 +22,15 @@ public interface DlRepairSoMapper extends BaseMapper<DlRepairSo> {
IPage<DlRepairSo> getRepairSoPage(@Param("map") DlRepairSoReqVO repairSoReqVO, Page<DlRepairSo> page);
/**
* 统计采购金额
* @author 系统管理员
* @date 2024/12/10
* @param repairSoReqVO 查询条件
* @return 采购总金额
**/
BigDecimal getPurchaseAmount(DlRepairSoReqVO repairSoReqVO);
/**
* 根据条件查询指定数量待确认的领料单 待确认的退料单
* @author vinjor-M

View File

@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
/**
* 针对表dl_repair_so(采购单领料单)的数据库操作Service
*
@ -33,6 +35,16 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
**/
IPage<DlRepairSo> getRepairSoPage(DlRepairSoReqVO repairSoReqVO, Page<DlRepairSo> page);
/**
* 统计采购金额
*
* @param repairSoReqVO 查询条件
* @return 采购总金额
* @author 系统管理员
* @date 2024/12/10
**/
BigDecimal getPurchaseAmount(DlRepairSoReqVO repairSoReqVO);
/**
* 采购单/领料单 作废
*

View File

@ -40,6 +40,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -183,6 +184,11 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
return baseMapper.getRepairSoPage(repairSoReqVO, page);
}
@Override
public BigDecimal getPurchaseAmount(DlRepairSoReqVO repairSoReqVO) {
return dlRepairSoMapper.getPurchaseAmount(repairSoReqVO);
}
/**
* 采购单/领料单 作废
* @param repairSoReqVO 作废对象

View File

@ -644,14 +644,14 @@ public class DlRepairTicketsController {
//查询类型为空默认查待处理的
repairTicketsReqVO.setSelectType(RepairCons.TICKETS_WAITING);
}
List<TicketsExportVO> list = new ArrayList<>();
List<DlRepairTickets> list = new ArrayList<>();
do {
IPage<DlRepairTickets> pageType = dlRepairTicketsService.getPageType(repairTicketsReqVO, page);
List<DlRepairTickets> records = pageType.getRecords();
if (CollUtil.isEmpty(records)){
break;
}
List<TicketsExportVO> convertedRecords = records.stream().map(item -> BeanUtils.toBean(item, TicketsExportVO.class)).collect(Collectors.toList());
List<DlRepairTickets> convertedRecords = records;
list.addAll(convertedRecords);
pageNo++;
page.setCurrent(pageNo);
@ -663,9 +663,14 @@ public class DlRepairTicketsController {
Map<String, Object> statistics = dlRepairTicketsService.getStatistics(repairTicketsReqVO);
List<DictDataRespDTO> dictDataList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_TYPE);
List<DictDataRespDTO> repairWorkStatusList = dictDataApi.getDictDataList(RepairDictConstants.REPAIR_TICKETS_WORK_STATUS);
// 转换map
Map<String, String> repairTypeMap = dictDataList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
// 创建一个Map用于存储字典数据
Map<String, String> repairWorkStatusMap = repairWorkStatusList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue, DictDataRespDTO::getLabel));
List<List<String>> rows = new ArrayList<>();
// 第一行可以写汇总信息或标题行
@ -681,23 +686,28 @@ public class DlRepairTicketsController {
"产值:", totalLaborPartsMoney,
"毛利:", totalProfit,
"含工时毛利率:", profitRateWithLabor,
"不含工时毛利率:", profitRateWithoutLabor));
"不含工时毛利率:", profitRateWithoutLabor,
"","","",""));
}
// 第二行写表头
rows.add(CollUtil.newArrayList("订单编号","维修类别", "客户名称", "车牌号", "车系", "手机号", "经办人姓名", "经办人电话"));
rows.add(CollUtil.newArrayList("订单编号","维修类别", "客户名称", "车牌号", "车系", "手机号", "经办人姓名", "经办人电话", "维修费用", "参考成本", "进场时间", "工作状态"));
// 后面循环写数据
for (TicketsExportVO item : list) {
for (DlRepairTickets item : list) {
rows.add(CollUtil.newArrayList(
item.getTicketNo(),
repairTypeMap.get(item.getRepairType()),
item.getUserName(),
item.getCarNo(),
item.getCarBrandName(),
item.getUserMobile(),
item.getHandleName(),
item.getHandleMobile()
item.getTicketNo() != null ? item.getTicketNo() : "",
repairTypeMap.get(item.getRepairType()) != null ? repairTypeMap.get(item.getRepairType()) : "",
item.getUserName() != null ? item.getUserName() : "",
item.getCarNo() != null ? item.getCarNo() : "",
item.getCarBrandName() != null ? item.getCarBrandName() : "",
item.getUserMobile() != null ? item.getUserMobile() : "",
item.getHandleName() != null ? item.getHandleName() : "",
item.getHandleMobile() != null ? item.getHandleMobile() : "",
item.getTotalPrice() != null ? item.getTotalPrice().toString() : "0",
item.getAccessoriesMoney() != null ? item.getAccessoriesMoney().toString() : "0",
item.getInTime() != null ? DateUtil.formatDateTime(item.getInTime()) : "",
repairWorkStatusMap.get(item.getTicketsWorkStatus()) != null ? repairWorkStatusMap.get(item.getTicketsWorkStatus()) : ""
));
}
@ -733,7 +743,7 @@ public class DlRepairTicketsController {
throw exception0(500, "没有数据可以导出");
}
String name = "";
switch (repairTicketsReqVO.getTicketsStatus()){
switch (repairTicketsReqVO.getPayStatus()){
case "01":
name = "待结算工单数据.xls";
break;

View File

@ -271,4 +271,7 @@ public class DlRepairTickets extends TenantBaseDO {
private TicketsSettlementVO settlement;
@TableField(exist = false)
private boolean ifShow = false;
/** 配件金额 */
@TableField(exist = false)
private BigDecimal accessoriesMoney;
}

View File

@ -7,6 +7,8 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.util.Date;
/**
* 用于工单数据导出
*
@ -41,4 +43,11 @@ public class TicketsExportVO {
@ExcelProperty("经办人电话")
private String handleMobile;
@ExcelProperty("配件成本")
private String accessoriesMoney;
/** 进厂时间 */
@ExcelProperty("进厂时间")
private Date inTime;
}

View File

@ -59,4 +59,21 @@
WHERE tmp.type is not null AND tmp.type !=''
ORDER BY dbt.create_time DESC
</select>
<select id="getWaresStatistics" resultType="cn.iocoder.yudao.module.project.vo.RepairWaresStatisticsVO">
SELECT
SUM(drw.stock) AS totalStock,
SUM(drw.stock * drw.price) AS totalAmount
FROM
dl_repair_wares drw
<where>
drw.deleted = 0
<if test="entity.name != null and entity.name != ''">
and drw.name like concat('%', #{entity.name}, '%')
</if>
<if test="entity.type != null and entity.type != ''">
and drw.type =#{entity.type}
</if>
</where>
</select>
</mapper>

View File

@ -138,4 +138,52 @@
drs.deleted = '0'
AND drs.so_id=#{id}
</select>
<!-- 统计采购金额 -->
<select id="getPurchaseAmount" resultType="java.math.BigDecimal">
SELECT
COALESCE(SUM(so.total_price), 0)
FROM
dl_repair_so so
LEFT JOIN dl_ticket_wares dtw ON so.tw_id = dtw.id
WHERE
so.deleted = '0'
AND so.so_type = '01' <!-- 01表示采购单 -->
<if test="soType != null and soType != ''">
and so.so_type = #{soType}
</if>
<if test="purchaseType != null and purchaseType != ''">
and so.purchase_type = #{purchaseType}
</if>
<if test="soStatus != null and soStatus != ''">
and so.so_status = #{soStatus}
</if>
<if test="soStatus == null">
and (so.so_status != '06' or so.so_status is null)
</if>
<if test="searchTimeArray != null and searchTimeArray.length > 0">
and (so.create_time between #{searchTimeArray[0]} and #{searchTimeArray[1]})
</if>
<if test="query != null and query != ''">
and (so.so_no like concat('%', #{query}, '%') or so.remark like concat('%', #{query}, '%') or dtw.license_number like concat('%', #{query}, '%'))
</if>
<if test="supplierId != null and supplierId != ''">
and so.supplier_id = #{supplierId}
</if>
<if test="corpId != null and corpId != ''">
and so.corp_id = #{corpId}
</if>
<if test="soNo != null and soNo != ''">
and (so.so_no like concat('%', #{soNo}, '%') or so.remark like concat('%', #{soNo}, '%'))
</if>
<if test="userId != null and userId != ''">
and (so.user_id = #{userId} or find_in_set(#{userId}, so.user_ids) > 0)
</if>
<if test="mainId != null and mainId != ''">
and so.main_id = #{mainId}
</if>
<if test="twId != null and twId != ''">
and so.tw_id = #{twId}
</if>
</select>
</mapper>

View File

@ -128,6 +128,7 @@
<result property="handleName" column="handle_name" />
<result property="handleMobile" column="handle_mobile" />
<result property="settlementTime" column="settlementTime" />
<result property="accessoriesMoney" column="accessoriesMoney" />
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
</resultMap>
@ -416,7 +417,12 @@
</select>
<select id="getPageTypeAll" resultMap="APPBaseResultMap">
SELECT drt.*,drr.create_time AS settlementTime
SELECT drt.*,drr.create_time AS settlementTime,
-- 统计配件的成本
(
SELECT SUM(item_money - item_profit) FROM dl_repair_titem
WHERE ticket_id = drt.id AND item_type = '02'
) AS accessoriesMoney
FROM dl_repair_tickets drt
<if test="map.cusFrom != null and map.cusFrom!=''">
-- 按客户来源查,需要关联客户表 --
@ -440,7 +446,6 @@
<if test="map.timeType == 'settlement'">
AND (drr.create_time BETWEEN CONCAT(#{map.searchTimeArray[0]}, ' 00:00:00') AND CONCAT(#{map.searchTimeArray[1]}, ' 23:59:59'))
</if>
</if>
<!-- 时间区间 -->

View File

@ -194,7 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
HAVING SUM(sr.role_id = #{role.roleId}) > 0
</if>
order by su.nickname
order by su.id DESC
</select>
<select id="userCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO">