工单提交、流程处理、工单列表、工单详情

This commit is contained in:
lujiang 2024-08-13 00:47:02 +08:00
parent 0d0b5f2552
commit 6b03c2328e
16 changed files with 354 additions and 344 deletions

View File

@ -2,7 +2,6 @@ package com.ics.admin.controller;
import com.ics.admin.domain.RepairAttach;
import com.ics.admin.service.IRepairAttachService;
import com.ics.admin.vo.RepairAttachVO;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.R;
import com.ics.common.utils.StringUtils;
@ -10,7 +9,6 @@ import com.ics.common.utils.file.FileUploadUtils;
import com.ics.system.config.DfsConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -18,9 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.wf.jwtp.annotation.Logical;
import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 附件
@ -30,7 +26,7 @@ import java.util.List;
*/
@Slf4j
@RestController
@RequestMapping("repairAttach")
@RequestMapping({"/admin/repairAttach", "/app/repairAttach"})
public class RepairAttachController extends BaseController {
@Autowired
@ -39,17 +35,13 @@ public class RepairAttachController extends BaseController {
@Autowired
private DfsConfig dfsConfig;
private final static String FILE_VOICE = "voice";
private final static String FILE_IMG = "img/video";
/**
* 保修上传语音
*/
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("upload/voice")
public R voiceUpload(MultipartFile file) {
return processAttache(file, null, 1, FILE_VOICE);
return processAttache(file, null, 1, IRepairAttachService.FILE_VOICE);
}
/**
@ -71,7 +63,7 @@ public class RepairAttachController extends BaseController {
}
if (nodeId == 0) return R.error("无效参数");
if ((nodeId == 9 || nodeId == 13) && repairId == null) return R.error("无效参数");
return processAttache(file, repairId, nodeId, FILE_IMG);
return processAttache(file, repairId, nodeId, IRepairAttachService.FILE_IMG);
}
@ -128,29 +120,29 @@ public class RepairAttachController extends BaseController {
/**
* 查询工单所有附件
*/
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@GetMapping("list")
public R list(Long repairId) {
List<RepairAttach> list = repairAttachService.getListByRepair(repairId);//工单所有附件
List<RepairAttachVO> voices = new ArrayList<>();
List<RepairAttachVO> repairs = new ArrayList<>();
List<RepairAttachVO> feedbacks = new ArrayList<>();
List<RepairAttachVO> evals = new ArrayList<>();
for (RepairAttach repairAttach : list) {
RepairAttachVO repairAttachVO = new RepairAttachVO(repairAttach.getId(), repairAttach.getUrl());
if (repairAttach.getNodeId() == 1) {
if (FILE_VOICE.equals(repairAttach.getExt1())) voices.add(repairAttachVO);
if (FILE_IMG.equals(repairAttach.getExt1())) repairs.add(repairAttachVO);
}
if (repairAttach.getNodeId() == 9) feedbacks.add(repairAttachVO);
if (repairAttach.getNodeId() == 13) evals.add(repairAttachVO);
}
return R.ok().put("voice", voices)
.put("repair", repairs)
.put("feedback", feedbacks)
.put("eval", evals);
}
// @RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
// @GetMapping("list")
// public R list(Long repairId) {
// List<RepairAttach> list = repairAttachService.getListByRepair(repairId);//工单所有附件
// List<RepairAttachVO> voices = new ArrayList<>();
// List<RepairAttachVO> repairs = new ArrayList<>();
// List<RepairAttachVO> feedbacks = new ArrayList<>();
// List<RepairAttachVO> evals = new ArrayList<>();
// for (RepairAttach repairAttach : list) {
// RepairAttachVO repairAttachVO = new RepairAttachVO(repairAttach.getId(), repairAttach.getUrl());
// if (repairAttach.getNodeId() == 1) {
// if (FILE_VOICE.equals(repairAttach.getExt1())) voices.add(repairAttachVO);
// if (FILE_IMG.equals(repairAttach.getExt1())) repairs.add(repairAttachVO);
// }
// if (repairAttach.getNodeId() == 9) feedbacks.add(repairAttachVO);
// if (repairAttach.getNodeId() == 13) evals.add(repairAttachVO);
// }
//
// return R.ok().put("voice", voices)
// .put("repair", repairs)
// .put("feedback", feedbacks)
// .put("eval", evals);
// }
// @Ignore
// @PostMapping("test")

View File

@ -1,9 +1,28 @@
package com.ics.admin.controller;
import com.ics.admin.service.*;
import com.ics.admin.domain.Repair;
import com.ics.admin.domain.RepairAttach;
import com.ics.admin.domain.RepairLog;
import com.ics.admin.service.IIcsCustomerStaffService;
import com.ics.admin.service.IRepairAttachService;
import com.ics.admin.service.IRepairLogService;
import com.ics.admin.service.IRepairService;
import com.ics.admin.utils.FlowOperate;
import com.ics.admin.vo.RepairAttachVO;
import com.ics.common.core.controller.BaseController;
import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wf.jwtp.annotation.Logical;
import org.wf.jwtp.annotation.RequiresPermissions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 工单管理 提供者
@ -12,7 +31,7 @@ import org.springframework.web.bind.annotation.*;
* @date 2021-03-25
*/
@RestController
@RequestMapping("/admin/repair")
@RequestMapping({"/admin/repair", "/app/repair"})
public class RepairController extends BaseController {
@Autowired
@ -21,160 +40,110 @@ public class RepairController extends BaseController {
@Autowired
private IRepairLogService repairLogService;
@Autowired
private IRepairAttachService repairAttachService;
@Autowired
private IIcsCustomerStaffService customerStaffService;
@Autowired
private IRepairDeviceTypeService repairTypeService;
//@Ignore
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("flow/start")
public R startFlow(Repair repair, String[] files) {
Long userId = getLoginStaffId();
String result = repairService.handleFlow(repair, userId, files, null, null);
return IRepairService.OK.equals(result) ? R.ok() : R.error(result);
}
@Autowired
private IRepairDeviceService deviceService;
@Autowired
private IRepairFailureTypeService repairFailureTypeService;
// @Autowired
// private IRepairRecordService repairRecordService;
//@Ignore
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("flow/handle")
public R handleFlow(Repair repair, String content, FlowOperate operate) {
Long userId = getLoginStaffId();
String result = repairService.handleFlow(repair, userId, null, content, operate);
return IRepairService.OK.equals(result) ? R.ok() : R.error(result);
}
/**
* 查询工单管理
* 工单评价
*/
// @RequiresPermissions("admin:repair:edit")
// @GetMapping("get/{id}")
// public RepairVO get(@PathVariable("id") Long id) {
// RepairVO repairVO = new RepairVO();
// Repair repair = repairService.selectRepairById(id);
// if (repair != null) {
// BeanUtils.copyBeanProp(repairVO, repair);
// repairVO.setStatus(repair.getStatus().getValue());
// repairVO.setStatusName(repair.getStatus().getName());
// //设备类型
// RepairDeviceType repairType = repairTypeService.selectRepairTypeById(Long.valueOf(repair.getTypeId()));
// if (null != repairType){
// repairVO.setTypeName(repairType.getName());
// }
// //设备名称
// RepairDevice repairDevice = deviceService.selectRepairDeviceById(Long.valueOf(repair.getRepairDevice()));
// if (repairDevice != null) {
// repairVO.setRepairDeviceName(repairDevice.getName());
// }
// //故障
// RepairFailureType repairFailureType = repairFailureTypeService.selectRepairFailureTypeById(repair.getFailureTypeId());
// if (repairFailureType != null) {
// repairVO.setFailureTypeName(repairFailureType.getName());
// }
// IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(Long.valueOf(repair.getUserId()));
// if (null != staff){
// repairVO.setUserName(staff.getUsername());
// }
//
// IcsCustomerStaff worker = customerStaffService.selectIcsCustomerStaffById(repair.getWorkerId());
// if (null != worker){
// repairVO.setWorkerName(worker.getUsername());
// }
//
// RepairEval repairRecord = repairRecordService.selectByRepairId(id);
// if (null != repairRecord){
// repairVO.setSpeed(repairRecord.getSpeed());
// repairVO.setServe(repairRecord.getServe());
// repairVO.setEffect(repairRecord.getEffect());
// }
// RepairLog repairLog = new RepairLog();
// repairLog.setRepairId(id);
// List<RepairLog> repairLogs = repairLogService.selectRepairLogList(repairLog);
// repairVO.setRepairLogs(repairLogs);
// }
// return repairVO;
// }
//
// /**
// * 查询工单管理列表
// */
// @RequiresPermissions("admin:repair:list")
// @GetMapping("list")
// public R list(Repair repair, @LoginUser User user) {
// startPage();
// List<Repair> repairList = repairService.selectRepairList(repair);
// for (Repair repair1 : repairList) {
// repair1.setStatusValue(repair1.getStatus().getValue());
// repair1.setStatusName(repair1.getStatus().getName());
// //设备类型
// if (repair1.getTypeId() != null) {
// RepairDeviceType repairType = repairTypeService.selectRepairTypeById(Long.valueOf(repair1.getTypeId()));
// repair1.setTypeName(repairType.getName());
// }
// //设备名称
// if (repair1.getRepairDevice() != null){
// RepairDevice repairDevice = deviceService.selectRepairDeviceById(Long.valueOf(repair1.getRepairDevice()));
// repair1.setRepairDeviceName(repairDevice.getName());
// }
// //故障
// if (repair1.getFailureTypeId() != null){
//
// RepairFailureType repairFailureType = repairFailureTypeService.selectRepairFailureTypeById(repair1.getFailureTypeId());
// repair1.setFailureTypeName(repairFailureType.getName());
// }
// if (repair1.getUserId() != null){
// IcsCustomerStaff staff = customerStaffService.selectIcsCustomerStaffById(Long.valueOf(repair1.getUserId()));
// repair1.setUserName(staff.getUsername());
// }
//
// if (repair1.getWorkerId() != null){
// IcsCustomerStaff worker = customerStaffService.selectIcsCustomerStaffById(repair1.getWorkerId());
// repair1.setWorkerName(worker.getUsername());
// }
// }
// return result(repairList);
// }
//
// /**
// * 新增
// */
// @RequiresPermissions("admin:repair:edit")
// @PostMapping("/review")
// public R review(@RequestBody Repair repair) {
// Repair pRepair = repairService.selectRepairById(repair.getId());
//// if (repair == null || !Repair.Status.PENDING_ASSIGN.equals(pRepair.getStatus())) {
//// return R.error("报修为空或状态不是待分配");
//// }
//// repair.setStatus(Repair.Status.PENDING_PROCESS);
// repair.setStatus(Repair.Status.PENDING_PROCESS);
// return toAjax(repairService.insertRepair(repair));
// }
//
// /**
// * 完成
// */
// @RequiresPermissions("admin:repair:edit")
// @PostMapping("/complete")
// public R complete(@RequestBody Repair repair) {
// Repair pRepair = repairService.selectRepairById(repair.getId());
// if (repair == null || !Repair.Status.PENDING_PROCESS.equals(pRepair.getStatus())) {
// return R.error("报修为空或状态不是待处理");
// }
// repair.setStatus(Repair.Status.COMPLETED);
// return toAjax(repairService.updateRepair(repair));
// }
//
// /**
// * 删除工单管理
// */
// @RequiresPermissions("admin:repair:remove")
// @PostMapping("remove")
// public R remove(String ids) {
// return toAjax(repairService.deleteRepairByIds(ids));
// }
//
//
//
// @Ignore
// @GetMapping("selectWorkerIdByTypeId")
// public R selectWorkerIdByTypeId(String typeId) {
// List<IcsCustomerStaff> customerStaffs = repairService.selectWorkerIdByTypeId(typeId);
// return R.data(customerStaffs);
// }
//
// //查询派单员列表
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@PostMapping("eval")
public R eval(Repair repair) {
Long userId = getLoginStaffId();
return toAjax(repairService.eval(repair, userId));
}
/**
* 工单列表
* <p>
* 1.普通用户3派单员5维修工, 7管理员
* <p>
* 普通用户全部处理中待评价已评价 type对应值allprocessevalingevaled
* 派单员重新派单待派单已派单已关闭 type对应值anewwaitalreadyclose
* 维修工待完成进行中已完成 type对应值waitworkingclose
* 管理员重派单全部 type对应值anewall
*
* @return
*/
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@RequestMapping("list")
public R list(String type) {
startPage();
Long userId = getLoginStaffId();
IcsCustomerStaff loginUser = customerStaffService.selectIcsCustomerStaffById(userId);
//1.普通用户3派单员5维修人, 7管理员
String role = loginUser.getDataType();
return result(repairService.repairList(role, userId.toString(), type));
}
/**
* 获取一个工单的详细信息
*
* @param id
* @return
*/
@RequiresPermissions(value = {"repair:attach:operator", "member:center:view"}, logical = Logical.OR)
@RequestMapping("get")
public R get(Long id) {
Repair repair = repairService.selectRepairById(id);
List<RepairAttach> list = repairAttachService.getListByRepair(id);
List<RepairAttachVO> voices = new ArrayList<>();
List<RepairAttachVO> repairs = new ArrayList<>();
List<RepairAttachVO> feedbacks = new ArrayList<>();
List<RepairAttachVO> evals = new ArrayList<>();
for (RepairAttach repairAttach : list) {
RepairAttachVO repairAttachVO = new RepairAttachVO(repairAttach.getId(), repairAttach.getUrl());
if (repairAttach.getNodeId() == 1) {
if (IRepairAttachService.FILE_VOICE.equals(repairAttach.getExt1())) voices.add(repairAttachVO);
if (IRepairAttachService.FILE_IMG.equals(repairAttach.getExt1())) repairs.add(repairAttachVO);
}
if (repairAttach.getNodeId() == 9) feedbacks.add(repairAttachVO);
if (repairAttach.getNodeId() == 13) evals.add(repairAttachVO);
}
Map<String, Object> files = new HashMap<>();
files.put("voice", voices);
files.put("repair", repairs);
files.put("feedback", feedbacks);
files.put("eval", evals);
List<RepairLog> logList = repairLogService.selectRepairLogListByRepairId(id);
return R.ok().put("repair", repair)
.put("files", files)
.put("log", logList);
}
/**
* 删除工单
*/
@RequiresPermissions("repair:attach:operator")
@PostMapping("delete")
public R remove(Long id) {
return toAjax(repairService.deleteRepairById(id));
}
}

View File

@ -85,7 +85,7 @@ public class Repair extends BaseEntity<Repair> {
/**
* 描述
*/
private String content;
private String explain;
//--派单
/**
@ -121,7 +121,7 @@ public class Repair extends BaseEntity<Repair> {
/**
* 故障类型名称
*/
private Long failureTypeName;
private String failureTypeName;
/**
* 是否解决 1 已解决 0 未解决

View File

@ -20,7 +20,7 @@ public class RepairAttach extends BaseEntity<RepairAttach> {
private Long repairId;
/**
* 文件所属环节 1 9维修工反馈附件 13 评价附件
* 文件所属环节 1 9维修工反馈附件 13 评价附件
*/
private Integer nodeId;
/**
@ -43,4 +43,5 @@ public class RepairAttach extends BaseEntity<RepairAttach> {
private String ext1;
private String ext2;
private String ext3;
}

View File

@ -31,7 +31,7 @@ public class RepairLog extends BaseEntity<RepairLog> {
/**
* 源节点
*/
private Integer form;
private Integer from;
/**
* 去向节点

View File

@ -24,12 +24,12 @@ public interface RepairLogMapper extends BaseMapper<RepairLog> {
RepairLog selectRepairLogById(Long id);
/**
* 查询流程日志列表
* 获取工单操作日志
*
* @param repairLog 流程日志
* @return 流程日志集合
* @param repairId
* @return
*/
List<RepairLog> selectRepairLogList(RepairLog repairLog);
List<RepairLog> selectRepairLogListByRid(Long repairId);
/**
* 新增流程日志
@ -56,10 +56,9 @@ public interface RepairLogMapper extends BaseMapper<RepairLog> {
int deleteRepairLogById(Long id);
/**
* 批量删除流程日志
* 删除工单的所有流程日志
*
* @param ids 需要删除的数据ID
* @return 结果
* @param repairId 工单id
*/
int deleteRepairLogByIds(String[] ids);
int deleteRepairLogByRId(Long repairId);
}

View File

@ -3,6 +3,7 @@ package com.ics.admin.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ics.admin.domain.Repair;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -22,13 +23,12 @@ public interface RepairMapper extends BaseMapper<Repair> {
*/
Repair selectRepairById(Long id);
/**
* 查询工单列表
*
* @param repair 工单
* @return 工单集合
*/
List<Repair> selectRepairList(Repair repair);
List<Repair> normalRepairList(@Param("userId") String userId, @Param("type") String type);
List<Repair> preRepairList(@Param("userId") String userId, @Param("type") String type);
List<Repair> workRepairList(@Param("userId") String userId, @Param("type") String type);
List<Repair> adminRepairList(@Param("userId") String userId, @Param("type") String type);
/**
* 新增工单

View File

@ -13,6 +13,10 @@ import java.util.List;
*/
public interface IRepairAttachService extends IService<RepairAttach> {
String FILE_VOICE = "voice";
String FILE_IMG = "img/video";
/**
* 新增附件
*

View File

@ -22,11 +22,8 @@ public interface IRepairLogService extends IService<RepairLog> {
/**
* 查询流程日志列表
*
* @param repairLog 流程日志
* @return 流程日志集合
*/
List<RepairLog> selectRepairLogList(RepairLog repairLog);
List<RepairLog> selectRepairLogListByRepairId(Long repairId);
/**
* 新增流程日志
@ -45,12 +42,11 @@ public interface IRepairLogService extends IService<RepairLog> {
int updateRepairLog(RepairLog repairLog);
/**
* 批量删除流程日志
* 删除工单的所有流程日志
*
* @param ids 需要删除的数据ID
* @return 结果
* @param repairId 工单id
*/
int deleteRepairLogByIds(String ids);
int deleteRepairLogByRId(Long repairId);
/**
* 删除流程日志信息

View File

@ -2,6 +2,7 @@ package com.ics.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ics.admin.domain.Repair;
import com.ics.admin.utils.FlowOperate;
import com.ics.common.core.domain.IcsCustomerStaff;
import java.util.List;
@ -14,16 +15,17 @@ import java.util.List;
*/
public interface IRepairService extends IService<Repair> {
String OK = "okay";
/**
* 处理流程
* @return okay 表示处理成功
*/
String handleFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate);
String handleFlow(Repair repair, Long currentUserId, String[] files, String content, FlowOperate operate);
/**
* 评价
*/
void eval(Repair repair, Long currentUserId);
int eval(Repair repair, Long currentUserId);
/**
@ -36,11 +38,8 @@ public interface IRepairService extends IService<Repair> {
/**
* 查询工单列表
*
* @param repair 工单
* @return 工单集合
*/
List<Repair> selectRepairList(Repair repair);
List<Repair> repairList(String role, String userId, String type);
/**
* 新增工单

View File

@ -36,14 +36,10 @@ public class RepairLogServiceImpl extends ServiceImpl<RepairLogMapper, RepairLog
/**
* 查询流程日志列表
*
* @param repairLog 流程日志
* @return 流程日志
*/
@Override
public List<RepairLog> selectRepairLogList(RepairLog repairLog) {
QueryWrapper queryWrapper = new QueryWrapper();
return repairLogMapper.selectList(queryWrapper);
public List<RepairLog> selectRepairLogListByRepairId(Long repairId) {
return repairLogMapper.selectRepairLogListByRid(repairId);
}
/**
@ -69,15 +65,13 @@ public class RepairLogServiceImpl extends ServiceImpl<RepairLogMapper, RepairLog
}
/**
* 删除流程日志对象
* 删除工单的所有流程日志
*
* @param ids 需要删除的数据ID
* @return 结果
* @param repairId 工单id
*/
@Override
public int deleteRepairLogByIds(String ids) {
String[] idsArray = StrUtil.split(ids,",");
return repairLogMapper.deleteBatchIds(CollUtil.toList(idsArray));
public int deleteRepairLogByRId(Long repairId) {
return repairLogMapper.deleteRepairLogByRId(repairId);
}
/**

View File

@ -2,7 +2,6 @@ package com.ics.admin.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ics.admin.domain.Repair;
import com.ics.admin.domain.RepairLog;
@ -12,8 +11,9 @@ import com.ics.admin.mapper.RepairAttachMapper;
import com.ics.admin.mapper.RepairLogMapper;
import com.ics.admin.mapper.RepairMapper;
import com.ics.admin.mapper.RepairRelationalMapper;
import com.ics.admin.service.IRepairAttachService;
import com.ics.admin.service.IRepairService;
import com.ics.admin.utils.FlowConstants;
import com.ics.admin.utils.FlowOperate;
import com.ics.common.core.domain.IcsCustomerStaff;
import com.ics.common.utils.StringUtils;
import com.ics.system.domain.Sn;
@ -54,31 +54,37 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
@Autowired
private RepairAttachMapper repairAttachMapper;
@Autowired
private IRepairAttachService repairAttachService;
@Transactional(rollbackFor = Exception.class)
@Override
public String handleFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate) {
return processFlow(repair, currentUserId, nextUserId, files, content, operate);
public String handleFlow(Repair repair, Long currentUserId, String[] files, String content, FlowOperate operate) {
return processFlow(repair, currentUserId, files, content, operate);
}
@Override
public void eval(Repair repair, Long currentUserId) {
public int eval(Repair repair, Long currentUserId) {
Repair oldRepair = repairMapper.selectRepairById(repair.getId());
oldRepair.setEvalService(repair.getEvalService());
oldRepair.setFeedback(repair.getFeedback());
oldRepair.setEvalTime(new Date());
oldRepair.setEvalUserId(currentUserId);
oldRepair.setStatus(13);
repairMapper.updateRepair(oldRepair);
if (oldRepair.getStatus() != null && oldRepair.getStatus() == 9) {
oldRepair.setEvalService(repair.getEvalService());
oldRepair.setFeedback(repair.getFeedback());
oldRepair.setEvalTime(new Date());
oldRepair.setEvalUserId(currentUserId);
oldRepair.setStatus(13);
return repairMapper.updateRepair(oldRepair);
}
return 0;
}
private String processFlow(Repair repair, Long currentUserId, Long nextUserId, String[] files, String content, String operate) {
private String processFlow(Repair repair, Long currentUserId, String[] files, String content, FlowOperate operate) {
if (repair == null) return "表单数据为空";
IcsCustomerStaff currentUser = customerStaffMapper.selectIcsCustomerStaffById(currentUserId);
IcsCustomerStaff nextUser = null;
Integer from = -1, to = -1;
from = repair.getId() == null || repair.getId() == 0L ? 0 : repair.getStatus();
Repair newRepair = from == 0 ? repair : repairMapper.selectRepairById(repair.getId());//优先使用数据库中的表单
Repair newRepair = repair.getId() == null || repair.getId() == 0L ? repair : repairMapper.selectRepairById(repair.getId());//使用数据库中的表单
from = repair.getId() == null || repair.getId() == 0L ? 0 : newRepair.getStatus();
//保修
if (from == 0) {
//没有设置维修人员则到派单环节否则到修理工是否接收环节
@ -100,14 +106,14 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
}
//派单
if (from == 1) {
if (FlowConstants.NEXT.equals(operate)) {
if (FlowOperate.NEXT.equals(operate)) {
to = 5;
nextUser = customerStaffMapper.selectIcsCustomerStaffById(nextUserId);
nextUser = customerStaffMapper.selectIcsCustomerStaffById(repair.getRepairUserId());
if (nextUser == null) return "派单没有找到下一步执行人";
newRepair.setRepairUserId(nextUser.getId());
newRepair.setPreDate(repair.getPreDate());//设置预计完成时间
}
if (FlowConstants.BACK.equals(operate)) {
if (FlowOperate.BACK.equals(operate)) {
to = 3;
IcsCustomerStaff p = new IcsCustomerStaff();
p.setDataType("7");
@ -115,7 +121,7 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
if (list == null || list.size() == 0) return "没有找到管理员账号";
nextUser = list.get(0);
}
if (FlowConstants.END.equals(operate)) to = 11;
if (FlowOperate.END.equals(operate)) to = 11;
}
//重新派单
if (from == 3) {
@ -129,12 +135,18 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
newRepair.setTypeName(repair.getTypeName());
newRepair.setDeviceId(repair.getDeviceId());
newRepair.setDeviceName(repair.getDeviceName());
repair.setPerUserId(nextUser.getId());//设置派单员
newRepair.setPerUserId(nextUser.getId());//设置派单员
}
//修理工是否接收
if (from == 5) {
if (FlowConstants.BACK.equals(operate)) to = 1;
if (FlowConstants.NEXT.equals(operate)) to = 7;
if (FlowOperate.BACK.equals(operate)) {
to = 1;
nextUser = customerStaffMapper.selectIcsCustomerStaffById(newRepair.getPerUserId());//查询派单员
}
if (FlowOperate.NEXT.equals(operate)) {
to = 7;
nextUser = currentUser;
}
}
//修理反馈
if (from == 7) {
@ -148,7 +160,7 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
}
newRepair.setStatus(to);//设置状态
processData(newRepair, currentUser, nextUser, from, to, content, files);
return FlowConstants.OK;
return IRepairService.OK;
}
private void processData(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content, String[] files) {
@ -169,22 +181,28 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
RepairLog repairLog = new RepairLog();
repairLog.setPid(oldLog == null ? 0L : oldLog.getId());
repairLog.setRepairId(repair.getId());
repairLog.setForm(from);
repairLog.setFrom(from);
repairLog.setTo(to);
repairLog.setSendUserId(currentUser.getId());
repairLog.setSendUserName(currentUser.getUsername());
repairLog.setRecUserId(nextUser.getId());
repairLog.setRecUserName(nextUser.getUsername());
repairLog.setStatus(0);
if (to == 9 || to == 11) {//结束
repairLog.setRecUserId(0);
repairLog.setRecUserName("END");
repairLog.setStatus(1);
repairLog.setCloseTime(now);
} else {
repairLog.setRecUserId(nextUser.getId());
repairLog.setRecUserName(nextUser.getUsername());
repairLog.setStatus(0);
}
repairLog.setDeleteFlag(0);
repairLog.setCreateBy(currentUser.getId().toString());
repairLog.setCreateTime(now);
if (to == 9 || to == 11) {//结束
repairLog.setStatus(1);
repairLog.setCloseTime(now);
}
repairLogMapper.insertRepairLog(repairLog);
repair.setLogId(repairLog.getId());
repair.setUpdateBy(currentUser.getId().toString());
repair.setUpdateTime(now);
repairMapper.updateRepair(repair);
}
@ -196,19 +214,19 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
*/
@Override
public Repair selectRepairById(Long id) {
return repairMapper.selectById(id);
return repairMapper.selectRepairById(id);
}
/**
* 查询工单列表
*
* @param repair 工单
* @return 工单
*/
@Override
public List<Repair> selectRepairList(Repair repair) {
QueryWrapper queryWrapper = new QueryWrapper();
return repairMapper.selectList(queryWrapper);
public List<Repair> repairList(String role, String userId, String type) {
//1.普通用户3派单员5维修人, 7管理员
if ("7".equals(role)) return repairMapper.adminRepairList(userId, type);
if ("5".equals(role)) return repairMapper.workRepairList(userId, type);
if ("3".equals(role)) return repairMapper.preRepairList(userId, type);
return repairMapper.normalRepairList(userId, type);//普通用户或者没有角色时都使用普通用户列表
}
/**
@ -251,8 +269,13 @@ public class RepairServiceImpl extends ServiceImpl<RepairMapper, Repair> impleme
* @param id 工单ID
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteRepairById(Long id) {
//删除附件
repairAttachService.deleteByRepairId(id);
//删除日志
repairLogMapper.deleteRepairLogByRId(id);
return repairMapper.deleteRepairById(id);
}

View File

@ -0,0 +1,24 @@
package com.ics.admin.utils;
import com.baomidou.mybatisplus.annotation.IEnum;
/**
* 流程操作状态
*/
public enum FlowOperate implements IEnum<String> {
NEXT("next"),
BACK("back"),
END("end");
private String value;
FlowOperate(String value) {
this.value = value;
}
public String getValue() {
return value;
}
}

View File

@ -8,12 +8,12 @@
<result property="id" column="id" />
<result property="pid" column="pid" />
<result property="repairId" column="repair_id" />
<result property="nodeForm" column="node_form" />
<result property="nodeTo" column="node_to" />
<result property="from" column="node_form" />
<result property="to" column="node_to" />
<result property="sendUserId" column="send_userid" />
<result property="sendUsername" column="send_username" />
<result property="sendUserName" column="send_username" />
<result property="recUserId" column="rec_userid" />
<result property="recUsername" column="rec_username" />
<result property="recUserName" column="rec_username" />
<result property="read" column="read" />
<result property="readTime" column="readtime" />
<result property="status" column="status" />
@ -33,20 +33,17 @@
</resultMap>
<sql id="selectRepairLogVo">
SELECT id, pid, repair_id, node_form, node_to, send_userid, send_username, rec_userid, rec_username, read, readtime, status, closetime, content, remark, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, park_id, tenant_id FROM ics_repair_log
SELECT id, pid, repair_id, node_form, node_to, send_userid, send_username, rec_userid, rec_username, `read`, readtime, status, closetime, content, remark, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, park_id, tenant_id FROM ics_repair_log
</sql>
<select id="selectRepairLogList" parameterType="RepairLog" resultMap="RepairLogResult">
<select id="selectRepairLogListByRid" parameterType="Long" resultMap="RepairLogResult">
<include refid="selectRepairLogVo"/>
<where>
<if test="sendUsername != null and sendUsername != ''"> AND send_username LIKE CONCAT('%', #{sendUsername}, '%')</if>
<if test="recUsername != null and recUsername != ''"> AND rec_username LIKE CONCAT('%', #{recUsername}, '%')</if>
</where>
where repair_id= #{repairId} and delete_flag=0 order by create_time
</select>
<select id="selectRepairLogById" parameterType="Long" resultMap="RepairLogResult">
<include refid="selectRepairLogVo"/>
WHERE id = #{id}
WHERE id = #{id} and delete_flag=0
</select>
<insert id="insertRepairLog" parameterType="RepairLog" useGeneratedKeys="true" keyProperty="id">
@ -54,16 +51,16 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pid != null ">pid,</if>
<if test="repairId != null ">repair_id,</if>
<if test="nodeForm != null ">node_form,</if>
<if test="nodeTo != null ">node_to,</if>
<if test="sendUserid != null ">send_userid,</if>
<if test="sendUsername != null and sendUsername != ''">send_username,</if>
<if test="recUserid != null ">rec_userid,</if>
<if test="recUsername != null and recUsername != ''">rec_username,</if>
<if test="from != null ">node_form,</if>
<if test="to != null ">node_to,</if>
<if test="sendUserId != null ">send_userid,</if>
<if test="sendUserName != null and sendUserName != ''">send_username,</if>
<if test="recUserId != null ">rec_userid,</if>
<if test="recUserName != null and recUserName != ''">rec_username,</if>
<if test="read != null ">read,</if>
<if test="readtime != null ">readtime,</if>
<if test="readTime != null ">readtime,</if>
<if test="status != null ">status,</if>
<if test="closetime != null ">closetime,</if>
<if test="closeTime != null ">closetime,</if>
<if test="content != null and content != ''">content,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="ext1 != null and ext1 != ''">ext1,</if>
@ -72,24 +69,22 @@
<if test="deleteFlag != null ">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="parkId != null ">park_id,</if>
<if test="tenantId != null ">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pid != null ">#{pid},</if>
<if test="repairId != null ">#{repairId},</if>
<if test="nodeForm != null ">#{nodeForm},</if>
<if test="nodeTo != null ">#{nodeTo},</if>
<if test="sendUserid != null ">#{sendUserid},</if>
<if test="sendUsername != null and sendUsername != ''">#{sendUsername},</if>
<if test="recUserid != null ">#{recUserid},</if>
<if test="recUsername != null and recUsername != ''">#{recUsername},</if>
<if test="from != null ">#{from},</if>
<if test="to != null ">#{to},</if>
<if test="sendUserId != null ">#{sendUserId},</if>
<if test="sendUserName != null and sendUserName != ''">#{sendUserName},</if>
<if test="recUserId != null ">#{recUserId},</if>
<if test="recUserName != null and recUserName != ''">#{recUserName},</if>
<if test="read != null ">#{read},</if>
<if test="readtime != null ">#{readtime},</if>
<if test="readTime != null ">#{readTime},</if>
<if test="status != null ">#{status},</if>
<if test="closetime != null ">#{closetime},</if>
<if test="closeTime != null ">#{closeTime},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="ext1 != null and ext1 != ''">#{ext1},</if>
@ -98,8 +93,6 @@
<if test="deleteFlag != null ">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="parkId != null ">#{parkId},</if>
<if test="tenantId != null ">#{tenantId},</if>
</trim>
@ -110,24 +103,22 @@
<trim prefix="SET" suffixOverrides=",">
<if test="pid != null ">pid = #{pid},</if>
<if test="repairId != null ">repair_id = #{repairId},</if>
<if test="nodeForm != null ">node_form = #{nodeForm},</if>
<if test="nodeTo != null ">node_to = #{nodeTo},</if>
<if test="sendUserid != null ">send_userid = #{sendUserid},</if>
<if test="sendUsername != null and sendUsername != ''">send_username = #{sendUsername},</if>
<if test="recUserid != null ">rec_userid = #{recUserid},</if>
<if test="recUsername != null and recUsername != ''">rec_username = #{recUsername},</if>
<if test="read != null ">read = #{read},</if>
<if test="readtime != null ">readtime = #{readtime},</if>
<if test="from != null ">node_form = #{from},</if>
<if test="to != null ">node_to = #{to},</if>
<if test="sendUserId != null ">send_userid = #{sendUserId},</if>
<if test="sendUserName != null and sendUserName != ''">send_username = #{sendUserName},</if>
<if test="recUserId != null ">rec_userid = #{recUserId},</if>
<if test="recUserName != null and recUserName != ''">rec_username = #{recUserName},</if>
<if test="read != null ">`read` = #{read},</if>
<if test="readTime != null ">readtime = #{readTime},</if>
<if test="status != null ">status = #{status},</if>
<if test="closetime != null ">closetime = #{closetime},</if>
<if test="closeTime != null ">closetime = #{closeTime},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="ext1 != null and ext1 != ''">ext1 = #{ext1},</if>
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="parkId != null ">park_id = #{parkId},</if>
@ -140,11 +131,8 @@
DELETE FROM ics_repair_log WHERE id = #{id}
</delete>
<delete id="deleteRepairLogByIds" parameterType="String">
DELETE FROM ics_repair_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
<delete id="deleteRepairLogByRId" parameterType="Long">
DELETE FROM ics_repair_log where repair_id =#{repairId}
</delete>
</mapper>

View File

@ -21,9 +21,9 @@
<result property="floorId" column="floor_id" />
<result property="floor" column="floor" />
<result property="room" column="room" />
<result property="content" column="content" />
<result property="explain" column="explain" />
<result property="perUserId" column="per_userid" />
<result property="predate" column="predate" />
<result property="preDate" column="predate" />
<result property="cause" column="cause" />
<result property="solution" column="solution" />
<result property="failureTypeId" column="failure_type_id" />
@ -53,23 +53,12 @@
</resultMap>
<sql id="selectRepairVo">
SELECT id, sn, repair_name, repair_level, repair_time, type_id, type_name, device_id, device_name, name, phone, address_id, address, floor_id, floor, room, content, per_userid, predate, cause, solution, failure_type_id, failure_type_name, resolve, repair_user_id, end_date, eval_service, feedback, eval_time, eval_user_id, timeout, warn, status, log_id, remark, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair
SELECT id, sn, repair_name, repair_level, repair_time, type_id, type_name, device_id, device_name, name, phone, address_id, address, floor_id, floor, room, `explain`, per_userid, predate, cause, solution, failure_type_id, failure_type_name, resolve, repair_user_id, end_date, eval_service, feedback, eval_time, eval_user_id, timeout, warn, status, log_id, remark, ext1, ext2, ext3, delete_flag, create_by, create_time, update_by, update_time, tenant_id, park_id FROM ics_repair
</sql>
<select id="selectRepairList" parameterType="Repair" resultMap="RepairResult">
<include refid="selectRepairVo"/>
<where>
<if test="repairName != null and repairName != ''"> AND repair_name LIKE CONCAT('%', #{repairName}, '%')</if>
<if test="typeName != null and typeName != ''"> AND type_name LIKE CONCAT('%', #{typeName}, '%')</if>
<if test="deviceName != null and deviceName != ''"> AND device_name LIKE CONCAT('%', #{deviceName}, '%')</if>
<if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%')</if>
<if test="failureTypeName != null and failureTypeName != ''"> AND failure_type_name LIKE CONCAT('%', #{failureTypeName}, '%')</if>
</where>
</select>
<select id="selectRepairById" parameterType="Long" resultMap="RepairResult">
<include refid="selectRepairVo"/>
WHERE id = #{id}
WHERE id = #{id} and delete_flag = 0
</select>
<insert id="insertRepair" parameterType="Repair" useGeneratedKeys="true" keyProperty="id">
@ -90,9 +79,9 @@
<if test="floorId != null ">floor_id,</if>
<if test="floor != null and floor != ''">floor,</if>
<if test="room != null and room != ''">room,</if>
<if test="content != null and content != ''">content,</if>
<if test="perUserid != null ">per_userid,</if>
<if test="predate != null ">predate,</if>
<if test="explain != null and explain != ''">explain,</if>
<if test="perUserId != null ">per_userid,</if>
<if test="preDate != null ">preDate,</if>
<if test="cause != null and cause != ''">cause,</if>
<if test="solution != null and solution != ''">solution,</if>
<if test="failureTypeId != null ">failure_type_id,</if>
@ -115,8 +104,6 @@
<if test="deleteFlag != null ">delete_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null ">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null ">update_time,</if>
<if test="tenantId != null ">tenant_id,</if>
<if test="parkId != null ">park_id,</if>
</trim>
@ -136,9 +123,9 @@
<if test="floorId != null ">#{floorId},</if>
<if test="floor != null and floor != ''">#{floor},</if>
<if test="room != null and room != ''">#{room},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="perUserid != null ">#{perUserid},</if>
<if test="predate != null ">#{predate},</if>
<if test="explain != null and explain != ''">#{explain},</if>
<if test="perUserId != null ">#{perUserId},</if>
<if test="preDate != null ">#{preDate},</if>
<if test="cause != null and cause != ''">#{cause},</if>
<if test="solution != null and solution != ''">#{solution},</if>
<if test="failureTypeId != null ">#{failureTypeId},</if>
@ -161,8 +148,6 @@
<if test="deleteFlag != null ">#{deleteFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null ">#{updateTime},</if>
<if test="tenantId != null ">#{tenantId},</if>
<if test="parkId != null ">#{parkId},</if>
</trim>
@ -186,9 +171,9 @@
<if test="floorId != null ">floor_id = #{floorId},</if>
<if test="floor != null and floor != ''">floor = #{floor},</if>
<if test="room != null and room != ''">room = #{room},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="perUserid != null ">per_userid = #{perUserid},</if>
<if test="predate != null ">predate = #{predate},</if>
<if test="explain != null and explain != ''">explain = #{explain},</if>
<if test="perUserId != null ">per_userid = #{perUserId},</if>
<if test="preDate != null ">predate = #{preDate},</if>
<if test="cause != null and cause != ''">cause = #{cause},</if>
<if test="solution != null and solution != ''">solution = #{solution},</if>
<if test="failureTypeId != null ">failure_type_id = #{failureTypeId},</if>
@ -209,8 +194,6 @@
<if test="ext2 != null and ext2 != ''">ext2 = #{ext2},</if>
<if test="ext3 != null and ext3 != ''">ext3 = #{ext3},</if>
<if test="deleteFlag != null ">delete_flag = #{deleteFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null ">update_time = #{updateTime},</if>
<if test="tenantId != null ">tenant_id = #{tenantId},</if>
@ -218,6 +201,43 @@
</trim>
WHERE id = #{id}
</update>
<!--普通用户-->
<select id="normalRepairList" resultMap="RepairResult">
<include refid="selectRepairVo"/>
where delete_flag = 0 and create_by = #{userId}
<if test="type == 'all'"></if>
<if test="type == 'process'">and status &lt; 9</if>
<if test="type == 'evaling'">and status = 9</if>
<if test="type == 'evaled'">and status = 13</if>
order by create_time desc
</select>
<!--派单员-->
<select id="preRepairList" resultMap="RepairResult">
<include refid="selectRepairVo"/>
where delete_flag = 0 and per_userid = #{userId}
<if test="type == 'anew'">and status = 3</if>
<if test="type == 'wait'">and status = 1</if>
<if test="type == 'already'">and status &gt; 3 and status &lt;&gt; 11</if>
<if test="type == 'close'">and status = 11</if>
order by create_time desc
</select>
<!--维修人员-->
<select id="workRepairList" resultMap="RepairResult">
<include refid="selectRepairVo"/>
where delete_flag = 0 and repair_user_id = #{userId}
<if test="type == 'wait'">and status = 5</if>
<if test="type == 'working'">and status = 7</if>
<if test="type == 'close'">and (status = 9 or status = 13)</if>
order by create_time desc
</select>
<!--管理员-->
<select id="adminRepairList" resultMap="RepairResult">
<include refid="selectRepairVo"/>
where delete_flag = 0
<if test="type == 'anew'">and status = 3</if>
<if test="type == 'all'"></if>
order by create_time desc
</select>
<delete id="deleteRepairById" parameterType="Long">
DELETE FROM ics_repair WHERE id = #{id}

View File

@ -30,7 +30,8 @@ public class RepairLogServiceImpl extends ServiceImpl<RepairLogMapper, RepairLog
*/
@Override
public List<RepairLog> selectRepairLogList(RepairLog repairLog) {
return repairLogMapper.selectRepairLogList(repairLog);
//return repairLogMapper.selectRepairLogList(repairLog);
return null;
}