This commit is contained in:
Vinjor 2024-10-19 18:09:16 +08:00
parent a76a198161
commit 78147d7382
6 changed files with 159 additions and 68 deletions

View File

@ -1,12 +1,16 @@
package cn.iocoder.yudao.module.base.controller.admin; package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
import cn.iocoder.yudao.module.base.service.RepairRecordsService; import cn.iocoder.yudao.module.base.service.RepairRecordsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* 维修记录 管理 API * 维修记录 管理 API
@ -20,6 +24,37 @@ public class RepairRecordsController {
@Resource @Resource
private RepairRecordsService repairRecordsService; private RepairRecordsService repairRecordsService;
@Resource
private RepairRecordsItemService repairRecordsItemService;
/**
* 根据当前用户和工单主表id查询当前在维修的项目信息
* @author vinjor-M
* @date 13:50 2024/10/19
* @param ticketId 工单ID
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/listByTicketId")
@Operation(summary = "根据当前用户和工单主表id查询当前在维修的项目信息")
public CommonResult<?> selectNowRepairByTicketId(@RequestParam("ticketId") String ticketId) {
return repairRecordsService.selectNowRepairByTicketId(ticketId);
}
/**
* 维修记录图片授权客户查看接口--收回查看权限也走这个
* @author vinjor-M
* @date 13:50 2024/10/19
* @param itemList 子表集和
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@PostMapping("/updateItemBatch")
@Operation(summary = "维修记录图片授权客户查看接口--收回查看权限也走这个")
public CommonResult<?> updateItemBatch(@RequestBody List<RepairRecordsItem> itemList) {
if(!itemList.isEmpty()){
repairRecordsItemService.updateBatchById(itemList);
}
return CommonResult.success("");
}
} }

View File

@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 维修记录 Mapper * 维修记录 Mapper
@ -26,6 +27,13 @@ public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
*/ */
List<RepairRecordsRespVO> queryRepairRecords(@Param("entity") RepairRecordsPageReqVO entity); List<RepairRecordsRespVO> queryRepairRecords(@Param("entity") RepairRecordsPageReqVO entity);
/**
* 根据当前用户和工单主表id查询当前在维修的项目信息
* @author vinjor-M
* @date 13:36 2024/10/19
* @param ticketId 工单ID
* @return java.util.Map<java.lang.String,java.lang.String>
**/
Map<String,String> selectNowRepairByTicketId(@Param("ticketId")String ticketId);
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.base.service; package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.entity.RepairRecords; import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO; import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
@ -36,4 +37,12 @@ public interface RepairRecordsService extends IService<RepairRecords> {
**/ **/
List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO); List<RepairRecordsRespVO> queryList(RepairRecordsPageReqVO pageReqVO);
/**
* 根据当前用户和工单主表id查询当前在维修的项目信息
* @author vinjor-M
* @date 13:35 2024/10/19
* @param ticketId 工单id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
CommonResult<?> selectNowRepairByTicketId(String ticketId);
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.base.service.impl; package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairRecords; import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem; import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
@ -88,4 +89,17 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
}); });
return list; return list;
} }
/**
* 根据当前用户和工单主表id查询当前在维修的项目信息
*
* @param ticketId 工单id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
* @author vinjor-M
* @date 13:35 2024/10/19
**/
@Override
public CommonResult<?> selectNowRepairByTicketId(String ticketId) {
return CommonResult.success(repairRecordsMapper.selectNowRepairByTicketId(ticketId));
}
} }

View File

@ -29,5 +29,21 @@
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectNowRepairByTicketId" resultType="java.util.Map">
SELECT
drr.repair_item_id,
drt.item_name
FROM
dl_repair_records drr
LEFT JOIN dl_repair_titem drt ON drr.repair_item_id = drt.id
WHERE
drr.ticket_id = #{ticketId}
AND drr.repair_item_id IS NOT NULL
AND drr.type = 'kssg'
AND drr.deleted = '0'
ORDER BY
drr.create_time DESC
LIMIT 1
</select>
</mapper> </mapper>

View File

@ -46,28 +46,52 @@
<result property="nowRepairId" column="now_repair_id" /> <result property="nowRepairId" column="now_repair_id" />
<result property="nowRepairName" column="now_repair_name" /> <result property="nowRepairName" column="now_repair_name" />
<result property="partShow" column="part_show" /> <result property="partShow" column="part_show" />
</resultMap>
<resultMap id="APPBaseResultMap" type="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="ticketNo" column="ticket_no" jdbcType="VARCHAR"/>
<result property="repairType" column="repair_type" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="userMobile" column="user_mobile" jdbcType="VARCHAR"/>
<result property="carId" column="car_id" jdbcType="VARCHAR"/>
<result property="carNo" column="car_no" jdbcType="VARCHAR"/>
<result property="carVin" column="car_vin" jdbcType="VARCHAR"/>
<result property="carBrandId" column="car_brand_id" jdbcType="VARCHAR"/>
<result property="carBrandName" column="car_brand_name" jdbcType="VARCHAR"/>
<result property="carBrandType" column="car_brand_type" jdbcType="VARCHAR"/>
<result property="adviserId" column="adviser_id" jdbcType="VARCHAR"/>
<result property="adviserName" column="adviser_name" jdbcType="VARCHAR"/>
<result property="payType" column="pay_type" jdbcType="VARCHAR"/>
<result property="repairAdvice" column="repair_advice" jdbcType="VARCHAR"/>
<result property="qualityMileage" column="quality_mileage" jdbcType="VARCHAR"/>
<result property="qualityDay" column="quality_day" jdbcType="VARCHAR"/>
<result property="endCheck" column="end_check" jdbcType="VARCHAR"/>
<result property="partDisposal" column="part_disposal" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
<result property="ticketType" column="ticket_type" jdbcType="VARCHAR"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="count" column="count"/>
<result property="projectPrice" column="project_price"/>
<result property="partPrice" column="part_price"/>
<result property="otherPrice" column="other_price"/>
<result property="totalPrice" column="total_price"/>
<result property="ticketsStatus" column="tickets_status"/>
<result property="createTime" column="create_time"/>
<result property="inTime" column="in_time" />
<result property="outTime" column="out_time" />
<result property="cost" column="cost" />
<result property="profit" column="profit" />
<result property="partStatus" column="part_status" />
<result property="ticketsWorkStatus" column="tickets_work_status" />
<result property="isFinish" column="is_finish" />
<result property="nowRepairId" column="now_repair_id" />
<result property="nowRepairName" column="now_repair_name" />
<result property="partShow" column="part_show" />
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/> <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" columnPrefix="item_"> <collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="ticketId" column="ticket_id" />
<result property="itemName" column="item_name" />
<result property="itemCount" column="item_count" />
<result property="itemUnit" column="item_unit" />
<result property="itemPrice" column="item_price" />
<result property="itemDiscount" column="item_discount" />
<result property="itemMoney" column="item_money" />
<result property="repairIds" column="repair_ids" />
<result property="repairNames" column="repair_names" />
<result property="saleId" column="sale_id" />
<result property="saleName" column="sale_name" />
<result property="itemType" column="item_type" />
<result property="projectId" column="project_id" />
<result property="partId" column="part_id" />
<result property="otherId" column="other_id" />
<result property="itemTypeId" column="item_type_id" />
<result property="itemStatus" column="item_status" />
<result property="remark" column="remark" />
</collection>
</resultMap> </resultMap>
<sql id="Base_SQL"> <sql id="Base_SQL">
@ -157,30 +181,9 @@
order by drt.create_time desc order by drt.create_time desc
</select> </select>
<select id="getPageType" resultMap="BaseResultMap"> <select id="getPageType" resultMap="APPBaseResultMap">
select drt.*, select drt.*
drti.id AS item_id,
drti.ticket_id AS item_ticket_id,
drti.item_name AS item_item_name,
drti.item_count AS item_item_count,
drti.item_unit AS item_item_unit,
drti.item_price AS item_item_price,
drti.item_discount AS item_item_discount,
drti.item_money AS item_item_money,
drti.repair_ids AS item_repair_ids,
drti.repair_names AS item_repair_names,
drti.sale_id AS item_sale_id,
drti.sale_name AS item_sale_name,
drti.item_type AS item_item_type,
drti.project_id AS item_project_id,
drti.part_id AS item_part_id,
drti.other_id AS item_other_id,
drti.item_type_id AS item_type_id,
drti.item_status AS item_item_status,
drti.remark AS item_remark
from dl_repair_tickets drt from dl_repair_tickets drt
left join dl_repair_titem drti
on drt.id = drti.ticket_id AND drti.deleted = '0'
where drt.deleted = '0' where drt.deleted = '0'
<if test="map.ticketNo != null and map.ticketNo != ''"> <if test="map.ticketNo != null and map.ticketNo != ''">
and ( and (
@ -215,27 +218,32 @@
order by drt.create_time desc order by drt.create_time desc
</select> </select>
<select id="getPageTypeAll" resultMap="BaseResultMap"> <select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
select drt.*, select drti.id ,
drti.id AS item_id, drti.ticket_id ,
drti.ticket_id AS item_ticket_id, drti.item_name ,
drti.item_name AS item_item_name, drti.item_count ,
drti.item_count AS item_item_count, drti.item_unit ,
drti.item_unit AS item_item_unit, drti.item_price ,
drti.item_price AS item_item_price, drti.item_discount ,
drti.item_discount AS item_item_discount, drti.item_money ,
drti.item_money AS item_item_money, drti.repair_ids ,
drti.repair_ids AS item_repair_ids, drti.repair_names ,
drti.repair_names AS item_repair_names, drti.sale_id ,
drti.sale_id AS item_sale_id, drti.sale_name ,
drti.sale_name AS item_sale_name, drti.item_type ,
drti.item_type AS item_item_type, drti.project_id ,
drti.project_id AS item_project_id, drti.part_id ,
drti.part_id AS item_part_id, drti.other_id ,
drti.other_id AS item_other_id, drti.item_type_id ,
drti.item_type_id AS item_type_id, drti.item_status ,
drti.item_status AS item_item_status, drti.remark
drti.remark AS item_remark from dl_repair_titem drti
where drti.ticket_id = #{id} AND drti.deleted = '0'
</select>
<select id="getPageTypeAll" resultMap="APPBaseResultMap">
select drt.*
from dl_repair_tickets drt from dl_repair_tickets drt
left join dl_repair_titem drti left join dl_repair_titem drti
on drt.id = drti.ticket_id AND drti.deleted = '0' on drt.id = drti.ticket_id AND drti.deleted = '0'
@ -266,6 +274,7 @@
</foreach> </foreach>
) )
</if> </if>
GROUP BY drt.id
order by drt.create_time desc order by drt.create_time desc
</select> </select>
</mapper> </mapper>