mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 12:29:36 +08:00
工单模板下载,工单数据导入,工单提醒修正
This commit is contained in:
parent
6ae3116e45
commit
cca5ba996e
@ -0,0 +1,279 @@
|
||||
package com.ics.admin.controller;
|
||||
|
||||
import com.ics.admin.domain.Repair;
|
||||
import com.ics.admin.domain.RepairAddress;
|
||||
import com.ics.admin.domain.RepairAddressFloor;
|
||||
import com.ics.admin.domain.RepairDevice;
|
||||
import com.ics.admin.domain.RepairDeviceType;
|
||||
import com.ics.admin.service.IRepairIOSerice;
|
||||
import com.ics.admin.service.IRepairService;
|
||||
import com.ics.admin.utils.EasyPoiUtils;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
import com.ics.common.utils.ServletUtils;
|
||||
import com.ics.common.utils.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.DataValidation;
|
||||
import org.apache.poi.ss.usermodel.DataValidationConstraint;
|
||||
import org.apache.poi.ss.usermodel.DataValidationHelper;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.Font;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.Name;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellRangeAddressList;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
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;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.wf.jwtp.annotation.Ignore;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* created at 2024-8-24 20:48
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("admin/repair/io")
|
||||
public class RepairIOController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRepairIOSerice repairIOSerice;
|
||||
|
||||
@Autowired
|
||||
private IRepairService repairService;
|
||||
|
||||
/**
|
||||
* 导出工单模板
|
||||
*/
|
||||
|
||||
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||
@GetMapping("/exportTemplate")
|
||||
public void exportTemplate() {
|
||||
int rowCount = 500;//设置模板500行的样式,加上标题实际是501行
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
Sheet sheet1 = workbook.createSheet("报修工单");
|
||||
prcessTableHeader(workbook, sheet1, rowCount);
|
||||
/** 数据字典 */
|
||||
Sheet sheet2 = workbook.createSheet("data");
|
||||
List<String[]> datas = prcessTableData(workbook, sheet2);
|
||||
|
||||
DataValidationHelper helper = sheet1.getDataValidationHelper();
|
||||
DataValidationConstraint constraint = helper.createExplicitListConstraint(datas.get(0));
|
||||
CellRangeAddressList addressList = new CellRangeAddressList(1, rowCount, 0, 0);
|
||||
DataValidation validation = helper.createValidation(constraint, addressList);
|
||||
sheet1.addValidationData(validation);
|
||||
|
||||
constraint = helper.createFormulaListConstraint("INDIRECT($A2)");
|
||||
addressList = new CellRangeAddressList(1, rowCount, 1, 1);
|
||||
validation = helper.createValidation(constraint, addressList);
|
||||
sheet1.addValidationData(validation);
|
||||
|
||||
constraint = helper.createExplicitListConstraint(datas.get(1));
|
||||
addressList = new CellRangeAddressList(1, rowCount, 2, 2);
|
||||
validation = helper.createValidation(constraint, addressList);
|
||||
sheet1.addValidationData(validation);
|
||||
|
||||
constraint = helper.createFormulaListConstraint("INDIRECT($C2)");
|
||||
addressList = new CellRangeAddressList(1, rowCount, 3, 3);
|
||||
validation = helper.createValidation(constraint, addressList);
|
||||
sheet1.addValidationData(validation);
|
||||
|
||||
workbook.setSheetHidden(1, true);
|
||||
|
||||
try {
|
||||
HttpServletResponse response = ServletUtils.getResponse();
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/vnd.ms-excel;charset=utf-8");// 设置contentType为excel格式
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + new String(("工单填报模版" + DateUtils.dateTime()).getBytes("gbk"), "ISO8859-1") + ".xlsx");
|
||||
response.flushBuffer();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
workbook.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置填报模板
|
||||
*/
|
||||
private void prcessTableHeader(Workbook workbook, Sheet sheet, int rowCount) {
|
||||
String[] titles = {"故障类型", "设备", "故障地点", "楼层", "门牌号", "报修人姓名", "联系电话", "故障描述"};
|
||||
//列宽
|
||||
for (int i = 0; i < titles.length; i++) {
|
||||
sheet.setColumnWidth(i, 15 * 256);//15个字符宽
|
||||
}
|
||||
sheet.setColumnWidth(titles.length - 1, 60 * 256);//15个字符宽
|
||||
//表头样式
|
||||
CellStyle headerStyle = workbook.createCellStyle();
|
||||
headerStyle.setBorderTop(BorderStyle.THIN);// 设置上边框
|
||||
headerStyle.setBorderBottom(BorderStyle.THIN);// 设置下边框
|
||||
headerStyle.setBorderLeft(BorderStyle.THIN); // 设置左边框
|
||||
headerStyle.setBorderRight(BorderStyle.THIN);// 设置右边框
|
||||
headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index); // 设置前景填充颜色
|
||||
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
headerStyle.setAlignment(HorizontalAlignment.CENTER); // 设置文本居中
|
||||
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 设置垂直居中
|
||||
Font font = workbook.createFont();
|
||||
font.setBold(true); // 设置加粗
|
||||
font.setFontHeightInPoints((short) 14);
|
||||
headerStyle.setFont(font);
|
||||
//数据行样式
|
||||
CellStyle dataStyle = workbook.createCellStyle();
|
||||
dataStyle.setBorderTop(BorderStyle.THIN);// 设置上边框
|
||||
dataStyle.setBorderBottom(BorderStyle.THIN);// 设置下边框
|
||||
dataStyle.setBorderLeft(BorderStyle.THIN); // 设置左边框
|
||||
dataStyle.setBorderRight(BorderStyle.THIN);// 设置右边框
|
||||
dataStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 设置垂直居中
|
||||
//写表头
|
||||
Row rowHeader = sheet.createRow(0);
|
||||
rowHeader.setHeightInPoints(25);
|
||||
for (int i = 0; i < titles.length; i++) {
|
||||
Cell cell = rowHeader.createCell(i);
|
||||
cell.setCellStyle(headerStyle);
|
||||
cell.setCellValue(titles[i]);
|
||||
}
|
||||
//设置数据行样式
|
||||
for (int i = 1; i <= rowCount; i++) {
|
||||
Row row = sheet.createRow(i);
|
||||
row.setHeightInPoints(25);
|
||||
for (int j = 0; j < titles.length; j++) {
|
||||
Cell cell = row.createCell(j);
|
||||
cell.setCellStyle(dataStyle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置名称管理器
|
||||
*/
|
||||
private List<String[]> prcessTableData(Workbook workbook, Sheet sheet) {
|
||||
List<String[]> result = new ArrayList<>();
|
||||
int rowIndex = 0;
|
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(0, 0, 0, 10);
|
||||
sheet.addMergedRegion(cellRangeAddress);
|
||||
Row row = sheet.createRow(rowIndex++);
|
||||
row.setHeightInPoints(25);
|
||||
Cell cell = row.createCell(0);
|
||||
cell.setCellValue("模版的规范性数据,请勿编辑");
|
||||
row = sheet.createRow(rowIndex++);
|
||||
cell = row.createCell(0);
|
||||
cell.setCellValue("设备类型数据");
|
||||
List<RepairDeviceType> deviceTypes = repairIOSerice.getRepairDeviceTypeList();
|
||||
String[] dts = new String[deviceTypes.size()];
|
||||
for (int i = 0; i < deviceTypes.size(); i++) {
|
||||
row = sheet.createRow(rowIndex++);
|
||||
cell = row.createCell(0);
|
||||
cell.setCellValue(deviceTypes.get(i).getName());
|
||||
dts[i] = deviceTypes.get(i).getName();
|
||||
List<RepairDevice> devices = repairIOSerice.getRepairDevice(deviceTypes.get(i).getId());
|
||||
for (int j = 0; j < devices.size(); j++) {
|
||||
cell = row.createCell(j + 1);
|
||||
cell.setCellValue(devices.get(j).getName());
|
||||
}
|
||||
Name name = workbook.createName();
|
||||
name.setNameName(deviceTypes.get(i).getName());
|
||||
String formula = "data" + "!" + buildRange(1, rowIndex, devices.size());
|
||||
name.setRefersToFormula(formula);
|
||||
}
|
||||
result.add(dts);
|
||||
row = sheet.createRow(rowIndex++);
|
||||
cell = row.createCell(0);
|
||||
cell.setCellValue("地点数据");
|
||||
List<RepairAddress> addresses = repairIOSerice.getRepairAddressList();
|
||||
String[] as = new String[addresses.size()];
|
||||
for (int i = 0; i < addresses.size(); i++) {
|
||||
row = sheet.createRow(rowIndex++);
|
||||
cell = row.createCell(0);
|
||||
cell.setCellValue(addresses.get(i).getName());
|
||||
as[i] = addresses.get(i).getName();
|
||||
List<RepairAddressFloor> addressFloors = repairIOSerice.getRepairAddressFloorList(addresses.get(i).getId());
|
||||
for (int j = 0; j < addressFloors.size(); j++) {
|
||||
cell = row.createCell(j + 1);
|
||||
cell.setCellValue(addressFloors.get(j).getName());
|
||||
}
|
||||
Name name = workbook.createName();
|
||||
name.setNameName(addresses.get(i).getName());
|
||||
String formula = "data" + "!" + buildRange(1, rowIndex, addressFloors.size());
|
||||
name.setRefersToFormula(formula);
|
||||
}
|
||||
result.add(as);
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildRange(int offset, int row, int colCount) {
|
||||
char start = (char) ('A' + offset);
|
||||
char end = (char) ('A' + (offset + colCount - 1));
|
||||
return "$" + start + "$" + row + ":$" + end + "$" + row;
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单导入
|
||||
*
|
||||
* @param file execl 表格
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions(value = {"repair:manage:operator"})
|
||||
@PostMapping("/importRepair")
|
||||
public R importData(MultipartFile file) {
|
||||
List<Repair> list = EasyPoiUtils.importExcel(file, 0, 1, Repair.class);
|
||||
if (list == null || list.size() == 0) return R.error("没有找到表格数据");
|
||||
List<Repair> okList = new ArrayList<>();
|
||||
//表格数据检验
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Repair repair = list.get(i);
|
||||
//数据不完整的行直接忽略
|
||||
if (StringUtils.isBlank(repair.getTypeName()) || StringUtils.isBlank(repair.getDeviceName())
|
||||
|| StringUtils.isBlank(repair.getAddress()) || StringUtils.isBlank(repair.getFloor())
|
||||
|| StringUtils.isBlank(repair.getName()) || StringUtils.isBlank(repair.getPhone())
|
||||
|| StringUtils.isBlank(repair.getExplain())) continue;
|
||||
//校验设备类型与设备\地点与楼层
|
||||
String result = repairIOSerice.checkRepair(repair);
|
||||
if (!IRepairIOSerice.OK.equals(result)) return R.error("第" + (i + 2) + "行 " + result);
|
||||
//校验其他字段
|
||||
if (StringUtils.isNotBlank(repair.getRoom())) {
|
||||
repair.setRoom(repair.getRoom().trim());
|
||||
if (repair.getRoom().length() > 10) return R.error("第" + (i + 2) + "行的门牌号字符长度超过10位");
|
||||
}
|
||||
repair.setName(repair.getName().trim());
|
||||
if (repair.getName().length() > 20) return R.error("第" + (i + 2) + "行的报修人姓名字符长度超过20位");
|
||||
repair.setPhone(repair.getPhone().trim());
|
||||
if (repair.getPhone().length() > 15) return R.error("第" + (i + 2) + "行的联系电话字符长度超过15位");
|
||||
repair.setExplain(repair.getExplain().trim());
|
||||
if (repair.getExplain().length() > 300) return R.error("第" + (i + 2) + "行的故障描述字符长度超过300位");
|
||||
okList.add(repair);
|
||||
}
|
||||
//开始导入工单
|
||||
Long userId = getLoginStaffId();
|
||||
int count = 0;
|
||||
for (Repair repair : okList) {
|
||||
String result = repairService.handleFlow(repair, userId, null, null, null);
|
||||
if (IRepairService.OK.equals(result)) count++;
|
||||
}
|
||||
return R.ok("成功导入" + count + "条工单数据");
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.ics.admin.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ics.admin.domain.Repair;
|
||||
import com.ics.admin.service.IRepairService;
|
||||
import com.ics.admin.service.IRepairStatsService;
|
||||
import com.ics.admin.vo.RepairAdminStatsVo;
|
||||
import com.ics.admin.vo.RepairFloorStatsVo;
|
||||
import com.ics.admin.vo.RepairWorkerStatsVo;
|
||||
import com.ics.admin.service.IRepairService;
|
||||
import com.ics.admin.service.IRepairStatsService;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.utils.DateUtils;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.ics.admin.domain;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@ -42,6 +43,7 @@ public class Repair extends BaseEntity<Repair> {
|
||||
/**
|
||||
* 设备类别名称
|
||||
*/
|
||||
@Excel(name = "故障类型")
|
||||
private String typeName;
|
||||
/**
|
||||
* 设备id
|
||||
@ -50,16 +52,19 @@ public class Repair extends BaseEntity<Repair> {
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "设备")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 报修人
|
||||
*/
|
||||
@Excel(name = "报修人姓名")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@Excel(name = "联系电话")
|
||||
private String phone;
|
||||
/**
|
||||
* 报修地点id
|
||||
@ -68,6 +73,7 @@ public class Repair extends BaseEntity<Repair> {
|
||||
/**
|
||||
* 报修地点名称
|
||||
*/
|
||||
@Excel(name = "故障地点")
|
||||
private String address;
|
||||
/**
|
||||
* 报修楼层id
|
||||
@ -76,15 +82,18 @@ public class Repair extends BaseEntity<Repair> {
|
||||
/**
|
||||
* 报修楼层名称
|
||||
*/
|
||||
@Excel(name = "楼层")
|
||||
private String floor;
|
||||
/**
|
||||
* 门牌号
|
||||
*/
|
||||
@Excel(name = "门牌号")
|
||||
private String room;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Excel(name = "故障描述")
|
||||
private String explain;
|
||||
|
||||
//--派单
|
||||
|
@ -30,6 +30,7 @@ public interface RepairAddressFloorMapper extends BaseMapper<RepairAddressFloor>
|
||||
*/
|
||||
List<RepairAddressFloor> selectRepairAddressFloorList(RepairAddressFloor repairAddressFloor);
|
||||
|
||||
List<RepairAddressFloor> getRepairAddressFloorList(Long addressId);
|
||||
/**
|
||||
* 新增地点楼层
|
||||
*
|
||||
|
@ -30,6 +30,7 @@ public interface RepairAddressMapper extends BaseMapper<RepairAddress> {
|
||||
*/
|
||||
List<RepairAddress> selectRepairAddressList(RepairAddress repairAddress);
|
||||
|
||||
List<RepairAddress> getRepairAddressList();
|
||||
/**
|
||||
* 新增报修地址
|
||||
*
|
||||
|
@ -0,0 +1,37 @@
|
||||
package com.ics.admin.mapper;
|
||||
|
||||
import com.ics.admin.vo.RepairCheckVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* created at 2024-8-25 20:28
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface RepairCheckMapper {
|
||||
|
||||
/**
|
||||
* 查询设备类型与设备的对应关系
|
||||
*
|
||||
* @param typeName
|
||||
* @param deviceName
|
||||
* @return
|
||||
*/
|
||||
List<RepairCheckVo> checkDeviceType(@Param("typeName") String typeName, @Param("deviceName") String deviceName);
|
||||
|
||||
/**
|
||||
* 查询地点与楼层的对应关系
|
||||
*
|
||||
* @param addressName
|
||||
* @param floorName
|
||||
* @return
|
||||
*/
|
||||
List<RepairCheckVo> checkAddress(@Param("addressName") String addressName, @Param("floorName") String floorName);
|
||||
|
||||
}
|
@ -30,6 +30,7 @@ public interface RepairDeviceMapper extends BaseMapper<RepairDevice> {
|
||||
*/
|
||||
List<RepairDevice> selectRepairDeviceList(RepairDevice repairDevice);
|
||||
|
||||
List<RepairDevice> getRepairDeviceTypeList(Long typeId);
|
||||
/**
|
||||
* 新增报修设备
|
||||
*
|
||||
|
@ -30,6 +30,8 @@ public interface RepairDeviceTypeMapper extends BaseMapper<RepairDeviceType> {
|
||||
*/
|
||||
List<RepairDeviceType> selectRepairDeviceTypeList(RepairDeviceType repairDeviceType);
|
||||
|
||||
List<RepairDeviceType> getRepairDeviceTypeList();
|
||||
|
||||
/**
|
||||
* 新增设备类型
|
||||
*
|
||||
|
@ -0,0 +1,29 @@
|
||||
package com.ics.admin.service;
|
||||
|
||||
import com.ics.admin.domain.Repair;
|
||||
import com.ics.admin.domain.RepairAddress;
|
||||
import com.ics.admin.domain.RepairAddressFloor;
|
||||
import com.ics.admin.domain.RepairDevice;
|
||||
import com.ics.admin.domain.RepairDeviceType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IRepairIOSerice {
|
||||
String OK = "okay";
|
||||
|
||||
List<RepairDeviceType> getRepairDeviceTypeList();
|
||||
|
||||
List<RepairDevice> getRepairDevice(Long typeId);
|
||||
|
||||
List<RepairAddress> getRepairAddressList();
|
||||
|
||||
List<RepairAddressFloor> getRepairAddressFloorList(Long addressId);
|
||||
|
||||
/**
|
||||
* 检测工单的 设备类型与设备是否对应、地点与楼层对应关系
|
||||
*
|
||||
* @param repair
|
||||
* @return
|
||||
*/
|
||||
String checkRepair(Repair repair);
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.ics.admin.service.impl;
|
||||
|
||||
import com.ics.admin.domain.Repair;
|
||||
import com.ics.admin.domain.RepairAddress;
|
||||
import com.ics.admin.domain.RepairAddressFloor;
|
||||
import com.ics.admin.domain.RepairDevice;
|
||||
import com.ics.admin.domain.RepairDeviceType;
|
||||
import com.ics.admin.mapper.RepairAddressFloorMapper;
|
||||
import com.ics.admin.mapper.RepairAddressMapper;
|
||||
import com.ics.admin.mapper.RepairCheckMapper;
|
||||
import com.ics.admin.mapper.RepairDeviceMapper;
|
||||
import com.ics.admin.mapper.RepairDeviceTypeMapper;
|
||||
import com.ics.admin.service.IRepairIOSerice;
|
||||
import com.ics.admin.vo.RepairCheckVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* created at 2024-8-25 10:31
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class RepairIOSericeImpl implements IRepairIOSerice {
|
||||
|
||||
@Autowired
|
||||
private RepairDeviceTypeMapper repairDeviceTypeMapper;
|
||||
|
||||
@Autowired
|
||||
private RepairDeviceMapper repairDeviceMapper;
|
||||
|
||||
@Autowired
|
||||
private RepairAddressMapper repairAddressMapper;
|
||||
|
||||
@Autowired
|
||||
private RepairAddressFloorMapper repairAddressFloorMapper;
|
||||
|
||||
@Autowired
|
||||
private RepairCheckMapper repairCheckMapper;
|
||||
|
||||
@Override
|
||||
public List<RepairDeviceType> getRepairDeviceTypeList() {
|
||||
return repairDeviceTypeMapper.getRepairDeviceTypeList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairDevice> getRepairDevice(Long typeId) {
|
||||
return repairDeviceMapper.getRepairDeviceTypeList(typeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairAddress> getRepairAddressList() {
|
||||
return repairAddressMapper.getRepairAddressList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RepairAddressFloor> getRepairAddressFloorList(Long addressId) {
|
||||
return repairAddressFloorMapper.getRepairAddressFloorList(addressId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkRepair(Repair repair) {
|
||||
List<RepairCheckVo> list = repairCheckMapper.checkDeviceType(repair.getTypeName(), repair.getDeviceName());
|
||||
if (list == null || list.size() == 0) return "故障类型与设备不匹配";
|
||||
RepairCheckVo repairCheckVo = list.get(0);
|
||||
repair.setTypeId(repairCheckVo.getPid());
|
||||
repair.setDeviceId(repairCheckVo.getSid());
|
||||
list = repairCheckMapper.checkAddress(repair.getAddress(), repair.getFloor());
|
||||
if (list == null || list.size() == 0) return "故障地点与楼层不匹配";
|
||||
repairCheckVo = list.get(0);
|
||||
repair.setAddressId(repairCheckVo.getPid());
|
||||
repair.setFloorId(repairCheckVo.getSid());
|
||||
return IRepairIOSerice.OK;
|
||||
}
|
||||
}
|
@ -208,45 +208,46 @@ public class RepairServiceImpl implements IRepairService {
|
||||
private List<RepairRemind> processRemind(Repair repair, IcsCustomerStaff currentUser, IcsCustomerStaff nextUser, Integer from, Integer to, String content) {
|
||||
List<RepairRemind> rList = new ArrayList<>();//流程提醒
|
||||
Date now = new Date();
|
||||
String remind = repair.getAddress() + "/" + repair.getFloor() + " " + repair.getRoom() + " / " + repair.getExplain();
|
||||
if (from == 0) {//报修
|
||||
if (to == 1)
|
||||
//提醒派单员
|
||||
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getP1(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getP1(), remind), currentUser.getId(), now));
|
||||
if (to == 5)
|
||||
//提醒维修工
|
||||
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getW1(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(0L, nextUser.getId(), String.format(repairRemindContent.getW1(), remind), currentUser.getId(), now));
|
||||
} else if (from == 1) {//派单
|
||||
if (to == 5) {
|
||||
//提醒维修工
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getW1(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getW1(), remind), currentUser.getId(), now));
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR15(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR15(), remind), currentUser.getId(), now));
|
||||
}
|
||||
if (to == 3) {
|
||||
//提醒管理员
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getM1(), repair.getRepairName(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getM1(), remind, StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR1(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR1(), remind), currentUser.getId(), now));
|
||||
}
|
||||
if (to == 11)
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR2(), repair.getRepairName(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR2(), remind, StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
} else if (from == 3) {//重新派单
|
||||
//提醒派单员
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP2(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP2(), remind), currentUser.getId(), now));
|
||||
} else if (from == 5) {//修理工是否接收
|
||||
if (to == 1) {
|
||||
//提醒派单员
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP3(), repair.getRepairName(), currentUser.getUsername(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), nextUser.getId(), String.format(repairRemindContent.getP3(), remind, currentUser.getUsername(), StringUtils.isBlank(content) ? "" : content), currentUser.getId(), now));
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR3(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR3(), remind), currentUser.getId(), now));
|
||||
}
|
||||
if (to == 7)
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR4(), repair.getRepairName(), nextUser.getUsername()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR4(), remind, nextUser.getUsername()), currentUser.getId(), now));
|
||||
} else if (from == 7) {//修理反馈
|
||||
//提醒发起人
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR5(), repair.getRepairName()), currentUser.getId(), now));
|
||||
rList.add(new RepairRemind(repair.getId(), Long.valueOf(repair.getCreateBy()), String.format(repairRemindContent.getR5(), remind), currentUser.getId(), now));
|
||||
}
|
||||
return rList;
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.ics.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备类型与设备、地点与楼层 对应关系校验时使用
|
||||
* created at 2024-8-25 19:34
|
||||
*
|
||||
* @author lujiang
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class RepairCheckVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -202408251934L;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private String pname;
|
||||
|
||||
private Long sid;
|
||||
|
||||
private String sname;
|
||||
|
||||
}
|
@ -39,6 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getRepairAddressFloorList" parameterType="Long" resultMap="RepairAddressFloorResult">
|
||||
<include refid="selectRepairAddressFloorVo"/>
|
||||
where delete_flag=0 and address_id=#{addressId} order by id
|
||||
</select>
|
||||
|
||||
<insert id="insertRepairAddressFloor" parameterType="RepairAddressFloor" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO ics_repair_address_floor
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
@ -28,6 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getRepairAddressList" resultMap="RepairAddressResult">
|
||||
<include refid="selectRepairAddressVo"/>
|
||||
where delete_flag=0 order by id
|
||||
</select>
|
||||
|
||||
<select id="selectRepairAddressById" parameterType="Long" resultMap="RepairAddressResult">
|
||||
<include refid="selectRepairAddressVo"/>
|
||||
WHERE id = #{id}
|
||||
|
@ -0,0 +1,31 @@
|
||||
<?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="com.ics.admin.mapper.RepairCheckMapper">
|
||||
|
||||
<select id="checkDeviceType" resultType="com.ics.admin.vo.RepairCheckVo">
|
||||
SELECT
|
||||
a.id pid, a.name pname, b.id sid, b.name sname
|
||||
FROM ics_repair_device_type a,
|
||||
ics_repair_device b
|
||||
where a.delete_flag = 0
|
||||
and b.delete_flag = 0
|
||||
and a.id = b.type_id
|
||||
and a.name = #{typeName}
|
||||
and b.name = #{deviceName}
|
||||
</select>
|
||||
|
||||
<select id="checkAddress" resultType="com.ics.admin.vo.RepairCheckVo">
|
||||
SELECT
|
||||
a.id pid, a.name pname, b.id sid, b.name sname
|
||||
FROM ics_repair_address a,
|
||||
ics_repair_address_floor b
|
||||
where a.delete_flag = 0
|
||||
and b.delete_flag = 0
|
||||
and a.id = b.address_id
|
||||
and a.name = #{addressName}
|
||||
and b.name = #{floorName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -31,6 +31,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getRepairDeviceTypeList" parameterType="Long" resultMap="RepairDeviceResult">
|
||||
<include refid="selectRepairDeviceVo"/>
|
||||
where delete_flag=0 and type_id= #{typeId} order by id
|
||||
</select>
|
||||
|
||||
<select id="selectRepairDeviceById" parameterType="Long" resultMap="RepairDeviceResult">
|
||||
<include refid="selectRepairDeviceVo"/>
|
||||
WHERE id = #{id}
|
||||
|
@ -32,6 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getRepairDeviceTypeList" resultMap="RepairDeviceTypeResult">
|
||||
<include refid="selectRepairDeviceTypeVo"/>
|
||||
where delete_flag=0 order by id
|
||||
</select>
|
||||
|
||||
<select id="selectRepairDeviceTypeById" parameterType="Long" resultMap="RepairDeviceTypeResult">
|
||||
<include refid="selectRepairDeviceTypeVo"/>
|
||||
WHERE id = #{id} and delete_flag=0
|
||||
|
@ -1,6 +1,6 @@
|
||||
#报修人
|
||||
repair.remind.r1=您的工单《%s》正在重新派单。
|
||||
repair.remind.r15=您的工单《XXXX 工单名称》已派遣维修人员
|
||||
repair.remind.r15=您的工单《%s》已派遣维修人员
|
||||
repair.remind.r2=您的工单《%s》申请无效,原因是:%s
|
||||
repair.remind.r3=您的工单《%s》正在重新派遣维修人员
|
||||
repair.remind.r4=您的工单《%s》维修人员%s开始处理
|
||||
|
Loading…
x
Reference in New Issue
Block a user