This commit is contained in:
xiaofajia 2024-10-19 22:56:16 +08:00
commit 374a82a78d
9 changed files with 209 additions and 68 deletions

View File

@ -1,12 +1,16 @@
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 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 维修记录 管理 API
@ -20,6 +24,37 @@ public class RepairRecordsController {
@Resource
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 java.util.List;
import java.util.Map;
/**
* 维修记录 Mapper
@ -26,6 +27,13 @@ public interface RepairRecordsMapper extends BaseMapper<RepairRecords> {
*/
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;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
@ -36,4 +37,12 @@ public interface RepairRecordsService extends IService<RepairRecords> {
**/
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;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairRecords;
import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
@ -88,4 +89,17 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
});
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

@ -46,6 +46,19 @@ public class DlTicketWaresController {
return success(dlTicketWaresService.getPage(reqVO, page));
}
/**
* 查询当前工单下的配件申请单
* @author PQZ
* @date 13:43 2024/10/19
* @param reqVO DlTicketWaresReqVO实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
**/
@GetMapping("/list")
@Operation(summary = "不分页查询待审批的配件申请单")
public CommonResult<?> list(DlTicketWaresReqVO reqVO){
return success(dlTicketWaresService.listByTicket(reqVO));
}
/**
* 新增修改
*

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.util.List;
/**
* 针对表dl_ticket_wares(工单配件申请/退回表)的数据库操作Service
*
@ -24,6 +26,15 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
**/
IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page);
/**
* 查询当前工单下的配件申请单
* @author PQZ
* @date 13:44 2024/10/19
* @param reqVO DlTicketWaresReqVO
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlTicketWares>
**/
List<DlTicketWares> listByTicket(DlTicketWaresReqVO reqVO);
/**
* 新增修改
*

View File

@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -122,6 +123,31 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
return baseMapper.getPage(reqVO, page);
}
/**
* 查询当前工单下的配件申请单
*
* @param reqVO DlTicketWaresReqVO
* @return java.util.List<cn.iocoder.yudao.module.tickets.entity.DlTicketWares>
* @author PQZ
* @date 13:44 2024/10/19
**/
@Override
public List<DlTicketWares> listByTicket(DlTicketWaresReqVO reqVO) {
// 确认查看者身份
String userRoleCode = repairTicketsService.getUserRole();
List<DlTicketWares> result = new ArrayList<>();
//维修业务管理员总检服务顾问均可以进行审批
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())||userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
LambdaQueryWrapper<DlTicketWares> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DlTicketWares::getTicketId,reqVO.getTicketId());
if (null != reqVO.getStatus()){
lambdaQueryWrapper.eq(DlTicketWares::getStatus,reqVO.getStatus());
}
result = list(lambdaQueryWrapper);
}
return result;
}
/**
* 新增修改
*

View File

@ -29,5 +29,21 @@
</where>
order by create_time desc
</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>

View File

@ -46,28 +46,52 @@
<result property="nowRepairId" column="now_repair_id" />
<result property="nowRepairName" column="now_repair_name" />
<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"/>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" columnPrefix="item_">
<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>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
</resultMap>
<sql id="Base_SQL">
@ -157,30 +181,9 @@
order by drt.create_time desc
</select>
<select id="getPageType" resultMap="BaseResultMap">
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
<select id="getPageType" resultMap="APPBaseResultMap">
select 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'
<if test="map.ticketNo != null and map.ticketNo != ''">
and (
@ -226,27 +229,32 @@
order by drt.create_time desc
</select>
<select id="getPageTypeAll" resultMap="BaseResultMap">
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
<select id="selectItemList" resultType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
select drti.id ,
drti.ticket_id ,
drti.item_name ,
drti.item_count ,
drti.item_unit ,
drti.item_price ,
drti.item_discount ,
drti.item_money ,
drti.repair_ids ,
drti.repair_names ,
drti.sale_id ,
drti.sale_name ,
drti.item_type ,
drti.project_id ,
drti.part_id ,
drti.other_id ,
drti.item_type_id ,
drti.item_status ,
drti.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
left join dl_repair_titem drti
on drt.id = drti.ticket_id AND drti.deleted = '0'
@ -277,6 +285,7 @@
</foreach>
)
</if>
GROUP BY drt.id
order by drt.create_time desc
</select>
</mapper>