功能完善

master
薛宏祥 11 months ago
parent 1afe400ff8
commit e12fc742e6
  1. 7
      src/main/java/org/springblade/modules/business/contraller/DeviceController.java
  2. 6
      src/main/java/org/springblade/modules/business/contraller/MaintenanceController.java
  3. 3
      src/main/java/org/springblade/modules/business/pojo/dto/DeviceDTO.java
  4. 30
      src/main/java/org/springblade/modules/business/pojo/dto/MaintenanceTaskDto.java
  5. 5
      src/main/java/org/springblade/modules/business/pojo/entity/Device.java
  6. 357
      src/main/java/org/springblade/modules/business/pojo/entity/maintenance/MaintenanceTask.java
  7. 7
      src/main/java/org/springblade/modules/business/pojo/entity/workorder/WorkOrder.java
  8. 6
      src/main/java/org/springblade/modules/business/pojo/vo/DeviceVO.java
  9. 2
      src/main/java/org/springblade/modules/business/service/impl/MaintenancePlanServiceImpl.java
  10. 162
      src/main/java/org/springblade/modules/business/service/impl/WorkOrderServiceImpl.java
  11. BIN
      src/main/resources/excel/WorkOrderServiceSheet.xlsx

@ -31,6 +31,8 @@ import org.springblade.modules.business.pojo.vo.DeviceVO;
import org.springblade.modules.business.service.IDeviceAttachService;
import org.springblade.modules.business.service.IDeviceMaintenanceService;
import org.springblade.modules.business.service.IDeviceService;
import org.springblade.modules.system.pojo.entity.User;
import org.springblade.modules.system.service.IUserService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -51,6 +53,7 @@ public class DeviceController extends BladeController {
private final IDeviceService deviceService;
private final IDeviceAttachService deviceAttachService;
private final IDeviceMaintenanceService maintenanceService;
private final IUserService userService;
/**
* 设备表 详情
@ -89,6 +92,10 @@ public class DeviceController extends BladeController {
wrapper.like(StringUtils.isNotBlank(device.getSupplier()), Device::getSupplier, device.getSupplier());
wrapper.eq(device.getLimsId() != null, Device::getLimsId, device.getLimsId());
wrapper.eq(device.getRunStatus() != null, Device::getRunStatus, device.getRunStatus());
if (device.getCreateUser() != null) {
User user = userService.getById(device.getCreateUser());
wrapper.eq(Device::getLimsId, user.getDeptId());
}
// wrapper.eq(Device::getCreateUser, AuthUtil.getUserId());
wrapper.orderByDesc(Device::getCreateTime);
try {

@ -296,6 +296,12 @@ public class MaintenanceController extends BladeController {
MaintenanceTask task = taskDto.getTask();
MaintenanceTask taskOld = taskService.getById(task.getId());
taskOld.setRepairStatus(MaintenanceStatusEnum.REPAIR_SERVICEMAN_CREATE.getValue());
taskOld.setFaultCause(taskDto.getFaultCause());
taskOld.setFaultDescribe(taskDto.getFaultDescribe());
taskOld.setProcessingResult(taskDto.getProcessingResult());
taskOld.setTravelExpense(taskDto.getTravelExpense());
taskOld.setInspectionConclusion(taskDto.getInspectionConclusion());
taskOld.setTotalPrice(taskDto.getTotalPrice());
taskService.updateById(taskOld);
List<MaintenanceTaskDetail> detailList = taskDto.getDetailList();
for (MaintenanceTaskDetail maintenanceTaskDetail : detailList) {

@ -50,5 +50,6 @@ public class DeviceDTO extends Device {
//单位
private String unit;
//用户
private Long createUser;
}

@ -19,4 +19,34 @@ public class MaintenanceTaskDto {
MaintenanceTask task;
List<MaintenanceTaskDetail> detailList;
/**
* 故障现象
*/
private String faultDescribe;
/**
* 故障产生原因
*/
private String faultCause;
/**
* 处理结果
*/
private String processingResult;
/**
* 差旅费
*/
private Double travelExpense;
/**
* 巡检结论
*/
private String inspectionConclusion;
/**
* 总价
*/
private Double totalPrice;
}

@ -116,4 +116,9 @@ public class Device extends BaseEntity {
* 单位
*/
private String unit;
/**
* 描述
*/
private String description;
}

@ -24,168 +24,197 @@ import java.util.List;
@Schema(description = "维保任务")
public class MaintenanceTask extends BaseEntity {
/**
* 业务状态, 0:正常 1异常
*/
@Schema(description = "业务状态", hidden = true)
private Integer status;
/**
* 计划ID
*/
private Long planId;
/**
* 巡检单号
*/
private String taskCode;
/**
* 单位
*/
private Long deptId;
/**
* 单位名称
*/
private String deptName;
/**
* 项目名称
*/
private String taskName;
/**
* 项目地址
*/
private String address;
/**
* 巡检人
*/
private Long servicemanId;
/**
* 巡检人
*/
private String servicemanName;
/**
* 巡检说明
*/
private String taskContent;
/**
* 计划开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/**
* 预约上门时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date reservationTime;
/**
* 附件详情
*/
@TableField(exist = false)
private String statusSearch;
/**
* 任务状态
*/
private Integer taskStatus;
/**
* 巡检完成时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date finishTime;
/**
* 维修状态
*/
private Integer repairStatus;
/**
* 审批结果0不通过 1通过
*/
private Integer approveResult;
/**
* 审核节点
*/
private String approvePoint;
/**
* 审批人
*/
private Long approvePerson;
/**
* 审批时间
*/
private Date approveTime;
/**
* 审批备注
*/
private String approveRemark;
/**
* 附件详情
*/
@TableField(exist = false)
private List<DeviceAttach> attaches;
/**
* 评价质量是否满意(0否 1是)
*/
private Integer isOkQuality;
/**
* 评价安全是否满意(0否 1是)
*/
private Integer isOkSecure;
/**
* 评价时效是否满意(0否 1是)
*/
private Integer isOkValidity;
/**
* 签名图片地址
*/
private String signatureUrl;
/**
* 签名人
*/
private String signaturePerson;
/**
* 签名时间
*/
private Date signatureTime;
/**
* 签字图片地址
*/
private String signUrl;
/**
* 备注
*/
private String remark;
/**
* 计划详情
*/
@TableField(exist = false)
private List<MaintenanceTaskDetail> details;
/**
* 业务状态, 0:正常 1异常
*/
@Schema(description = "业务状态", hidden = true)
private Integer status;
/**
* 计划ID
*/
private Long planId;
/**
* 巡检单号
*/
private String taskCode;
/**
* 单位
*/
private Long deptId;
/**
* 单位名称
*/
private String deptName;
/**
* 项目名称
*/
private String taskName;
/**
* 项目地址
*/
private String address;
/**
* 巡检人
*/
private Long servicemanId;
/**
* 巡检人
*/
private String servicemanName;
/**
* 巡检说明
*/
private String taskContent;
/**
* 计划开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startTime;
/**
* 预约上门时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date reservationTime;
/**
* 附件详情
*/
@TableField(exist = false)
private String statusSearch;
/**
* 任务状态
*/
private Integer taskStatus;
/**
* 巡检完成时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date finishTime;
/**
* 维修状态
*/
private Integer repairStatus;
/**
* 审批结果0不通过 1通过
*/
private Integer approveResult;
/**
* 审核节点
*/
private String approvePoint;
/**
* 审批人
*/
private Long approvePerson;
/**
* 审批时间
*/
private Date approveTime;
/**
* 审批备注
*/
private String approveRemark;
/**
* 附件详情
*/
@TableField(exist = false)
private List<DeviceAttach> attaches;
/**
* 评价质量是否满意(0否 1是)
*/
private Integer isOkQuality;
/**
* 评价安全是否满意(0否 1是)
*/
private Integer isOkSecure;
/**
* 评价时效是否满意(0否 1是)
*/
private Integer isOkValidity;
/**
* 签名图片地址
*/
private String signatureUrl;
/**
* 签名人
*/
private String signaturePerson;
/**
* 签名时间
*/
private Date signatureTime;
/**
* 签字图片地址
*/
private String signUrl;
/**
* 备注
*/
private String remark;
/**
* 计划详情
*/
@TableField(exist = false)
private List<MaintenanceTaskDetail> details;
/**
* 故障现象
*/
private String faultDescribe;
/**
* 故障产生原因
*/
private String faultCause;
/**
* 处理结果
*/
private String processingResult;
/**
* 差旅费
*/
private Double travelExpense;
/**
* 巡检结论
*/
private String inspectionConclusion;
/**
* 总价
*/
private Double totalPrice;
}

@ -239,7 +239,12 @@ public class WorkOrder extends BaseEntity {
private Integer repairType;
/**
* 维修类型 1紧急维修 2故障维修 3改造需求
* 人工费
*/
private Double laborCost;
/**
* 差旅费
*/
private Double travelExpense;
}

@ -18,9 +18,9 @@ import java.util.List;
@Data
@EqualsAndHashCode(callSuper = true)
public class DeviceVO extends Device {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
List<DeviceAttach> attaches;
List<DeviceMaintenance> maintenances;
List<DeviceAttach> attaches;
List<DeviceMaintenance> maintenances;
}

@ -338,6 +338,8 @@ public class MaintenancePlanServiceImpl extends BaseServiceImpl<MaintenancePlanM
// 保存任务详情
List<MaintenanceTaskDetail> taskDetails = new ArrayList<>();
MaintenanceTaskDetail maintenanceTaskDetail = new MaintenanceTaskDetail();
List<MaintenanceTask> list = taskService.list(Wrappers.lambdaQuery(MaintenanceTask.class).eq(MaintenanceTask::getPlanId, planId));
for (MaintenancePlanDetail newPlanDetail : newDetails) {
MaintenanceTaskDetail taskDetail = new MaintenanceTaskDetail();
taskDetail.setTaskId(maintenanceTask.getId());

@ -7,6 +7,7 @@ import com.alibaba.excel.metadata.data.ImageData;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import io.undertow.util.FileUtils;
import jakarta.servlet.ServletOutputStream;
@ -572,6 +573,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//数据获取
String templateFileName = "WorkOrderServiceSheet.xlsx";
InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream("excel" + "/" + templateFileName);
Map<String, Object> map = new HashMap<>();
double total = workOrder.getTotalPrice();
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
List<WorkOrderRepairMaterial> workOrderRepairMaterialList = workOrderRepairMaterialService.list(Wrappers.lambdaQuery(WorkOrderRepairMaterial.class).eq(WorkOrderRepairMaterial::getOrderId, workOrder.getId()));
@ -587,29 +589,32 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
workOrderFillData.setPrice(price);
workOrderFillDataList.add(workOrderFillData);
}
ImageExcelData imageExcelData = new ImageExcelData();
imageExcelData.setUrl(new URL(workOrder.getSignatureUrl()));
// ImageExcelData imageExcelData = new ImageExcelData();
// imageExcelData.setUrl(new URL(workOrder.getSignatureUrl()));
//获取签字图片
URL url = new URL(workOrder.getSignatureUrl());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
InputStream inputStream = httpURLConnection.getInputStream();
BufferedImage image = ImageIO.read(inputStream);
if (image != null) {
System.out.println("图片加载成功");
} else {
System.out.println("图片加载失败");
throw new IOException();
Optional<String> signatureUrl = Optional.ofNullable(workOrder.getSignatureUrl());
if (signatureUrl.isPresent() && StringUtils.isNotBlank(signatureUrl.get())) {
URL url = new URL(signatureUrl.get());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
InputStream inputStream = httpURLConnection.getInputStream();
BufferedImage image = ImageIO.read(inputStream);
if (image != null) {
System.out.println("图片加载成功");
} else {
System.out.println("图片加载失败");
throw new IOException();
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", byteArrayOutputStream); // 将图片写入输出流
byte[] imageBytes = byteArrayOutputStream.toByteArray();
Double width = Double.valueOf(image.getWidth());
Double height = Double.valueOf(image.getHeight());
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(imageBytes, width, height, 0.6, 1.9);
map.put("image", voidWriteCellData);
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", byteArrayOutputStream); // 将图片写入输出流
byte[] imageBytes = byteArrayOutputStream.toByteArray();
Double width = Double.valueOf(image.getWidth());
Double height = Double.valueOf(image.getHeight());
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(imageBytes, width, height, 0.6, 1.9);
User repairPerson = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, workOrder.getRepairPerson()));
Map<String, Object> map = new HashMap<>();
User customer = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, workOrder.getInformant()));
map.put("customerName", customer.getRealName());
map.put("informant", customer.getRealName());
@ -621,28 +626,38 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
map.put("processMethod", workOrder.getProcessMethod());
map.put("repairPerson", repairPerson.getRealName());
map.put("repairPersonPhone", repairPerson.getPhone());
map.put("laborCost", workOrder.getLaborCost());
//转换日期格式
Date finishTime = workOrder.getFinishTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("finishTime", simpleDateFormat.format(finishTime));
map.put("image", voidWriteCellData);
Device device = deviceService.getOne(Wrappers.lambdaQuery(Device.class).eq(Device::getId, workOrder.getDeviceId()));
Optional<Integer> isWarran = Optional.ofNullable(device.getIsWarran());
if (isWarran.isPresent()) {
if (isWarran.get() == 1) {
map.put("in", "--");
map.put("out", total);
map.put("sel2", "√");
} else {
map.put("in", total);
Optional<Date> finishTime = Optional.ofNullable(workOrder.getFinishTime());
if (finishTime.isPresent()) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("finishTime", simpleDateFormat.format(finishTime.get()));
}
Optional<Device> device = Optional.ofNullable(deviceService.getOne(Wrappers.lambdaQuery(Device.class).eq(Device::getId, workOrder.getDeviceId())));
if (device.isPresent()) {
Optional<Long> limsId = Optional.ofNullable(device.get().getLimsId());
if (limsId.isPresent()) {
map.put("in", total + workOrder.getLaborCost());
map.put("out", "--");
map.put("sel1", "√");
map.put("sel2", null);
map.put("inTravel", workOrder.getTravelExpense());
map.put("outTravel", "--");
} else {
map.put("in", "--");
map.put("out", total + workOrder.getLaborCost());
map.put("sel2", "√");
map.put("sel1", null);
map.put("outTravel", workOrder.getTravelExpense());
map.put("inTravel", "--");
}
} else {
map.put("in", "--");
map.put("out", "--");
map.put("out", total + workOrder.getLaborCost());
map.put("sel2", "√");
map.put("sel1", null);
map.put("outTravel", workOrder.getTravelExpense());
map.put("inTravel", "--");
}
Optional<Integer> status = Optional.ofNullable(workOrder.getStatus());
if (status.isPresent()) {
@ -673,6 +688,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//数据获取
String templateFileName = "WorkOrderServiceSheet.xlsx";
InputStream fileInputStream = this.getClass().getClassLoader().getResourceAsStream("excel" + "/" + templateFileName);
Map<String, Object> map = new HashMap<>();
double total = workOrder.getTotalPrice();
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
List<WorkOrderRepairMaterial> workOrderRepairMaterialList = workOrderRepairMaterialService.list(Wrappers.lambdaQuery(WorkOrderRepairMaterial.class).eq(WorkOrderRepairMaterial::getOrderId, workOrder.getId()));
@ -688,29 +704,32 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
workOrderFillData.setPrice(price);
workOrderFillDataList.add(workOrderFillData);
}
ImageExcelData imageExcelData = new ImageExcelData();
imageExcelData.setUrl(new URL(workOrder.getSignatureUrl()));
// ImageExcelData imageExcelData = new ImageExcelData();
// imageExcelData.setUrl(new URL(workOrder.getSignatureUrl()));
//获取签字图片
URL url = new URL(workOrder.getSignatureUrl());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
InputStream inputStream = httpURLConnection.getInputStream();
BufferedImage image = ImageIO.read(inputStream);
if (image != null) {
System.out.println("图片加载成功");
} else {
System.out.println("图片加载失败");
throw new IOException();
Optional<String> signatureUrl = Optional.ofNullable(workOrder.getSignatureUrl());
if (signatureUrl.isPresent() && StringUtils.isNotBlank(signatureUrl.get())) {
URL url = new URL(signatureUrl.get());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoInput(true);
InputStream inputStream = httpURLConnection.getInputStream();
BufferedImage image = ImageIO.read(inputStream);
if (image != null) {
System.out.println("图片加载成功");
} else {
System.out.println("图片加载失败");
throw new IOException();
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", byteArrayOutputStream); // 将图片写入输出流
byte[] imageBytes = byteArrayOutputStream.toByteArray();
Double width = Double.valueOf(image.getWidth());
Double height = Double.valueOf(image.getHeight());
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(imageBytes, width, height, 0.6, 1.9);
map.put("image", voidWriteCellData);
}
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ImageIO.write(image, "png", byteArrayOutputStream); // 将图片写入输出流
byte[] imageBytes = byteArrayOutputStream.toByteArray();
Double width = Double.valueOf(image.getWidth());
Double height = Double.valueOf(image.getHeight());
WriteCellData<Void> voidWriteCellData = TemplateExcelUtils.imageCells(imageBytes, width, height, 0.6, 1.9);
User repairPerson = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, workOrder.getRepairPerson()));
Map<String, Object> map = new HashMap<>();
User customer = userService.getOne(Wrappers.lambdaQuery(User.class).eq(User::getId, workOrder.getInformant()));
map.put("customerName", customer.getRealName());
map.put("informant", customer.getRealName());
@ -722,28 +741,35 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
map.put("processMethod", workOrder.getProcessMethod());
map.put("repairPerson", repairPerson.getRealName());
map.put("repairPersonPhone", repairPerson.getPhone());
map.put("laborCost", workOrder.getLaborCost());
//转换日期格式
Date finishTime = workOrder.getFinishTime();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("finishTime", simpleDateFormat.format(finishTime));
map.put("image", voidWriteCellData);
Device device = deviceService.getOne(Wrappers.lambdaQuery(Device.class).eq(Device::getId, workOrder.getDeviceId()));
Optional<Integer> isWarran = Optional.ofNullable(device.getIsWarran());
if (isWarran.isPresent()) {
if (isWarran.get() == 1) {
map.put("in", "--");
map.put("ou", total);
map.put("sel2", "√");
} else {
map.put("in", total);
Optional<Date> finishTime = Optional.ofNullable(workOrder.getFinishTime());
if (finishTime.isPresent()) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
map.put("finishTime", simpleDateFormat.format(finishTime.get()));
}
Optional<Device> device = Optional.ofNullable(deviceService.getOne(Wrappers.lambdaQuery(Device.class).eq(Device::getId, workOrder.getDeviceId())));
if (device.isPresent()) {
Optional<Long> limsId = Optional.ofNullable(device.get().getLimsId());
if (limsId.isPresent()) {
map.put("in", total + workOrder.getLaborCost());
map.put("out", "--");
map.put("sel1", "√");
map.put("sel2", null);
map.put("inTravel", workOrder.getTravelExpense());
} else {
map.put("in", "--");
map.put("out", total + workOrder.getLaborCost());
map.put("sel2", "√");
map.put("sel1", null);
map.put("outTravel", workOrder.getTravelExpense());
}
} else {
map.put("in", "--");
map.put("out", "--");
map.put("out", total + workOrder.getLaborCost());
map.put("sel2", "√");
map.put("sel1", null);
map.put("outTravel", workOrder.getTravelExpense());
}
Optional<Integer> status = Optional.ofNullable(workOrder.getStatus());
if (status.isPresent()) {

Loading…
Cancel
Save