管理员统计功能

This commit is contained in:
Vinjor 2024-11-18 18:04:46 +08:00
parent 7dc148e5b2
commit 17cd3db1ea
6 changed files with 158 additions and 0 deletions

View File

@ -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;
}

View File

@ -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<BaseRepairRecords> {
}

View File

@ -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<BaseRepairRecords> {
/**
* 保存维修记录
*
* @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);
}

View File

@ -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<BaseRepairRecordsMapper, BaseRepairRecords> 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);
}
}

View File

@ -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.entity.Tickets;
import cn.iocoder.yudao.module.tickets.mapper.TicketsMapper; 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 cn.iocoder.yudao.module.tickets.service.TicketsService;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -15,6 +17,8 @@ import java.util.List;
**/ **/
@Service @Service
public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> implements TicketsService { public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> implements TicketsService {
@Autowired
private BaseRepairRecordsService baseRepairRecordsService;
/** /**
* 更新工单状态为已结账 * 更新工单状态为已结账
@ -32,5 +36,9 @@ public class TicketsServiceImpl extends ServiceImpl<TicketsMapper, Tickets> impl
// 不在这儿结束 // 不在这儿结束
// .set(Tickets::getIsFinish, "1") // .set(Tickets::getIsFinish, "1")
); );
// 记录日志
if(!ticketIds.isEmpty()){
baseRepairRecordsService.saveRepairRecord(ticketIds.get(0), null, "js", "线上支付结算", null);
}
} }
} }

View File

@ -459,6 +459,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
repairOrderInfo.setOrderStatus("1"); repairOrderInfo.setOrderStatus("1");
} }
repairOrderInfoService.updateById(repairOrderInfo); repairOrderInfoService.updateById(repairOrderInfo);
// 记录日志
repairRecordsService.saveRepairRecord(one.getGoodsId(), null, RecordTypeEnum.JS.getCode(), "线下支付结算", null);
} }
/** /**