提交 6ae038f7 authored 作者: 邓砥奕's avatar 邓砥奕

更新报废单

上级 d8339067
...@@ -8,4 +8,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; ...@@ -8,4 +8,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
* @author dengdiyi * @author dengdiyi
*/ */
public interface RepairBillDao extends JpaRepository<RepairBill,Integer>, JpaSpecificationExecutor<RepairBill> { public interface RepairBillDao extends JpaRepository<RepairBill,Integer>, JpaSpecificationExecutor<RepairBill> {
} }
...@@ -30,4 +30,10 @@ public interface RepairDetailService extends RepairPublicService<RepairDetail> { ...@@ -30,4 +30,10 @@ public interface RepairDetailService extends RepairPublicService<RepairDetail> {
*/ */
RepairDetail updateIdAndStatus(Integer id,Integer status); RepairDetail updateIdAndStatus(Integer id,Integer status);
/**
* @param id 主键id
* 根据主键Id查询
*/
RepairDetail getOne(Integer id);
} }
...@@ -61,4 +61,19 @@ public class RepairDetailServiceImpl implements RepairDetailService { ...@@ -61,4 +61,19 @@ public class RepairDetailServiceImpl implements RepairDetailService {
throw new ApiException(ResultUtil.failed("所查询ID不存在")); throw new ApiException(ResultUtil.failed("所查询ID不存在"));
} }
} }
/**
* @param id 主键id
* 根据主键Id查询
*/
@Override
public RepairDetail getOne(Integer id) {
Optional<RepairDetail> repairDetail = deviceRepairDetailDao.findById(id);
if (repairDetail.isPresent()){
return repairDetail.get();
}
else {
throw new ApiException(ResultUtil.failed("所查询ID不存在"));
}
}
} }
...@@ -92,6 +92,11 @@ public class RepairDetail { ...@@ -92,6 +92,11 @@ public class RepairDetail {
*/ */
@ApiModelProperty(value = "维修备注") @ApiModelProperty(value = "维修备注")
private String remark; private String remark;
/**
* 已报废换新装备详情主键Id(null代表没有报废,0代表已报废还没有换新)
*/
@ApiModelProperty(value = "已报废换新装备详情主键Id(null代表没有报废,0代表已报废还没有换新)")
private Integer newDeviceDetailId;
/** /**
* 创建用户id * 创建用户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 ChangeNewDeviceVo {
@ApiModelProperty(name = "业务id",value = "1")
private Integer taskId;
@ApiModelProperty(name = "维修详情单主键Id",value = "1")
private Integer id;
@ApiModelProperty(name = "装备主键id",value = "1")
private Integer deviceId;
}
import com.tykj.dev.misc.config.AutoDocument;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.*;
/**
* @author zjm
*/
@RestController
@RequestMapping(value = "/scrap")
@AutoDocument
@Api(tags = "报废模块",description = "报废模块")
public class DeviceScrapController {
@ApiOperation(value = "查询列表",notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/summary")
public ResponseEntity<com.tykj.dev.device.scrap.ScrapPage> selectRepairBill(@RequestBody ScrapConditions scrapConditions){
List<ScrapListVo> listVos=new ArrayList<>();
Long time=1598163550704L;
listVos.add(new ScrapListVo(1,"No2.2019号WX12","张馋","李思念","伸莎","MB-001,MC-001","密码机",new Date(time),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
listVos.add(new ScrapListVo(2,"No2.2019号WX13","李生成","许仁","詹彻","MA-001,MP-001","密码机",new Date(time),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
listVos.add(new ScrapListVo(3,"No2.2019号WX14","鲍若人","李奕","陈行","MC-001,M1-001","密码机",new Date(time),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
listVos.add(new ScrapListVo(4,"No2.2019号WX15","李力","石彻","陈镇","MK-001,MC-001","密码机",new Date(time),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
if (scrapConditions.getDimName()!=null) {
for (int i = 0; i < listVos.size(); i++) {
if (((ScrapListVo) (listVos.get(i))).getName().indexOf(scrapConditions.getDimName()) <= -1)
listVos.remove(i);
}
}
if (scrapConditions.getEndTime()!=null && scrapConditions.getStatusTime()!=null) {
listVos.forEach(
scrapListVo -> {
if (scrapConditions.getStatusTime().getTime() < time && scrapConditions.getEndTime().getTime() > time) {
} else {
listVos.remove(scrapListVo);
}
}
);
}
return ResponseEntity.ok(com.tykj.dev.device.scrap.ScrapPage.builder().data(listVos)
.page(scrapConditions.getPage()).size(scrapConditions.getSize()).total(listVos.size()).build());
}
@ApiOperation(value = "查询列表",notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/summary/{scrapId}")
public ResponseEntity<ScrapListVo> selectRepairBill1( @PathVariable Integer scrapId){
Map<Integer,ScrapListVo> map=new HashMap<>();
map.put(1,new ScrapListVo(1,"No2.2019号WX12","张馋","李思念","伸莎","MB-001,MC-001","密码机",new Date(),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
map.put(2,new ScrapListVo(2,"No2.2019号WX13","李生成","许仁","詹彻","MA-001,MP-001","密码机",new Date(),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
map.put(3,new ScrapListVo(3,"No2.2019号WX14","鲍若人","李奕","陈行","MC-001,M1-001","密码机",new Date(),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
map.put(4,new ScrapListVo(4,"No2.2019号WX15","李力","石彻","陈镇","MK-001,MC-001","密码机",new Date(),"国家密码局","192.168.102.211:8087/status/1.jpeg","陈龚",null));
List<DeviceVo> listVos=new ArrayList<>();
Random rand = new Random();
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = rand.nextInt((1000 - 1) + 1) + 1;
for (int i=0;i<3;i++){
DeviceVo deviceVo =DeviceVo.toDo();
deviceVo.setModel("M"+randomNum);
listVos.add(deviceVo);
}
ScrapListVo scrapListVo=map.get(scrapId);
scrapListVo.setList(listVos);
return ResponseEntity.ok(scrapListVo);
}
}
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author zjm
* @version 1.0.0
* @ClassName DeviceVo.java
* @Description TODO
* @createTime 2020年08月19日 16:39:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "报废装备对象", description = "报废装备对象")
public class DeviceVo {
@ApiModelProperty(value = "型号",example = "bmxx")
public String model;
@ApiModelProperty(value = "类别",example = "1")
public Integer type;
@ApiModelProperty(value = "部件",example = "1")
public Integer parts;
@ApiModelProperty(value = "密级",example = "1")
public String secretLevel;
@ApiModelProperty(value = "可见范围(应用领域)",example = "1")
public Integer invisibleRange;
@ApiModelProperty(value ="备注",example = "msg")
public String msg;
/**
* 装备序列号
*/
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
/**
* 生产序列号
*/
@ApiModelProperty(value = "生产序列号")
private String prodNumber;
public static DeviceVo toDo(){
return new DeviceVo("MB-01",1,1,"机密",1,"---","MB0125576p101","MB012374123");
}
}
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author zjm
* @version 1.0.0
* @ClassName Conditions.java
* @Description TODO
* @createTime 2020年08月23日 13:56:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "报废装备查询条件", description = "报废装备查询条件")
public class ScrapConditions {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "开始时间",example = "bmxx",name = "statusTime")
private Date statusTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "结束时间",example = "bmxx",name = "endTime")
private Date endTime;
@ApiModelProperty(value = "模糊搜索",example = "bmxx",name = "dimName")
private String dimName;
@ApiModelProperty(value = "页数",example = "bmxx",name = "page")
private Integer page;
@ApiModelProperty(value = "条数",example = "bmxx",name = "size")
private Integer size;
}
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Column;
import java.util.Date;
import java.util.List;
/**
* @author zjm
* @version 1.0.0
* @ClassName entity.java
* @Description TODO
* @createTime 2020年08月19日 16:07:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "专管员对象", description = "专管员记录")
public class ScrapListVo{
/**
* 主键id
*/
@ApiModelProperty(name = "主键id")
private Integer id ;
/**
* 文号
*/
@ApiModelProperty(value = "文号")
private String docNumber ;
/**
* 监销人
*/
@ApiModelProperty(value = "监销人")
private String supervisor ;
/**
* 主管领导
*/
@ApiModelProperty(value = "主管领导")
private String leader ;
/**
* 承办人
*/
@ApiModelProperty(value = "承办人")
private String undertaker ;
/**
* 型号
*/
@ApiModelProperty(value = "型号")
private String model;
/**
* 名称
*/
@ApiModelProperty(value = "名称")
private String name;
/**
* 报废时间
*/
@ApiModelProperty(value = "报废时间")
private Date scrap;
/**
* 报废单位
*/
private String unitsName;
private String url;
private String v1;
private List<DeviceVo> list;
}
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author LJJ cnljj1995@gmail.com
* on 2020-04-26
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "报废单分页", description = "报废单分页")
@Builder
public class ScrapPage {
@ApiModelProperty(value = "总数",example = "10")
private Integer total;
@ApiModelProperty(value = "页数,0开始",example = "0")
private Integer page;
@ApiModelProperty(value = "大小",example = "10")
private Integer size;
@ApiModelProperty(value = "数据内容",example = "略")
private List<ScrapListVo> data;
}
...@@ -10,14 +10,22 @@ import java.util.stream.Collectors; ...@@ -10,14 +10,22 @@ import java.util.stream.Collectors;
*/ */
public class GlobalMap { public class GlobalMap {
private static Map<Integer, StatusEnum> statusEnumMap; private static final Map<Integer, StatusEnum> statusEnumMap;
private static final Map<Integer,RepairStatusEnum> repairStatusMap;
static { static {
statusEnumMap = Arrays.stream(StatusEnum.values()) statusEnumMap = Arrays.stream(StatusEnum.values())
.collect(Collectors.toMap(statusEnum -> statusEnum.id, Function.identity())); .collect(Collectors.toMap(statusEnum -> statusEnum.id, Function.identity()));
repairStatusMap = Arrays.stream(RepairStatusEnum.values())
.collect(Collectors.toMap(repairStatusEnum -> repairStatusEnum.id,Function.identity()));
} }
public static Map<Integer, StatusEnum> getStatusEnumMap() { public static Map<Integer, StatusEnum> getStatusEnumMap() {
return statusEnumMap; return statusEnumMap;
} }
public static Map<Integer, RepairStatusEnum> getRepairStatusMap() {
return repairStatusMap;
}
} }
package com.tykj.dev.device.task.subject.common;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 维修状态枚举
*/
@AllArgsConstructor
public enum RepairStatusEnum {
/**
* 等待维修
*/
WAIT_REPAIR(0,"等待维修"),
/**
* 维修中
*/
REPAIRING(1,"维修中"),
/**
* 待领取
*/
WAIT_RECEIVE(2,"待领取"),
/**
* 换新
*/
CHANGE_NEW(3,"换新"),
/**
* 已报废
*/
SCRAPPED(4,"已报废"),
/**
* 已领取
*/
RECEIVED(5,"已领取")
;
public Integer id;
public String name;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论