提交 3b230c68 authored 作者: 邓砥奕's avatar 邓砥奕

更新维修

上级 57dfbf37
package com.tykj.dev.device.library.repository;
import com.tykj.dev.device.library.subject.domin.DeviceUseReport;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface DeviceUseReportDao extends JpaRepository<DeviceUseReport,Integer>, JpaSpecificationExecutor<DeviceUseReport> {
}
package com.tykj.dev.device.library.service;
import com.tykj.dev.device.library.subject.domin.DeviceUseReport;
import com.tykj.dev.device.library.subject.vo.DeviceUseReportCreateVo;
import com.tykj.dev.device.library.subject.vo.DeviceUseReportSelectVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* @author dengdiyi
*/
public interface DeviceUseReportService {
DeviceUseReport addEntity(DeviceUseReport deviceUseReportEntity);
Page<DeviceUseReport> getPage(DeviceUseReportSelectVo deviceUseReportSelectVo, Pageable pageable);
DeviceUseReport getOne(Integer id);
DeviceUseReport update(DeviceUseReport deviceUseReportEntity);
DeviceUseReport createReport(DeviceUseReportCreateVo deviceUseReportCreateVo);
void delete(Integer id);
}
package com.tykj.dev.device.library.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
* entity class for device_use_report
* 装备使用报告
*/
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update device_use_report set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("装备使用报告")
public class DeviceUseReport {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id")
private Integer id;
/**
* 报告标题
*/
@ApiModelProperty(value = "报告标题")
private String title;
/**
* 报告所属单位
*/
@ApiModelProperty(value = "报告所属单位")
private String unit;
/**
* 报告详情(入库数x退回数x退装数x维修数x销毁数x配发数x列装数)
*/
@ApiModelProperty(value = "报告详情(入库数x退回数x退装数x维修数x销毁数x配发数x列装数)")
private String reportDetail;
/**
* 创建用户id
*/
@CreatedBy
@ApiModelProperty(value = "创建用户id")
private Integer createUserId;
/**
* 创建时间
*/
@CreatedDate
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 更新用户id
*/
@LastModifiedBy
@ApiModelProperty(value = "更新用户id")
private Integer updateUserId;
/**
* 更新时间
*/
@LastModifiedDate
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 删除标记(0:未删除,1:已删除)
*/
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0;
}
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Repository;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备使用报告生成类")
@Repository
public class DeviceUseReportCreateVo {
@ApiModelProperty(value = "开始时间",example = "2020-10-10 01:10:10")
public Date startTime;
@ApiModelProperty(value = "结束时间",example = "2020-10-10 01:10:10")
public Date endTime;
}
package com.tykj.dev.device.library.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备使用报告详情返回类")
public class DeviceUseReportDetailVo {
@ApiModelProperty(value = "标题",example = "标题")
private String title;
@ApiModelProperty(value = "所属单位",example = "省机要局")
private String unit;
@ApiModelProperty(value = "装备类型总数",example = "100")
private Integer deviceNumber;
@ApiModelProperty(value = "入库数量",example = "10")
private Integer inLibraryNum;
@ApiModelProperty(value = "维修数量",example = "10")
private Integer repairNum;
@ApiModelProperty(value = "销毁数量",example = "10")
private Integer destoryNum;
@ApiModelProperty(value = "清退数量",example = "10")
private Integer sendBackNum;
@ApiModelProperty(value = "配发数量",example = "10")
private Integer allotNum;
@ApiModelProperty(value = "列装数量",example = "10")
private Integer packingNum;
@ApiModelProperty(value = "退装数量",example = "10")
private Integer retiredNum;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
package com.tykj.dev.device.library.subject.vo;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备使用报告查询")
public class DeviceUseReportSelectVo extends CustomPage {
@ApiModelProperty(value = "模糊查询关键字",example = "测试")
public String content;
@ApiModelProperty(value = "开始时间",example = "2020-10-10 01:10:10")
public Date startTime;
@ApiModelProperty(value = "结束时间",example = "2020-10-10 01:10:10")
public Date endTime;
}
......@@ -411,8 +411,8 @@ public class RepairController {
RepairOutPutDeviceVo repairOutPutDeviceVo = new RepairOutPutDeviceVo();
//获取业务和账单
TaskBto taskBto = taskService.get(id);
RepairBill RepairBill= deviceRepairBillService.getOne(taskBto.getBillId());
repairOutPutDeviceVo.setRepairBill(RepairBill);
RepairBill repairBill= deviceRepairBillService.getOne(taskBto.getBillId());
repairOutPutDeviceVo.setRepairBill(repairBill);
List<DeviceLibrary> deviceLibraryEntities = new ArrayList<>();
//筛选所有还没修好装备的id
List<Integer> idList = deviceRepairDetailService.findByBillId(taskBto.getBillId()).stream()
......@@ -432,6 +432,7 @@ public class RepairController {
// RepairBill repairbill= new RepairBill();
// RepairSendBill repairSendBill = new RepairSendBill();
// Integer userId = userUtils.getCurrentUserId();
//
// BeanUtils.copyProperties(repairBillSaveVo,repairbill);
// BeanUtils.copyProperties(repairBillSaveVo,repairSendBill);
// repairbill.setRepairStatus(0);
......@@ -534,7 +535,7 @@ public class RepairController {
List<Integer> userIds = new ArrayList<>();
userIds.add(userId);
userIds.add(repairBackBillSaveVo.getStartUserbId());
TaskBto taskBto1 = new TaskBto(StatusEnum.REPAIR_BACK_CONFIRM.id, "维修退回", taskBto.getId(), "."+taskBto.getId()+".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds);
TaskBto taskBto1 = new TaskBto(StatusEnum.REPAIR_BACK_CONFIRM.id, "维修退回", taskBto.getId(), taskBto.getNodeIdDetail()+taskBto.getId()+".", deviceRepairBackBillEntity1.getId(), BusinessEnum.REPAIR_BACK.id, userUtils.getCurrentUnitId(), 1, null, userIds);
Task task = taskService.start(taskBto1);
//添加业务日志
List<FileVo> fileVoList = new ArrayList<>();
......@@ -763,4 +764,27 @@ public class RepairController {
return ResultUtil.failed("status只能为0或1");
}
}
@ApiOperation(value = "更改维修装备状态",notes = "可以通过这个接口更改维修装备状态")
@PostMapping(value = "/change")
public ResponseEntity<String> changeRepairDeviceStatus(@RequestBody RepairStatusChangeVo repairStatusChangeVo){
//获取当前任务
TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId());
//获取所有父任务id
List<Integer> fathers = StringSplitUtil.taskIdSplit(taskBto.getNodeIdDetail());
//修改当前任务维修详情单该装备状态
deviceRepairDetailService.updateIdAndStatus(repairStatusChangeVo.getId(),repairStatusChangeVo.getNewStatus());
//修改父任务中所有维修详情单中的该装备的状态
if (fathers.size()>0) {
fathers.forEach(integer -> {
deviceRepairDetailService.findByBillId(integer).stream()
.filter(repairDetail -> repairDetail.getDeviceId().equals(repairStatusChangeVo.getDeviceId()))
.forEach(repairDetail -> {
repairDetail.setRepairStatus(repairStatusChangeVo.getNewStatus());
deviceRepairDetailService.update(repairDetail);
});
});
}
return ResultUtil.success("修改成功");
}
}
......@@ -16,7 +16,7 @@ public interface RepairDetailService extends RepairPublicService<RepairDetail> {
/**
* 根据billid查询维修单的设备
* @param billID 维修单id
* @param billId 维修单id
* @return 所对应的装备信息
*/
List<RepairDetail> findByBillId(Integer billId);
......
......@@ -3,10 +3,13 @@ package com.tykj.dev.device.repair.service.impl;
import com.tykj.dev.device.repair.repository.RepairDetailDao;
import com.tykj.dev.device.repair.service.RepairDetailService;
import com.tykj.dev.device.repair.subject.domin.RepairDetail;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
/**
* @author zjm
......@@ -47,6 +50,15 @@ public class RepairDetailServiceImpl implements RepairDetailService {
@Override
public RepairDetail updateIdAndStatus(Integer id, Integer status) {
return null;
Optional<RepairDetail> repairDetail = deviceRepairDetailDao.findById(id);
if (repairDetail.isPresent()){
RepairDetail repairDetail1 = repairDetail.get();
repairDetail1.setRepairStatus(status);
deviceRepairDetailDao.save(repairDetail1);
return repairDetail1;
}
else {
throw new ApiException(ResultUtil.failed("所查询ID不存在"));
}
}
}
package com.tykj.dev.device.repair.subject.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author dengdiyi
*/
@Data
@ApiModel("装备维修状态修改类")
public class RepairStatusChangeVo {
@ApiModelProperty(name = "业务id",value = "1")
private Integer taskId;
@ApiModelProperty(name = "维修详情单主键Id",value = "1")
private Integer id;
@ApiModelProperty(name = "装备主键id",value = "1")
private Integer deviceId;
@ApiModelProperty(name = "新的维修状态",value = "1")
private Integer newStatus;
}
......@@ -194,7 +194,7 @@ public class StorageBillController {
deviceLogService.addLog(deviceLogDto);
}
myWebSocket.sendMessage1();
return ResultUtil.success("审核通过列装成功");
return ResultUtil.success("审核通过入库成功");
}
//2.审核失败
if (storageBillConfirmVo.getStatus()==1){
......
......@@ -114,7 +114,7 @@ public class TaskController {
List<TaskLogUserVo> taskLogUserVos = taskLogService.getByTaskId(taskId);
//查询所有子业务
List<TaskBto> taskBtos = taskDao.findAll().stream()
.filter(task -> task.getNodeIdDetail().contains("." + taskId + "."))
.filter(task -> task.getNodeIdDetail()!=null&&task.getNodeIdDetail().contains("." + taskId + "."))
.map(Task::parse2Bto)
.collect(Collectors.toList());
//添加子业务日志
......
......@@ -60,4 +60,21 @@ public class StringSplitUtil {
}
return stringBuffer.toString();
}
public static List<Integer> taskIdSplit(String s){
List<Integer> list = new ArrayList<>();
if (s!=null) {
//按分隔符.分隔
String[] strings = s.split("\\.");
//遍历获取id
if (strings.length != 0) {
for (String str : strings) {
if (str.length() > 0) {
list.add(Integer.valueOf(str));
}
}
}
}
return list;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论