维修流程日志+维修流程紧急状态流程添加

master
sunjianxi 12 months ago
parent 3d22d94f39
commit 549c49dc3f
  1. 31
      src/main/java/org/springblade/common/utils/ApplicationContextUtil.java
  2. 70
      src/main/java/org/springblade/common/utils/LogUtil.java
  3. 9
      src/main/java/org/springblade/modules/business/contraller/MaintenanceController.java
  4. 181
      src/main/java/org/springblade/modules/business/contraller/WorkOrderController.java
  5. 70
      src/main/java/org/springblade/modules/business/contraller/WorkOrderLogController.java
  6. 60
      src/main/java/org/springblade/modules/business/enums/WorkOrderStatusEnum.java
  7. 5
      src/main/java/org/springblade/modules/business/mapper/MaintenanceTaskDetailMapper.java
  8. 18
      src/main/java/org/springblade/modules/business/mapper/MaintenanceTaskDetailMapper.xml
  9. 25
      src/main/java/org/springblade/modules/business/mapper/WorkOrderLogMapper.java
  10. 9
      src/main/java/org/springblade/modules/business/mapper/WorkOrderLogMapper.xml
  11. 6
      src/main/java/org/springblade/modules/business/pojo/entity/maintenance/MaintenanceTaskDetail.java
  12. 5
      src/main/java/org/springblade/modules/business/pojo/entity/workorder/WorkOrder.java
  13. 35
      src/main/java/org/springblade/modules/business/pojo/entity/workorder/WorkOrderLog.java
  14. 4
      src/main/java/org/springblade/modules/business/service/IMaintenanceTaskDetailService.java
  15. 21
      src/main/java/org/springblade/modules/business/service/IWorkOrderLogService.java
  16. 6
      src/main/java/org/springblade/modules/business/service/impl/MaintenanceTaskDetailServiceImpl.java
  17. 49
      src/main/java/org/springblade/modules/business/service/impl/WorkOrderLogServiceImpl.java
  18. 33
      src/main/java/org/springblade/modules/business/service/impl/WorkOrderServiceImpl.java

@ -0,0 +1,31 @@
package org.springblade.common.utils;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextUtil implements ApplicationContextAware {
private static ApplicationContext context;
private ApplicationContextUtil() {
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ApplicationContextUtil.setContext(applicationContext);
}
public static <T> T getBean(Class<T> t) {
return context.getBean(t);
}
public static Object getBean(String name) {
return context.getBean(name);
}
public static void setContext(ApplicationContext context) {
ApplicationContextUtil.context = context;
}
}

@ -0,0 +1,70 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.common.utils;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrderLog;
import org.springblade.modules.business.service.IWorkOrderLogService;
import org.springblade.modules.business.service.IWorkOrderService;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Base64;
/**
* 通用工具类
*
* @author Chill
*/
public class LogUtil {
/**
* 二维码生成转base64
* @param content
* @return
* @throws WriterException
* @throws IOException
*/
public static void saveLog(String code,String content){
IWorkOrderLogService workOrderLogService = ApplicationContextUtil.getBean(IWorkOrderLogService.class);
WorkOrderLog log = new WorkOrderLog();
log.setCode(code);
log.setContent(content);
log.setCreateTime(DateUtil.now());
log.setStatus(0);
log.setIsDeleted(0);
workOrderLogService.save(log);
}
}

@ -9,6 +9,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -408,4 +409,12 @@ public class MaintenanceController extends BladeController {
} }
/*---------- 维修方案结束 ----------*/ /*---------- 维修方案结束 ----------*/
@GetMapping("/find-list-by-device-id")
@Operation(summary = "根据设备id查询维保明细", description = "根据设备id查询维保明细")
public R<List<MaintenanceTaskDetail>> planPage(@RequestParam Long deviceId) {
List<MaintenanceTaskDetail> list = taskDetailService.findListByDeviceId(deviceId);
return R.data(list);
}
} }

@ -4,15 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.mysql.cj.log.Log;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject; import org.json.JSONObject;
import org.springblade.common.cache.DeptCache; import org.springblade.common.cache.DeptCache;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.common.utils.LogUtil;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
@ -234,20 +238,29 @@ public class WorkOrderController extends BladeController {
User repairPerson = userService.getById(workOrder.getRepairPerson()); User repairPerson = userService.getById(workOrder.getRepairPerson());
messageService.saveMessage(workOrder.getRequirementCode(), "您已接收新的维修单,请尽快处理", repairPerson.getId(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "您已接收新的维修单,请尽快处理", repairPerson.getId(), 2);
// todo 审核通过 // todo 审核通过
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KF_ORDER_ALLOT.getName());
return R.success(""); return R.success("");
} }
/** /**
* 维修人员接收工单 * 维修人员接收工单
*/ */
@ApiLog(value = "提报管理-维修人员接收工单") @ApiLog(value = "提报管理-维修人员接收工单")
@PostMapping("/serviceman-receive") @PostMapping("/serviceman-receive")
public R serviceReceive(@RequestBody WorkOrder workOrder) { public R serviceReceive(@RequestBody WorkOrder workOrder) {
WorkOrder workOrderOld = workOrderService.getById(workOrder.getId()); WorkOrder workOrderOld = workOrderService.getById(workOrder.getId());
workOrderOld.setReceiveOrderTime(DateUtil.now()); workOrderOld.setReceiveOrderTime(DateUtil.now());
workOrderOld.setStatus(WorkOrderStatusEnum.WX_ORDER_ACCEPT.getValue()); if(workOrderOld.getRepairType().equals(1)){
workOrderService.updateById(workOrderOld); workOrderOld.setStatus(WorkOrderStatusEnum.WX_EMERGENCY_ORDER_ACCEPT.getValue());
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_EMERGENCY_ORDER_ACCEPT.getName());
}else{
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_ORDER_ACCEPT.getName());
workOrderOld.setStatus(WorkOrderStatusEnum.WX_ORDER_ACCEPT.getValue());
}
workOrderService.updateById(workOrderOld);
// todo 审核通过 // todo 审核通过
@ -268,8 +281,9 @@ public class WorkOrderController extends BladeController {
WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.FALSE_STR, DateUtil.now(), workOrder.getRepaiRejectReason()); WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.FALSE_STR, DateUtil.now(), workOrder.getRepaiRejectReason());
approvalService.save(approval); approvalService.save(approval);
// todo 审核拒绝 // todo 审核拒绝
//保存日志
return R.success(""); LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_ORDER_REFUSE.getName());
return R.success("");
} }
/** /**
@ -300,8 +314,12 @@ public class WorkOrderController extends BladeController {
WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.TRUE_STR, DateUtil.now(), workOrder.getApproveRemark()); WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.TRUE_STR, DateUtil.now(), workOrder.getApproveRemark());
approvalService.save(approval); approvalService.save(approval);
messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已提交,请确认", workOrder.getInformant(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已提交,请确认", workOrder.getInformant(), 2);
return R.success("");
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.ZG_REPAIR_PLAN_PASS.getName());
return R.success("");
} }
/** /**
@ -334,8 +352,10 @@ public class WorkOrderController extends BladeController {
approvalService.save(approval); approvalService.save(approval);
messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已通过,请尽快维修", workOrder.getRepairPerson(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已通过,请尽快维修", workOrder.getRepairPerson(), 2);
// todo 审核通过 // todo 审核通过
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KH_REPAIR_PLAN_PASS.getName());
return R.success(""); return R.success("");
} }
/** /**
@ -359,21 +379,31 @@ public class WorkOrderController extends BladeController {
User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getRoleId, role)); User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getRoleId, role));
messageService.saveMessage(workOrder.getRequirementCode(), "审批方案已驳回,请重新修改", user.getId(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "审批方案已驳回,请重新修改", user.getId(), 2);
// todo 审核通过 // todo 审核通过
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KH_REPAIR_PLAN_REFUSE.getName());
return R.success(""); return R.success("");
} }
/** /**
* 维修人员提交维修结果 * 维修人员提交维修结果
*/ */
@ApiLog(value = "提报管理-维修人员提交维修结果") @ApiLog(value = "提报管理-维修人员提交维修结果")
@PostMapping("/serviceman-repair-submit") @PostMapping("/serviceman-repair-submit")
public R servicemanRepairSubmit(@RequestBody WorkOrder workOrder) { public R servicemanRepairSubmit(@RequestBody WorkOrder workOrder) {
WorkOrder workOrderOld = workOrderService.getById(workOrder.getId()); WorkOrder workOrderOld = workOrderService.getById(workOrder.getId());
workOrderOld.setCloseReason(workOrder.getCloseReason()); workOrderOld.setCloseReason(workOrder.getCloseReason());
workOrderOld.setStatus(WorkOrderStatusEnum.WX_REPAIR_FINISH.getValue()); if(workOrderOld.getRepairType().equals(1)){
workOrderService.updateById(workOrderOld); workOrderOld.setStatus(WorkOrderStatusEnum.WX_EMERGENCY_REPAIR_FINISH.getValue());
messageService.saveMessage(workOrder.getRequirementCode(), "维修已完成,请确认是否解决", workOrder.getInformant(), 2); //保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_EMERGENCY_REPAIR_FINISH.getName());
}else{
workOrderOld.setStatus(WorkOrderStatusEnum.WX_REPAIR_FINISH.getValue());
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_REPAIR_FINISH.getName());
}
workOrderService.updateById(workOrderOld);
messageService.saveMessage(workOrder.getRequirementCode(), "维修已完成,请确认是否解决", workOrder.getInformant(), 2);
// todo 审核通过 // todo 审核通过
@ -410,8 +440,10 @@ public class WorkOrderController extends BladeController {
approvalService.save(approval); approvalService.save(approval);
messageService.saveMessage(workOrder.getRequirementCode(), "客户认为维修未完成,请尽快再次解决", workOrder.getRepairPerson(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "客户认为维修未完成,请尽快再次解决", workOrder.getRepairPerson(), 2);
// todo 审核通过 // todo 审核通过
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),"维修完成,客户审核未通过");
return R.success(""); return R.success("");
} }
/** /**
@ -425,7 +457,8 @@ public class WorkOrderController extends BladeController {
workOrderOld.setStatus(WorkOrderStatusEnum.KF_REPAIR_FINISH.getValue()); workOrderOld.setStatus(WorkOrderStatusEnum.KF_REPAIR_FINISH.getValue());
workOrderService.updateById(workOrderOld); workOrderService.updateById(workOrderOld);
User customer = userService.getById(workOrder.getInformant()); User customer = userService.getById(workOrder.getInformant());
messageService.saveMessage(workOrder.getRequirementCode(), "请注意维修单评价", customer.getId(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "请注意维修单评价", customer.getId(), 2);
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KF_REPAIR_FINISH.getName());
return R.success(""); return R.success("");
} }
@ -439,8 +472,9 @@ public class WorkOrderController extends BladeController {
workOrderOld.setCloseReason(workOrder.getCloseReason()); workOrderOld.setCloseReason(workOrder.getCloseReason());
workOrderOld.setStatus(WorkOrderStatusEnum.KF_ORDER_CLOSE.getValue()); workOrderOld.setStatus(WorkOrderStatusEnum.KF_ORDER_CLOSE.getValue());
workOrderService.updateById(workOrderOld); workOrderService.updateById(workOrderOld);
//保存日志
return R.success(""); LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KF_ORDER_CLOSE.getName());
return R.success("");
} }
/** /**
@ -505,15 +539,76 @@ public class WorkOrderController extends BladeController {
URLConnection httpConnection = url.openConnection(); URLConnection httpConnection = url.openConnection();
httpConnection.connect(); httpConnection.connect();
InputStreamReader isr = new InputStreamReader(httpConnection.getInputStream()); InputStreamReader isr = new InputStreamReader(httpConnection.getInputStream());
BufferedReader reader = new BufferedReader(isr); BufferedReader reader = new BufferedReader(isr);
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
buffer.append(line); buffer.append(line);
} }
reader.close(); reader.close();
isr.close(); isr.close();
return buffer.toString(); return buffer.toString();
} }
/**
* 根据设备id查询工作订单列表
*
* @return 返回工作订单列表的响应对象
*/
@GetMapping("/find-list-by-device-id")
public R<List<WorkOrder>> findListByDeviceId(Long deviceId) {
List<WorkOrder> list = workOrderService.list(Wrappers.lambdaQuery(WorkOrder.class).eq(WorkOrder::getDeviceId,deviceId).eq(BaseEntity::getIsDeleted,0));
return R.data(list);
}
/**
* 评价签字
*/
@ApiLog(value = "提报管理-紧急维修客户确认维修效果")
@PostMapping("/customer-emergency-repair-confirm")
public R customerEmergencyRepairConfirm(@RequestBody WorkOrder workOrder) {
WorkOrder workOrderOld = workOrderService.getById(workOrder.getId());
workOrderOld.setApprovePoint("客户审批维修结果");
workOrderOld.setApprovePerson(workOrder.getApprovePerson());
workOrderOld.setApproveResult(workOrder.getApproveResult());
workOrderOld.setApproveTime(workOrder.getApproveTime());
workOrderOld.setApproveRemark(workOrder.getApproveRemark());
workOrderOld.setStatus(WorkOrderStatusEnum.KH_REPAIR_CONFIRM.getValue());
workOrderService.updateById(workOrderOld);
WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.TRUE_STR, DateUtil.now(), workOrder.getApproveRemark());
approvalService.save(approval);
// todo 审核通过
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KH_REPAIR_CONFIRM.getName());
return R.success("");
}
/**
* 紧急维修客户确认效果驳回
*/
@ApiLog(value = "提报管理-紧急维修,客户确认效果驳回")
@PostMapping("/customer-emergency-repair-reject")
public R customerEmergencyRepairReject(@RequestBody WorkOrder workOrder) {
WorkOrder workOrderOld = workOrderService.getById(workOrder.getId());
workOrderOld.setApprovePoint("客户审批维修结果");
workOrderOld.setApprovePerson(workOrder.getApprovePerson());
workOrderOld.setApproveResult(workOrder.getApproveResult());
workOrderOld.setApproveTime(workOrder.getApproveTime());
workOrderOld.setApproveRemark(workOrder.getApproveRemark());
workOrderOld.setStatus(WorkOrderStatusEnum.WX_EMERGENCY_ORDER_ACCEPT.getValue());
workOrderService.updateById(workOrderOld);
WorkOrderApproval approval = new WorkOrderApproval(workOrder.getId(), AuthUtil.getUserId(), CommonConstant.FALSE_STR, DateUtil.now(), workOrder.getApproveRemark());
approvalService.save(approval);
// todo 审核通过
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.WX_EMERGENCY_ORDER_ACCEPT.getName());
return R.success("");
}
} }

@ -0,0 +1,70 @@
package org.springblade.modules.business.contraller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject;
import org.springblade.common.cache.DeptCache;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.utils.LogUtil;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.business.enums.WorkOrderStatusEnum;
import org.springblade.modules.business.pojo.dto.workorder.WorkOrderDTO;
import org.springblade.modules.business.pojo.entity.DeviceMaintenance;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrderApproval;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrderLog;
import org.springblade.modules.business.pojo.vo.workorder.WorkOrderVO;
import org.springblade.modules.business.service.IWorkOrderApprovalService;
import org.springblade.modules.business.service.IWorkOrderFlowService;
import org.springblade.modules.business.service.IWorkOrderLogService;
import org.springblade.modules.business.service.IWorkOrderService;
import org.springblade.modules.system.pojo.entity.Dept;
import org.springframework.web.bind.annotation.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 工单表 控制器
*
* @author BladeX
* @since 2024-10-14
*/
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(CommonConstant.APPLICATION_PROJECT + "/work-order-log")
public class WorkOrderLogController extends BladeController {
private final IWorkOrderLogService workOrderLogService;
/**
* 工单列表
*/
@GetMapping("/find-list-by-code")
public R<List<WorkOrderLog>> findListByCode(String code) {
List<WorkOrderLog> list = workOrderLogService.list(Wrappers.lambdaQuery(WorkOrderLog.class).eq(WorkOrderLog::getCode,code).eq(BaseEntity::getIsDeleted,0));
return R.data(list);
}
}

@ -16,59 +16,65 @@ public enum WorkOrderStatusEnum {
/** /**
* 草稿 * 草稿
*/ */
KH_ORDER_DRAFT(100), KH_ORDER_DRAFT(100,"草稿"),
/** /**
* 客户提交 待客服处理 * 客户提交 待客服处理
*/ */
KH_ORDER_SUBMIT(101), KH_ORDER_SUBMIT(101,"客户提交,待客服处理"),
/** /**
* 客户维修方案审核拒绝待主管审核 * 客户维修方案审核拒绝待主管审核
*/ */
KH_REPAIR_PLAN_REFUSE(102), KH_REPAIR_PLAN_REFUSE(102,"客户维修方案审核拒绝,待主管审核"),
/** /**
* 客户维修方案审批通过 维修中 * 客户维修方案审批通过 维修中
*/ */
KH_REPAIR_PLAN_PASS(103), KH_REPAIR_PLAN_PASS(103,"客户维修方案审批通过, 维修中"),
/** /**
* 评价完成待客服确认付款 * 评价完成待客服确认付款
*/ */
KH_EVALUATE_FINISH(104), KH_EVALUATE_FINISH(104,"评价完成,待客服确认付款"),
/**
* 客户确认维修效果
*/
KH_REPAIR_CONFIRM(105,"客户确认维修效果"),
// ---------------------------------- 客服状态以2开头 // ---------------------------------- 客服状态以2开头
/** /**
* 客服电话接单创建工单 * 客服电话接单创建工单
*/ */
KF_ORDER_DRAFT(200), KF_ORDER_DRAFT(200,"客服电话接单创建工单"),
/** /**
* 客服电话提交工单 * 客服电话提交工单
*/ */
KF_ORDER_SUBMIT(205), KF_ORDER_SUBMIT(205,"客服电话提交工单"),
/** /**
* 客服并分配维修人员 * 客服接单并分配维修人员
*/ */
KF_ORDER_ALLOT(201), KF_ORDER_ALLOT(201,"客服接单并分配维修人员"),
/** /**
* 客服沟通后关闭工单 * 客服沟通后关闭工单
*/ */
KF_REPAIR_FINISH(202), KF_REPAIR_FINISH(202,"客服沟通后关闭工单"),
/** /**
* 工单关闭 * 工单关闭
*/ */
KF_ORDER_CLOSE(203), KF_ORDER_CLOSE(203,"工单关闭"),
/** /**
* 已开发票 * 已开发票
*/ */
KF_TICKET_FINISH(204), KF_TICKET_FINISH(204,"已开发票"),
@ -76,35 +82,53 @@ public enum WorkOrderStatusEnum {
/** /**
* 主管审核拒绝待提交维修方案 * 主管审核拒绝待提交维修方案
*/ */
ZG_REPAIR_PLAN_REFUSE(300), ZG_REPAIR_PLAN_REFUSE(300,"主管审核拒绝,待提交维修方案"),
/** /**
* 主管审批通过待客户审批 * 主管审批通过待客户审批
*/ */
ZG_REPAIR_PLAN_PASS(301), ZG_REPAIR_PLAN_PASS(301,"主管审批通过,待客户审批"),
// ---------------------------------- 维修人员以4开头 // ---------------------------------- 维修人员以4开头
/** /**
* 维修人员拒绝工单 待客服处理 * 维修人员拒绝工单 待客服处理
*/ */
WX_ORDER_REFUSE(400), WX_ORDER_REFUSE(400,"维修人员拒绝工单, 待客服处理"),
/** /**
* 维修人员接收工单待提交维修方案 * 维修人员接收工单待提交维修方案
*/ */
WX_ORDER_ACCEPT(401), WX_ORDER_ACCEPT(401,"维修人员接收工单,待提交维修方案"),
/** /**
* 维修人员提交维修方案待主管审批 * 维修人员提交维修方案待主管审批
*/ */
WX_REPAIR_PLAN_SUBMIT(402), WX_REPAIR_PLAN_SUBMIT(402,"维修人员提交维修方案,待主管审批"),
/** /**
* 维修人员提交维修完成待评价 * 维修人员提交维修完成待评价
*/ */
WX_REPAIR_FINISH(403), WX_REPAIR_FINISH(403,"维修人员提交维修完成,待评价"),
/**
* 维修人员接收工单,现场维修
*/
WX_EMERGENCY_ORDER_ACCEPT(404,"维修人员接收工单,现场维修"),
/**
* 维修人员紧急维修提交维修完成
*/
WX_EMERGENCY_REPAIR_FINISH(405,"维修人员紧急维修提交维修完成"),
/**
* 维修人员补填维修方案
*/
WX_REPAIR_PLAN_SUBMIT_AFTER(406,"维修人员补填维修方案"),
; ;
final int value; final int value;
final String name;
} }

@ -2,8 +2,11 @@
package org.springblade.modules.business.mapper; package org.springblade.modules.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail; import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail;
import java.util.List;
/** /**
* 维保任务详情 Mapper 接口 * 维保任务详情 Mapper 接口
* *
@ -12,4 +15,6 @@ import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskD
*/ */
public interface MaintenanceTaskDetailMapper extends BaseMapper<MaintenanceTaskDetail> { public interface MaintenanceTaskDetailMapper extends BaseMapper<MaintenanceTaskDetail> {
List<MaintenanceTaskDetail> findListByDeviceId(@Param("deviceId")Long deviceId);
} }

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace = "org.springblade.modules.business.mapper.MaintenanceTaskDetailMapper">
<select id="findListByDeviceId" resultType="org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail">
SELECT
a.*,
b.task_code,
b.serviceman_name
FROM
lab_maintenance_task_detail a
LEFT JOIN lab_maintenance_task b ON a.task_id = b.id
WHERE
a.is_deleted = 0
AND a.device_id = #{deviceId}
</select>
</mapper>

@ -0,0 +1,25 @@
package org.springblade.modules.business.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.business.excel.workorder.WorkOrderExcel;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrderLog;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.business.pojo.vo.workorder.WorkOrderVO;
import java.util.List;
/**
* 工单表 Mapper 接口
*
* @author BladeX
* @since 2024-10-14
*/
public interface WorkOrderLogMapper extends BaseMapper<WorkOrderLog> {
}

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.business.mapper.WorkOrderLogMapper">
<!-- 通用查询映射结果 -->
<resultMap id="workOrderLogResultMap" type="org.springblade.modules.business.pojo.entity.workorder.WorkOrderLog">
</resultMap>
</mapper>

@ -114,4 +114,10 @@ public class MaintenanceTaskDetail extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private List<MaintenanceTaskDetailGoods> detailGoodsList; private List<MaintenanceTaskDetailGoods> detailGoodsList;
@TableField(exist = false)
private String taskCode;
@TableField(exist = false)
private String servicemanName;
} }

@ -233,4 +233,9 @@ public class WorkOrder extends BaseEntity {
*/ */
private Double discountPrice; private Double discountPrice;
/**
* 维修类型 1紧急维修 2故障维修 3改造需求
*/
private Integer repairType;
} }

@ -0,0 +1,35 @@
package org.springblade.modules.business.pojo.entity.workorder;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.util.Date;
/**
* 工单日志表 实体类
*
* @author BladeX
* @since 2024-10-14
*/
@Data
@TableName("lab_work_order_log")
@EqualsAndHashCode(callSuper = true)
public class WorkOrderLog extends BaseEntity {
/**
* 需求单号
*/
private String code;
/**
* 备注
*/
private String content;
}

@ -3,6 +3,8 @@ package org.springblade.modules.business.service;
import org.springblade.core.mp.base.BaseService; import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail; import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskDetail;
import java.util.List;
/** /**
* 维保任务详情 服务类 * 维保任务详情 服务类
* *
@ -10,5 +12,5 @@ import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskD
* @since 2024-10-14 * @since 2024-10-14
*/ */
public interface IMaintenanceTaskDetailService extends BaseService<MaintenanceTaskDetail> { public interface IMaintenanceTaskDetailService extends BaseService<MaintenanceTaskDetail> {
List<MaintenanceTaskDetail> findListByDeviceId(Long deviceId);
} }

@ -0,0 +1,21 @@
package org.springblade.modules.business.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.business.pojo.entity.maintenance.MaintenancePersonnel;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrder;
import org.springblade.modules.business.pojo.entity.workorder.WorkOrderLog;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.business.pojo.vo.workorder.WorkOrderVO;
import java.util.List;
/**
* 工单日志表 服务类
*
* @author BladeX
* @since 2024-10-14
*/
public interface IWorkOrderLogService extends BaseService<WorkOrderLog> {
}

@ -7,6 +7,8 @@ import org.springblade.modules.business.pojo.entity.maintenance.MaintenanceTaskD
import org.springblade.modules.business.service.IMaintenanceTaskDetailService; import org.springblade.modules.business.service.IMaintenanceTaskDetailService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 巡检任务详情 服务实现类 * 巡检任务详情 服务实现类
* *
@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<MaintenanceTaskDetailMapper, MaintenanceTaskDetail> implements IMaintenanceTaskDetailService { public class MaintenanceTaskDetailServiceImpl extends BaseServiceImpl<MaintenanceTaskDetailMapper, MaintenanceTaskDetail> implements IMaintenanceTaskDetailService {
@Override
public List<MaintenanceTaskDetail> findListByDeviceId(Long deviceId) {
return baseMapper.findListByDeviceId(deviceId);
}
} }

@ -0,0 +1,49 @@
package org.springblade.modules.business.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.Synchronized;
import org.apache.commons.collections.CollectionUtils;
import org.springblade.common.cache.DictBizCache;
import org.springblade.common.cache.SysCache;
import org.springblade.common.cache.UserCache;
import org.springblade.common.constant.CommonConstant;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringPool;
import org.springblade.modules.business.enums.WorkOrderStatusEnum;
import org.springblade.modules.business.mapper.WorkOrderLogMapper;
import org.springblade.modules.business.mapper.WorkOrderMapper;
import org.springblade.modules.business.pojo.entity.maintenance.MaintenancePersonnel;
import org.springblade.modules.business.pojo.entity.workorder.*;
import org.springblade.modules.business.pojo.vo.PieStatVO;
import org.springblade.modules.business.pojo.vo.workorder.WorkOrderVO;
import org.springblade.modules.business.service.*;
import org.springblade.modules.system.pojo.entity.Dept;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
import static org.springblade.common.enums.DictBizEnum.GOODS_TYPE;
/**
* 工单表 服务实现类
*
* @author BladeX
* @since 2024-10-14
*/
@Service
@AllArgsConstructor
public class WorkOrderLogServiceImpl extends BaseServiceImpl<WorkOrderLogMapper, WorkOrderLog> implements IWorkOrderLogService {
}

@ -11,8 +11,10 @@ import org.springblade.common.cache.DictBizCache;
import org.springblade.common.cache.SysCache; import org.springblade.common.cache.SysCache;
import org.springblade.common.cache.UserCache; import org.springblade.common.cache.UserCache;
import org.springblade.common.constant.CommonConstant; import org.springblade.common.constant.CommonConstant;
import org.springblade.common.utils.LogUtil;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
@ -148,6 +150,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
count++; count++;
// 保存附件 // 保存附件
saveFiles(workOrder.getVideoAttaches(), workOrder.getPicAttaches(), workOrder.getId()); saveFiles(workOrder.getVideoAttaches(), workOrder.getPicAttaches(), workOrder.getId());
//保存日志
LogUtil.saveLog(workOrder.getRequirementCode(),user.getName()+"提交,待客服处理。");
} }
return save; return save;
} }
@ -261,15 +265,23 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
public void repairPlanSubmit(WorkOrder workOrder) { public void repairPlanSubmit(WorkOrder workOrder) {
// 修改工单状态 // 修改工单状态
WorkOrder workOrderOld = this.getById(workOrder.getId()); WorkOrder workOrderOld = this.getById(workOrder.getId());
workOrderOld.setStatus(WorkOrderStatusEnum.WX_REPAIR_PLAN_SUBMIT.getValue()); if(workOrderOld.getRepairType().equals(1)){
workOrderOld.setStatus(WorkOrderStatusEnum.WX_REPAIR_PLAN_SUBMIT_AFTER.getValue());
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(), WorkOrderStatusEnum.WX_REPAIR_PLAN_SUBMIT_AFTER.getName());
} else {
workOrderOld.setStatus(WorkOrderStatusEnum.WX_REPAIR_PLAN_SUBMIT.getValue());
// 更新设备状态为故障
deviceService.updateStatus(CommonConstant.DEVICE_RUN_STATUS_BREAKDOWN, workOrder.getDeviceId());
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(), WorkOrderStatusEnum.WX_REPAIR_PLAN_SUBMIT.getName());
//发送消息给主管
String role = "1839537055389515777";
User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getRoleId, role));
messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已提交,请审批", user.getId(), 2);
}
this.updateById(workOrderOld); this.updateById(workOrderOld);
// 更新设备状态为故障
deviceService.updateStatus(CommonConstant.DEVICE_RUN_STATUS_BREAKDOWN, workOrder.getDeviceId());
//发送消息给主管
String role = "1839537055389515777";
User user = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getRoleId, role));
messageService.saveMessage(workOrder.getRequirementCode(), "维修方案已提交,请审批", user.getId(), 2);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -291,6 +303,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
// 更新设备状态为运行中 // 更新设备状态为运行中
deviceService.updateStatus(CommonConstant.DEVICE_RUN_STATUS_WORKING, workOrder.getDeviceId()); deviceService.updateStatus(CommonConstant.DEVICE_RUN_STATUS_WORKING, workOrder.getDeviceId());
messageService.saveMessage(workOrder.getRequirementCode(), "维修方案审批未通过,请重新提交方案", workOrder.getRepairPerson(), 2); messageService.saveMessage(workOrder.getRequirementCode(), "维修方案审批未通过,请重新提交方案", workOrder.getRepairPerson(), 2);
//保存日志
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.ZG_REPAIR_PLAN_REFUSE.getName());
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -313,8 +328,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
// 若未产生费用,直接关闭工单 // 若未产生费用,直接关闭工单
if (workOrderOld.getDiscountPrice() == null || workOrderOld.getDiscountPrice() == 0) { if (workOrderOld.getDiscountPrice() == null || workOrderOld.getDiscountPrice() == 0) {
workOrderOld.setStatus(WorkOrderStatusEnum.KF_ORDER_CLOSE.getValue()); workOrderOld.setStatus(WorkOrderStatusEnum.KF_ORDER_CLOSE.getValue());
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KF_ORDER_CLOSE.getName());
} else { } else {
workOrderOld.setStatus(WorkOrderStatusEnum.KH_EVALUATE_FINISH.getValue()); workOrderOld.setStatus(WorkOrderStatusEnum.KH_EVALUATE_FINISH.getValue());
LogUtil.saveLog(workOrderOld.getRequirementCode(),WorkOrderStatusEnum.KH_EVALUATE_FINISH.getName());
} }
this.updateById(workOrderOld); this.updateById(workOrderOld);

Loading…
Cancel
Save