diff --git a/dl-module-base/src/main/resources/mapper/baseType/BaseTypeMapper.xml b/dl-module-base/src/main/resources/mapper/baseType/BaseTypeMapper.xml index d2a4bb63..6c33c9c3 100644 --- a/dl-module-base/src/main/resources/mapper/baseType/BaseTypeMapper.xml +++ b/dl-module-base/src/main/resources/mapper/baseType/BaseTypeMapper.xml @@ -42,7 +42,7 @@ and dbt.type = #{map.type} - + and dbt.corp_id = #{map.corpId} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/order/admin/RepairOrderAPI.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/order/admin/RepairOrderAPI.java new file mode 100644 index 00000000..af4558b4 --- /dev/null +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/order/admin/RepairOrderAPI.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.app.order.admin; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; +import cn.iocoder.yudao.module.project.service.RepairOrderInfoService; +import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * 维修订单API + * + * @author 小李 + * @date 17:20 2024/9/23 +**/ +@RestController +@RequestMapping("/api/repair/order") +public class RepairOrderAPI { + + @Resource + @Lazy + private RepairOrderInfoService repairOrderInfoService; + + /** + * 订单分页查询 + * + * @author 小李 + * @date 17:35 2024/9/23 + * @param respVO 查询对象 + * @param pageNo 页码 + * @param pageSize 条数 + **/ + @GetMapping("/page") + @Operation(summary = "订单分页查询") + public CommonResult getOrderPageByStatus(RepairOrderInfoRespVO respVO, + @RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){ + Page page = new Page<>(pageNo, pageSize); + return success(repairOrderInfoService.getOrderPageByStatus(respVO, page)); + } + + /** + * 查询订单详情(包括工单) + * + * @author 小李 + * @date 17:43 2024/9/23 + * @param id 订单ID + **/ + @GetMapping("/get") + @Operation(summary = "查询订单详情") + public CommonResult getOrderById(@RequestParam(value = "id") String id){ + return success(repairOrderInfoService.getOrderById(id)); + } + + /** + * 评价订单 + * + * @author 小李 + * @date 17:50 2024/9/23 + * @param respVO 请求对象 + **/ + @PostMapping("/appraise") + @Operation(summary = "评价订单") + public CommonResult appraiseOrder(@RequestBody RepairOrderInfoRespVO respVO){ + repairOrderInfoService.appraiseOrder(respVO); + return CommonResult.ok(); + } +} diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/admin/TicketsAPI.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/admin/TicketsAPI.java index 94ed02a3..ccf7f855 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/admin/TicketsAPI.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/app/tickets/admin/TicketsAPI.java @@ -1,13 +1,12 @@ package cn.iocoder.yudao.module.app.tickets.admin; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsReqVO; -import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; -import org.springframework.web.bind.annotation.*; +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; @@ -28,38 +27,6 @@ public class TicketsAPI { @Resource private DlRepairTicketsService dlRepairTicketsService; - /** - * 维修工单表 评价 - * - * @author 小李 - * @date 10:54 2024/9/23 - * @param repairTicketsRespVO 对象 - **/ - @PostMapping("/appraise") - @Operation(summary = "维修工单表 评价") - public CommonResult setAppraise(@RequestBody DlRepairTicketsRespVO repairTicketsRespVO){ - dlRepairTicketsService.setAppraise(repairTicketsRespVO); - return CommonResult.ok(); - } - - /** - * 维修工单表 按用户的id查 - * - * @author 小李 - * @date 11:37 2024/9/23 - * @param repairTicketsReqVO 查询对象 - * @param pageNo 页码 - * @param pageSize 条数 - **/ - @GetMapping("/page") - @Operation(summary = "维修工单表 按用户的id查") - public CommonResult getTicketsPageById(DlRepairTicketsReqVO repairTicketsReqVO, - @RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){ - Page page = new Page<>(pageNo, pageSize); - return success(dlRepairTicketsService.getTicketsPage(repairTicketsReqVO, page)); - } - /** * 维修工单表 查看一个工单的详细信息 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairOrderInfoMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairOrderInfoMapper.java index 51f5f77a..aafcb3fb 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairOrderInfoMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/mapper/RepairOrderInfoMapper.java @@ -29,4 +29,12 @@ public interface RepairOrderInfoMapper extends BaseMapper { IPage queryListPage(@Param("entity") RepairOrderInfoPageReqVO entity, Page page); + /** + * 订单分页查询 + * + * @author 小李 + * @date 17:35 2024/9/23 + * @param respVO 查询对象 + **/ + IPage getOrderPageByStatus(@Param("map") RepairOrderInfoRespVO respVO, Page page); } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairOrderInfoService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairOrderInfoService.java index 7f18e2d6..d0b193e1 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairOrderInfoService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/RepairOrderInfoService.java @@ -60,5 +60,30 @@ public interface RepairOrderInfoService extends IService { **/ IPage queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page page); + /** + * 订单分页查询 + * + * @author 小李 + * @date 17:35 2024/9/23 + * @param respVO 查询对象 + **/ + IPage getOrderPageByStatus(RepairOrderInfoRespVO respVO, Page page); + /** + * 查询订单详情(包括工单) + * + * @author 小李 + * @date 17:43 2024/9/23 + * @param id 订单ID + **/ + RepairOrderInfoRespVO getOrderById(String id); + + /** + * 评价订单 + * + * @author 小李 + * @date 17:50 2024/9/23 + * @param respVO 请求对象 + **/ + void appraiseOrder(RepairOrderInfoRespVO respVO); } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairOrderInfoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairOrderInfoServiceImpl.java index 73501cb1..ab118ada 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairOrderInfoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/service/impl/RepairOrderInfoServiceImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.project.service.impl; +import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; @@ -8,13 +9,18 @@ import cn.iocoder.yudao.module.project.service.RepairOrderInfoService; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO; +import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; +import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; 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.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.time.LocalDateTime; /** * 维修模块 订单 Service 实现类 @@ -28,6 +34,9 @@ public class RepairOrderInfoServiceImpl extends ServiceImpl getOrderPageByStatus(RepairOrderInfoRespVO respVO, Page page){ + return baseMapper.getOrderPageByStatus(respVO, page); + } + + /** + * 查询订单详情(包括工单) + * + * @author 小李 + * @date 17:43 2024/9/23 + * @param id 订单ID + **/ + @Override + public RepairOrderInfoRespVO getOrderById(String id){ + // 查订单信息 + RepairOrderInfo repairOrderInfo = baseMapper.selectById(id); + return BeanUtils.toBean(repairOrderInfo, RepairOrderInfoRespVO.class); + + } + + /** + * 评价订单 + * + * @author 小李 + * @date 17:50 2024/9/23 + * @param respVO 请求对象 + **/ + @Override + public void appraiseOrder(RepairOrderInfoRespVO respVO){ + // 没有评价内容就给默认评价内容 + if (ObjectUtil.isEmpty(respVO.getCommentDesc())){ + respVO.setCommentDesc("没有填写文本"); + } + // 没有评分就给默认评分 + if (ObjectUtil.isEmpty(respVO.getCommentStar())){ + respVO.setCommentStar(5); + } + respVO.setCommentTime(LocalDateTime.now()); + baseMapper.updateById(respVO); + } + } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairOrderInfoRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairOrderInfoRespVO.java index ec109163..93496159 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairOrderInfoRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/project/vo/RepairOrderInfoRespVO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.project.vo; import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; +import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -14,5 +15,10 @@ import com.alibaba.excel.annotation.*; @ExcelIgnoreUnannotated public class RepairOrderInfoRespVO extends RepairOrderInfo { + /** 订单状态(工单的状态) */ + private String status; + + /** 工单信息(包含子表) */ + private DlRepairTicketsRespVO tickets; } \ No newline at end of file diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java index 6728bc42..eca56066 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/entity/DlRepairTickets.java @@ -175,13 +175,4 @@ public class DlRepairTickets extends TenantBaseDO { /** 工单进行状态 */ private String ticketsWorkStatus; - - /** 评价 */ - private String appraise; - - /** 是否已评价 */ - private String isAppraise; - - /** 评分 */ - private Integer appraiseScope; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java index 76fa47c9..c863452f 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/DlRepairTicketsService.java @@ -59,13 +59,4 @@ public interface DlRepairTicketsService extends IService { * @param repairTicketsRespVO 工单 **/ void setTicketsPaid(DlRepairTicketsRespVO repairTicketsRespVO); - - /** - * 维修工单表 评价 - * - * @author 小李 - * @date 10:54 2024/9/23 - * @param repairTicketsRespVO 对象 - **/ - void setAppraise(DlRepairTicketsRespVO repairTicketsRespVO); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java index 6550898c..a670d553 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlRepairTicketsServiceImpl.java @@ -5,14 +5,22 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.common.RepairErrorCodeConstants; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.custom.service.CustomerMainService; +import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; import cn.iocoder.yudao.module.other.entity.DlRepairOther; import cn.iocoder.yudao.module.other.service.DlRepairOtherService; +import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; import cn.iocoder.yudao.module.project.entity.RepairProject; import cn.iocoder.yudao.module.project.entity.RepairWares; +import cn.iocoder.yudao.module.project.service.RepairOrderInfoService; import cn.iocoder.yudao.module.project.service.RepairProjectService; import cn.iocoder.yudao.module.project.service.RepairWaresService; +import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets; import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem; import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper; @@ -26,12 +34,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -62,6 +72,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl items = itemList.stream().map(item -> BeanUtil.toBean(item, DlRepairTitemReqVO.class)).collect(Collectors.toList()); // 取项目 List projects = items.stream().filter(item -> item.getItemType().equals("01")).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(projects)){ + if (CollectionUtil.isNotEmpty(projects)) { Set ids = projects.stream().map(DlRepairTitemReqVO::getProjectId).collect(Collectors.toSet()); List repairProjects = projectService.listByIds(ids); items.forEach(item -> repairProjects.stream().filter(i -> i.getId().equals(item.getProjectId())).findFirst().ifPresent(item::setProject)); @@ -143,14 +190,14 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl wares = items.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(wares)){ + if (CollectionUtil.isNotEmpty(wares)) { Set ids = wares.stream().map(DlRepairTitemReqVO::getPartId).collect(Collectors.toSet()); List repairWares = waresService.listByIds(ids); items.forEach(item -> repairWares.stream().filter(i -> i.getId().equals(item.getPartId())).findFirst().ifPresent(item::setWare)); } // 取附加 List others = items.stream().filter(item -> item.getItemType().equals("03")).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(others)){ + if (CollectionUtil.isNotEmpty(others)) { Set ids = others.stream().map(DlRepairTitemReqVO::getOtherId).collect(Collectors.toSet()); List dlRepairOthers = otherService.listByIds(ids); items.forEach(item -> dlRepairOthers.stream().filter(i -> i.getId().equals(item.getOtherId())).findFirst().ifPresent(item::setOther)); @@ -162,45 +209,24 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl + + \ No newline at end of file diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml index ea0177fc..24e838f9 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlRepairTicketsMapper.xml @@ -42,8 +42,6 @@ - - @@ -83,9 +81,7 @@ cost, profit, part_status, - tickets_work_status, - appraise, - appraise_scope + tickets_work_status from dl_repair_tickets drt where drt.deleted = '0' @@ -123,9 +119,6 @@ and drt.user_id = #{map.userId} - - and drt.is_appraise = #{map.isAppraise} - and drt.tickets_work_status = #{map.ticketsWorkStatus}