更新
This commit is contained in:
parent
f4ef7e84b3
commit
3512e7ad03
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@ -31,5 +32,5 @@ public class DlRepairSoiReqVO extends DlRepairSoi {
|
||||
private String query;
|
||||
|
||||
/** 供应商ID */
|
||||
private String supplierId;
|
||||
private String supplierId;
|
||||
}
|
||||
|
||||
@ -348,6 +348,18 @@ public class DlRepairTicketsController {
|
||||
return success(dlRepairTicketsService.getPageType(repairTicketsReqVO, page));
|
||||
}
|
||||
|
||||
/**
|
||||
* @description : 根据工单id集合获取子项目
|
||||
* @author xyc
|
||||
* @date 9:50 2025/11/11
|
||||
* @param [ticketIds, selectType]
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getProjectByTicketIds")
|
||||
public CommonResult<?> getProjectByTicketIds(@RequestParam("ticketIds") List<String> ticketIds, @RequestParam(value = "selectType", required = false) String selectType) {
|
||||
return success(dlRepairTicketsService.getProjectByTicketIds(ticketIds, selectType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断登录用户的角色,针对维修工单中的四个角色
|
||||
*
|
||||
|
||||
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.tickets.entity;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -80,4 +81,7 @@ public class DlTicketWares extends TenantBaseDO {
|
||||
private String safeMobile;
|
||||
/** 是否已完成申领(0未完成|1已完成) */
|
||||
private String isEnd;
|
||||
}
|
||||
|
||||
@TableField(exist = false)
|
||||
private String vin;
|
||||
}
|
||||
|
||||
@ -52,6 +52,15 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO>
|
||||
**/
|
||||
List<DlRepairTitemReqVO> selectByTicketId(@Param("ticketId")String ticketId);
|
||||
|
||||
/**
|
||||
* @description : 根据工单ids 查询项目
|
||||
* @author xyc
|
||||
* @date 10:03 2025/11/11
|
||||
* @param [ticketIds, selectType]
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
|
||||
**/
|
||||
List<DlRepairTitem> selectProjectByTicketIds(@Param("ticketIds") List<String> ticketIds);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.tickets.service;
|
||||
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.vo.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -353,4 +354,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param repairTicketsRespVO {@link DlRepairTicketsRespVO}
|
||||
**/
|
||||
void antiSettlement(DlRepairTicketsRespVO repairTicketsRespVO);
|
||||
|
||||
/**
|
||||
* @description : 根据工单ids查询项目
|
||||
* @author xyc
|
||||
* @date 10:02 2025/11/11
|
||||
* @param [ticketIds, selectType]
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
|
||||
**/
|
||||
List<DlRepairTitem> getProjectByTicketIds(List<String> ticketIds, String selectType);
|
||||
}
|
||||
|
||||
@ -702,6 +702,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
result.setProfitRateNo(profitRateNo);
|
||||
}
|
||||
|
||||
//查询结算记录
|
||||
RepairRecords js = repairRecordsService.getOne(Wrappers.<RepairRecords>lambdaQuery()
|
||||
.eq(RepairRecords::getTicketId, id)
|
||||
.eq(RepairRecords::getType, RecordTypeEnum.JSSQ.getCode())
|
||||
.orderByDesc(RepairRecords::getCreateTime)
|
||||
.last("limit 1"));
|
||||
|
||||
if (ObjectUtil.isNotEmpty(js)) {
|
||||
result.setSettlementTime(js.getCreateTime());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -753,7 +764,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairOrderInfoService.updateById(one);
|
||||
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(one.getGoodsId(), null, RecordTypeEnum.SK.getCode(), "未收款-"+repairTicketsRespVO.getRemark(), null);
|
||||
repairRecordsService.saveRepairRecord(one.getGoodsId(), null, RecordTypeEnum.SK.getCode(), "未收款-" + repairTicketsRespVO.getRemark(), null);
|
||||
return;
|
||||
}
|
||||
RepairOrderInfo repairOrderInfo = new RepairOrderInfo();
|
||||
@ -791,7 +802,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
TicketsSettlementVO approvalVO = JSON.parseObject(otherData, TicketsSettlementVO.class);
|
||||
|
||||
// 设置订单金额信息
|
||||
repairOrderInfo.setPayMoney(approvalVO.getActualMoney());
|
||||
repairOrderInfo.setPayMoney(repairTicketsRespVO.getRealActualMoney());
|
||||
repairOrderInfo.setGoodsPrice(approvalVO.getMoney());
|
||||
|
||||
//判断优惠类型
|
||||
@ -838,6 +849,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
/*修改工单表的结算方式*/
|
||||
update(Wrappers.<DlRepairTickets>lambdaUpdate()
|
||||
.eq(DlRepairTickets::getId, vo.getTicketId())
|
||||
.set(DlRepairTickets::getPayStatus, "01")
|
||||
.set(DlRepairTickets::getSettlementType, vo.getSettlementType()));
|
||||
|
||||
/*添加结算数据*/
|
||||
@ -929,7 +941,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* @Param [startDate, endDate]
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getBossNumStatistics(String startDate, String endDate, String busiFrom, String cusFrom,boolean isShowChildren) {
|
||||
public Map<String, Object> getBossNumStatistics(String startDate, String endDate, String busiFrom, String cusFrom, boolean isShowChildren) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<Map<String, Object>> statsList = new ArrayList<>();
|
||||
|
||||
@ -955,17 +967,17 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
Map<String, Long> newOrderStats = ticketsInRange.stream()
|
||||
// .filter(item -> TicketsStatusEnum.NO_WORK.getCode().equals(item.getTicketsStatus()))
|
||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||
statsList.add(createStatsNode("newOrderNum", "订单(进厂数)", newOrderStats, "jinchang",isShowChildren));
|
||||
statsList.add(createStatsNode("newOrderNum", "订单(进厂数)", newOrderStats, "jinchang", isShowChildren));
|
||||
|
||||
// 维修中(按 repairType 分组)
|
||||
Map<String, Long> workingStats = ticketsInRange.stream()
|
||||
.filter(item -> TicketsStatusEnum.WORKING.getCode().equals(item.getTicketsStatus()))
|
||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||
statsList.add(createStatsNode("workingNum", "维修中", workingStats, "weixiuzhong",isShowChildren));
|
||||
statsList.add(createStatsNode("workingNum", "维修中", workingStats, "weixiuzhong", isShowChildren));
|
||||
|
||||
// 已竣工(通过 mapper 查询并按 repairType 分组)
|
||||
Map<String, Long> overStats = getOverStatsByRepairType(startDate, endDate, busiFrom, cusFrom);
|
||||
statsList.add(createStatsNode("overNum", "已竣工", overStats, "yijungong",isShowChildren));
|
||||
statsList.add(createStatsNode("overNum", "已竣工", overStats, "yijungong", isShowChildren));
|
||||
|
||||
// 竣工已结算
|
||||
|
||||
@ -974,18 +986,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
Map<String, Long> noPayStats = ticketsInRange.stream()
|
||||
.filter(item -> noPayCodeList.contains(item.getTicketsStatus()))
|
||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats, "weijiesuan",isShowChildren));
|
||||
statsList.add(createStatsNode("noPayNum", "未结算", noPayStats, "weijiesuan", isShowChildren));
|
||||
|
||||
// 已交车(通过 mapper 查询并按 repairType 分组)
|
||||
Map<String, Long> giveCusStats = getGiveCusStatsByRepairType(startDate, endDate, busiFrom, cusFrom);
|
||||
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats, "yijiaoche",isShowChildren));
|
||||
statsList.add(createStatsNode("giveCusNum", "已交车", giveCusStats, "yijiaoche", isShowChildren));
|
||||
|
||||
// 在厂(未交车且不是已完成状态 03)
|
||||
Map<String, Long> inCompanyStats = ticketsInRange.stream()
|
||||
.filter(item -> "0".equals(item.getIsHandover()))
|
||||
.filter(item -> !"03".equals(item.getTicketsStatus()))
|
||||
.collect(Collectors.groupingBy(DlRepairTickets::getRepairType, Collectors.counting()));
|
||||
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats, "zaichang",isShowChildren));
|
||||
statsList.add(createStatsNode("inCompanyNum", "在厂", inCompanyStats, "zaichang", isShowChildren));
|
||||
|
||||
// 添加到结果map
|
||||
resultMap.put("stats", statsList);
|
||||
@ -1009,7 +1021,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
update(Wrappers.<DlRepairTickets>lambdaUpdate()
|
||||
.eq(DlRepairTickets::getId, repairTicketsRespVO.getId())
|
||||
.set(DlRepairTickets::getPayConfirm, repairTicketsRespVO.getPayConfirm())
|
||||
.set(StringUtils.isNotEmpty(repairTicketsRespVO.getPayConfirmRemark()),DlRepairTickets::getPayConfirmRemark, repairTicketsRespVO.getPayConfirmRemark()));
|
||||
.set(StringUtils.isNotEmpty(repairTicketsRespVO.getPayConfirmRemark()), DlRepairTickets::getPayConfirmRemark, repairTicketsRespVO.getPayConfirmRemark()));
|
||||
|
||||
//添加记录
|
||||
repairRecordsService.saveRepairRecord(repairTicketsRespVO.getId(), null, RecordTypeEnum.QRSK.getCode(), RecordTypeEnum.QRSK.getName(), null, null);
|
||||
@ -1031,8 +1043,52 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairRecordsService.saveRepairRecord(repairTicketsRespVO.getId(), null, RecordTypeEnum.FJS.getCode(), RecordTypeEnum.FJS.getName(), null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ticketIds
|
||||
* @param selectType
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlRepairTitem>
|
||||
* @description : 根据工单ids查询项目
|
||||
* @author xyc
|
||||
* @date 10:02 2025/11/11
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairTitem> getProjectByTicketIds(List<String> ticketIds, String selectType) {
|
||||
List<DlRepairTitem> dlRepairTitems = repairTitemMapper.selectProjectByTicketIds(ticketIds);
|
||||
|
||||
// 查询记录表是否有未收款
|
||||
List<RepairRecords> records = repairRecordsService.list(Wrappers.<RepairRecords>lambdaQuery()
|
||||
.in(RepairRecords::getTicketId, ticketIds)
|
||||
.in(RepairRecords::getType, RecordTypeEnum.SK.getCode(), RecordTypeEnum.TZQC.getCode()));
|
||||
Set<String> paidTicketIds = records.stream().filter(item -> RecordTypeEnum.SK.getCode().equals(item.getType())).map(item -> item.getTicketId()).collect(Collectors.toSet());
|
||||
Set<String> qcTicketIds = records.stream().filter(item -> RecordTypeEnum.TZQC.getCode().equals(item.getType())).map(item -> item.getTicketId()).collect(Collectors.toSet());
|
||||
|
||||
for (String item : ticketIds) {
|
||||
if (!paidTicketIds.contains(item)) {
|
||||
// 创建未收款记录
|
||||
DlRepairTitem unpaidItem = new DlRepairTitem();
|
||||
unpaidItem.setTicketId(item);
|
||||
unpaidItem.setItemName("未收款");
|
||||
|
||||
// 将未收款记录添加到临时列表
|
||||
dlRepairTitems.add(unpaidItem);
|
||||
}
|
||||
if (!qcTicketIds.contains(item)) {
|
||||
// 创建未收款记录
|
||||
DlRepairTitem unpaidItem = new DlRepairTitem();
|
||||
unpaidItem.setTicketId(item);
|
||||
unpaidItem.setItemName("未取车");
|
||||
|
||||
// 将未收款记录添加到临时列表
|
||||
dlRepairTitems.add(unpaidItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return dlRepairTitems;
|
||||
}
|
||||
|
||||
// 获取已完成工单按维修类型分组的统计(优化版本)
|
||||
private Map<String, Long> getOverStatsByRepairType(String startDate, String endDate,String busiFrom, String cusFrom) {
|
||||
private Map<String, Long> getOverStatsByRepairType(String startDate, String endDate, String busiFrom, String cusFrom) {
|
||||
// 直接使用 mapper 查询已完成工单并按 repairType 分组
|
||||
QueryWrapper<DlRepairTickets> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.ne("drt.tickets_status", "03"); // 已完成状态
|
||||
@ -1056,7 +1112,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
|
||||
// 获取已交车工单按维修类型分组的统计(优化版本)
|
||||
private Map<String, Long> getGiveCusStatsByRepairType(String startDate, String endDate,String busiFrom, String cusFrom) {
|
||||
private Map<String, Long> getGiveCusStatsByRepairType(String startDate, String endDate, String busiFrom, String cusFrom) {
|
||||
// 直接使用 mapper 查询已交车工单并按 repairType 分组
|
||||
QueryWrapper<DlRepairTickets> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_handover", "1"); // 已交车
|
||||
@ -1132,6 +1188,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
private Map<String, Object> calculateAmountStats(String startDate, String endDate) {
|
||||
return calculateAmountStats(startDate, endDate, null, null);
|
||||
}
|
||||
|
||||
// 计算金额统计
|
||||
private Map<String, Object> calculateAmountStats(String startDate, String endDate, String busiFrom, String cusFrom) {
|
||||
Map<String, Object> amountMap = new HashMap<>();
|
||||
@ -1987,7 +2044,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
RoleReqDTO roleInfo = roleApi.getRoleInfo(RepairRoleEnum.INSPECTION.getCode());
|
||||
// 通过角色信息查有这个角色的人
|
||||
List<Long> ids = permissionApi.getUserIdByRoleId(roleInfo.getId());
|
||||
if (CollectionUtil.isEmpty(ids)) return;
|
||||
if (CollectionUtil.isEmpty(ids)) return;
|
||||
// 如果是移交给总检就需要通知总检并让其总检
|
||||
if (RecordTypeEnum.SGWCZJ.getCode().equals(respVO.getRecordType()) && "02".equals(respVO.getFinishType())) {
|
||||
// 工单移交给总检(理论上讲只有一个总检,就算有多个这里面也只给一个)
|
||||
|
||||
@ -97,4 +97,9 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
|
||||
|
||||
/** 收款账户 */
|
||||
private String receivablesAccount;
|
||||
|
||||
/**
|
||||
* 实收金额
|
||||
*/
|
||||
private BigDecimal realActualMoney;
|
||||
}
|
||||
|
||||
@ -68,6 +68,9 @@
|
||||
drw.model like concat('%', #{map.query}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="map.supplierId != null and map.supplierId != null">
|
||||
and so.supplier_id = #{map.supplierId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<resultMap id="SoiAndWares" type="cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO">
|
||||
|
||||
@ -200,20 +200,23 @@
|
||||
SELECT * FROM dl_repair_booking WHERE tickets_id = #{id}
|
||||
</select>
|
||||
<select id="getTicketsPage" resultMap="APPBaseResultMap">
|
||||
SELECT drt.*,rorder.pay_time AS payTime,rorder.receivables_account AS receivablesAccount
|
||||
SELECT drt.*, rorder.pay_time AS payTime, rorder.receivables_account AS receivablesAccount
|
||||
<if test="(map.payStatus != null and map.payStatus != '' and (map.payStatus == '01' or map.payStatus == '04')) or (map.payStatuses != null and map.payStatuses.size() > 0 and (map.payStatuses.indexOf('01') >= 0 or map.payStatuses.indexOf('04') >= 0))">
|
||||
,drr.other_data AS settlementStr
|
||||
, drr.other_data AS settlementStr
|
||||
</if>
|
||||
|
||||
FROM dl_repair_tickets drt
|
||||
INNER JOIN repair_order_info rorder ON rorder.goods_id = drt.id
|
||||
<if test="(map.payStatus != null and map.payStatus != '' and (map.payStatus == '01' or map.payStatus == '04')) or (map.payStatuses != null and map.payStatuses.size() > 0 and (map.payStatuses.indexOf('01') >= 0 or map.payStatuses.indexOf('04') >= 0))">
|
||||
LEFT JOIN dl_repair_records drr ON drt.id = drr.ticket_id AND drr.type = 'jssq'
|
||||
LEFT JOIN (
|
||||
SELECT ticket_id, other_data,
|
||||
ROW_NUMBER() OVER (PARTITION BY ticket_id ORDER BY create_time DESC) AS rn
|
||||
FROM dl_repair_records
|
||||
WHERE type = 'jssq'
|
||||
) drr ON drt.id = drr.ticket_id AND drr.rn = 1
|
||||
</if>
|
||||
<where>
|
||||
drt.deleted = '0'
|
||||
AND rorder.deleted = '0'
|
||||
|
||||
<!-- 已结算的 -->
|
||||
<if test="map.ticketsStatus != null and map.ticketsStatus != '' and map.ticketsStatus == '02'">
|
||||
and drt.tickets_status in ('08', #{map.ticketsStatus})
|
||||
@ -265,10 +268,14 @@
|
||||
<if test="map.ticketsWorkStatus != null and map.ticketsWorkStatus != ''">
|
||||
and drt.tickets_work_status = #{map.ticketsWorkStatus}
|
||||
</if>
|
||||
<if test="map.settlementType != null and map.settlementType != ''">
|
||||
and drt.settlement_type = #{map.settlementType}
|
||||
</if>
|
||||
</where>
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getPageType" resultMap="APPBaseResultMap">
|
||||
-- 查待处理数据 --
|
||||
select drt.*
|
||||
|
||||
@ -142,4 +142,16 @@
|
||||
AND drt.deleted = '0'
|
||||
ORDER BY drw.type,drt.create_time
|
||||
</select>
|
||||
<select id="selectProjectByTicketIds" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
SELECT t.*
|
||||
FROM dl_repair_titem t
|
||||
LEFT JOIN dl_repair_records r
|
||||
ON t.id = r.repair_item_id AND r.deleted = '0'
|
||||
WHERE t.ticket_id IN
|
||||
<foreach item="item" index="index" collection="ticketIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND r.id IS NULL
|
||||
AND t.deleted = b'0';
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
<result property="safeName" column="safe_name" />
|
||||
<result property="safeContact" column="safe_contact" />
|
||||
<result property="safeMobile" column="safe_mobile" />
|
||||
<result property="vin" column="vin" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_SQL">
|
||||
@ -50,10 +51,12 @@
|
||||
dtw.to_safe,
|
||||
dtw.safe_name,
|
||||
dtw.safe_contact,
|
||||
dtw.safe_mobile
|
||||
dtw.safe_mobile,
|
||||
bcm.vin
|
||||
from dl_ticket_wares dtw
|
||||
left join dl_repair_tickets drt
|
||||
on dtw.ticket_id = drt.id
|
||||
left join base_car_main bcm on bcm.id = dtw.car_id
|
||||
where dtw.deleted = '0'
|
||||
</sql>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user