From 17cd3db1ea3b778876c3ee1873534b5877507ad1 Mon Sep 17 00:00:00 2001 From: Vinjor Date: Mon, 18 Nov 2024 18:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tickets/entity/BaseRepairRecords.java | 53 ++++++++++++++++++ .../mapper/BaseRepairRecordsMapper.java | 14 +++++ .../service/BaseRepairRecordsService.java | 26 +++++++++ .../impl/BaseRepairRecordsServiceImpl.java | 55 +++++++++++++++++++ .../service/impl/TicketsServiceImpl.java | 8 +++ .../impl/DlRepairTicketsServiceImpl.java | 2 + 6 files changed, 158 insertions(+) create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/BaseRepairRecords.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/mapper/BaseRepairRecordsMapper.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/BaseRepairRecordsService.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/BaseRepairRecordsServiceImpl.java diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/BaseRepairRecords.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/BaseRepairRecords.java new file mode 100644 index 00000000..01118bdc --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/entity/BaseRepairRecords.java @@ -0,0 +1,53 @@ +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.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 维修记录 DO + * + * @author lzt + */ +@TableName("dl_repair_records") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BaseRepairRecords extends TenantBaseDO { + + /** + * 主键标识 + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** + * 工单id + */ + private String ticketId; + /** + * 工单子表id + */ + private String repairItemId; + /** + * 记录类型(repair_records_type) + */ + private String type; + /** + * 记录描述 + */ + private String remark; + /** + * 处理人 + */ + private String dealUserName; + /** + * 处理人员工表id + */ + private Long dealUserId; + +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/mapper/BaseRepairRecordsMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/mapper/BaseRepairRecordsMapper.java new file mode 100644 index 00000000..90da3a52 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/mapper/BaseRepairRecordsMapper.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.tickets.mapper; + +import cn.iocoder.yudao.module.tickets.entity.BaseRepairRecords; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + * 维修记录 Mapper + * + * @author lzt + */ +@Mapper +public interface BaseRepairRecordsMapper extends BaseMapper { +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/BaseRepairRecordsService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/BaseRepairRecordsService.java new file mode 100644 index 00000000..1cc3a465 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/BaseRepairRecordsService.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.tickets.service; + +import cn.iocoder.yudao.module.tickets.entity.BaseRepairRecords; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * 维修记录 Service 接口 + * + * @author lzt + */ +public interface BaseRepairRecordsService extends IService { + + /** + * 保存维修记录 + * + * @param ticketId 工单id +// * @param repairItemId 工单子表id + * @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举) + * @param remark 备注 + * @param images 图片(相对路径按照“,”分隔) + * @author PQZ + * @date 14:51 2024/10/11 + **/ + void saveRepairRecord(String ticketId, String repairItemId, String type, String remark, String images); + +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/BaseRepairRecordsServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/BaseRepairRecordsServiceImpl.java new file mode 100644 index 00000000..dc793841 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/BaseRepairRecordsServiceImpl.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.tickets.service.impl; + +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; +import cn.iocoder.yudao.module.tickets.entity.BaseRepairRecords; +import cn.iocoder.yudao.module.tickets.mapper.BaseRepairRecordsMapper; +import cn.iocoder.yudao.module.tickets.service.BaseRepairRecordsService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 维修记录 Service 实现类 + * + * @author lzt + */ +@Service +@Validated +public class BaseRepairRecordsServiceImpl extends ServiceImpl implements BaseRepairRecordsService { + + @Resource + private AdminUserApi userApi; + + /** + * 保存维修记录 + * + * @param ticketId 工单id + * @param repairItemId 工单子表id + * @param type 工作类型(数据字典:repair_records_type;后端对应 RecordTypeEnum 枚举) + * @param remark 备注 + * @param images 图片(相对路径按照“,”分隔) + * @author PQZ + * @date 14:51 2024/10/11 + **/ + @Override + public void saveRepairRecord(String ticketId, String repairItemId, String type, String remark, String images) { + //获取当前登录用户 + Long userId = SecurityFrameworkUtils.getLoginUserId(); + AdminUserRespDTO loginUser = userApi.getUser(userId); + //初始化维修记录 + BaseRepairRecords repairRecords = new BaseRepairRecords(); + repairRecords.setTicketId(ticketId); + repairRecords.setRepairItemId(repairItemId); + repairRecords.setType(type); + repairRecords.setRemark(remark); + repairRecords.setDealUserId(loginUser.getId()); + repairRecords.setDealUserName(loginUser.getNickname()); + //保存维修记录 + save(repairRecords); + } + +} diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java index 59e73fd7..b6db061e 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/TicketsServiceImpl.java @@ -2,9 +2,11 @@ package cn.iocoder.yudao.module.tickets.service.impl; import cn.iocoder.yudao.module.tickets.entity.Tickets; import cn.iocoder.yudao.module.tickets.mapper.TicketsMapper; +import cn.iocoder.yudao.module.tickets.service.BaseRepairRecordsService; import cn.iocoder.yudao.module.tickets.service.TicketsService; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -15,6 +17,8 @@ import java.util.List; **/ @Service public class TicketsServiceImpl extends ServiceImpl implements TicketsService { + @Autowired + private BaseRepairRecordsService baseRepairRecordsService; /** * 更新工单状态为已结账 @@ -32,5 +36,9 @@ public class TicketsServiceImpl extends ServiceImpl impl // 不在这儿结束 // .set(Tickets::getIsFinish, "1") ); + // 记录日志 + if(!ticketIds.isEmpty()){ + baseRepairRecordsService.saveRepairRecord(ticketIds.get(0), null, "js", "线上支付结算", null); + } } } 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 58d68c60..9e7dfd25 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 @@ -459,6 +459,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl