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

完成报废单接口

上级 f6f56043
...@@ -7,6 +7,7 @@ import com.tykj.dev.device.allot.service.AllotBillService; ...@@ -7,6 +7,7 @@ import com.tykj.dev.device.allot.service.AllotBillService;
import com.tykj.dev.device.allot.subject.domin.AllotBill; import com.tykj.dev.device.allot.subject.domin.AllotBill;
import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo; import com.tykj.dev.device.allot.subject.vo.AllotBillSelectVo;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -30,6 +31,9 @@ public class AllotBillServiceImpl implements AllotBillService { ...@@ -30,6 +31,9 @@ public class AllotBillServiceImpl implements AllotBillService {
@Autowired @Autowired
private UserPublicService userPublicService; private UserPublicService userPublicService;
@Autowired
private UserUtils userUtils;
@Override @Override
public AllotBill addEntity(AllotBill allotBillEntity) { public AllotBill addEntity(AllotBill allotBillEntity) {
return allotBillDao.save(allotBillEntity); return allotBillDao.save(allotBillEntity);
...@@ -70,6 +74,10 @@ public class AllotBillServiceImpl implements AllotBillService { ...@@ -70,6 +74,10 @@ public class AllotBillServiceImpl implements AllotBillService {
private Specification<AllotBill> getSelectSpecification(AllotBillSelectVo allotBillSelectVo){ private Specification<AllotBill> getSelectSpecification(AllotBillSelectVo allotBillSelectVo){
PredicateBuilder<AllotBill> predicateBuilder = Specifications.and(); PredicateBuilder<AllotBill> predicateBuilder = Specifications.and();
PredicateBuilder<AllotBill> predicateBuilder1 = Specifications.or();
predicateBuilder1.eq("sendUnit",userUtils.getCurrentUserUnitName());
predicateBuilder1.eq("receiveUnit",userUtils.getCurrentUserUnitName());
predicateBuilder.predicate(predicateBuilder1.build());
if (allotBillSelectVo!=null) { if (allotBillSelectVo!=null) {
if (allotBillSelectVo.getReplayNumber()!=null){ if (allotBillSelectVo.getReplayNumber()!=null){
predicateBuilder.eq("replayNumber",allotBillSelectVo.getReplayNumber()); predicateBuilder.eq("replayNumber",allotBillSelectVo.getReplayNumber());
......
...@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao; ...@@ -5,6 +5,7 @@ import com.tykj.dev.device.library.repository.DeviceLibraryDao;
import com.tykj.dev.device.library.repository.DeviceLogDao; import com.tykj.dev.device.library.repository.DeviceLogDao;
import com.tykj.dev.device.library.service.DeviceChangeService; import com.tykj.dev.device.library.service.DeviceChangeService;
import com.tykj.dev.device.library.service.DeviceLibraryService; import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.library.service.DeviceLogService;
import com.tykj.dev.device.library.subject.Dto.DeviceLogDto; import com.tykj.dev.device.library.subject.Dto.DeviceLogDto;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary; import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.domin.DeviceLog; import com.tykj.dev.device.library.subject.domin.DeviceLog;
...@@ -42,6 +43,9 @@ public class DeviceLibraryController { ...@@ -42,6 +43,9 @@ public class DeviceLibraryController {
@Autowired @Autowired
private DeviceChangeService deviceChangeService; private DeviceChangeService deviceChangeService;
@Autowired
private DeviceLogService deviceLogService;
@ApiOperation(value = "模糊查询装备分页", notes = "可以通过这个接口查询装备") @ApiOperation(value = "模糊查询装备分页", notes = "可以通过这个接口查询装备")
@PostMapping("/selectDevicePage") @PostMapping("/selectDevicePage")
public ResponseEntity selectDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) { public ResponseEntity selectDevicePage(@RequestBody DeviceLibrarySelectVo deviceLibrarySelectVo) {
...@@ -114,8 +118,21 @@ public class DeviceLibraryController { ...@@ -114,8 +118,21 @@ public class DeviceLibraryController {
List<DeviceLogUserVo> deviceLogEntities = deviceLogDao.getAllByDeviceIdAndType(id, 0).stream() List<DeviceLogUserVo> deviceLogEntities = deviceLogDao.getAllByDeviceIdAndType(id, 0).stream()
.map(DeviceLog::parse2Dto) .map(DeviceLog::parse2Dto)
.map(DeviceLogDto::toVo) .map(DeviceLogDto::toVo)
.sorted(Comparator.comparing(DeviceLogUserVo::getCreateTime)) .sorted(Comparator.comparing(DeviceLogUserVo::getCreateTime).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
//判断有没有维修新装备换新的情况
List<DeviceLogUserVo> deviceLogUserVos = new ArrayList<>();
List<Integer> integerList = deviceChangeService.getAllFatherDevice(id);
if (integerList!=null&&integerList.size()>0){
for (int i=integerList.size()-1;i>=0;i--){
deviceLogUserVos.addAll(deviceLogDao.getAllByDeviceIdAndType(integerList.get(i), 0).stream()
.map(DeviceLog::parse2Dto)
.map(DeviceLogDto::toVo)
.sorted(Comparator.comparing(DeviceLogUserVo::getCreateTime).reversed())
.collect(Collectors.toList()));
}
}
deviceLogUserVos.addAll(deviceLogEntities);
libraryEntities.add(deviceLibraryEntity); libraryEntities.add(deviceLibraryEntity);
if (deviceLibraryEntity.getIsPart()==0){ if (deviceLibraryEntity.getIsPart()==0){
List<DeviceLibrary> partList = deviceLibraryDao.getAllByPartParentIdAndIsPart(id,1); List<DeviceLibrary> partList = deviceLibraryDao.getAllByPartParentIdAndIsPart(id,1);
...@@ -132,7 +149,7 @@ public class DeviceLibraryController { ...@@ -132,7 +149,7 @@ public class DeviceLibraryController {
} }
libraryEntities.add(deviceLibraryService.getOne(deviceLibraryEntity.getPartParentId())); libraryEntities.add(deviceLibraryService.getOne(deviceLibraryEntity.getPartParentId()));
deviceDetailVo.setDeviceList(libraryEntities); deviceDetailVo.setDeviceList(libraryEntities);
deviceDetailVo.setDeviceLogEntityList(deviceLogEntities); deviceDetailVo.setDeviceLogEntityList(deviceLogUserVos);
return ResultUtil.success(deviceDetailVo); return ResultUtil.success(deviceDetailVo);
} }
} }
...@@ -146,6 +163,10 @@ public class DeviceLibraryController { ...@@ -146,6 +163,10 @@ public class DeviceLibraryController {
DeviceLibraryUpdateVo libraryUpdateVo = deviceEditVo.getUpdateVoList(); DeviceLibraryUpdateVo libraryUpdateVo = deviceEditVo.getUpdateVoList();
if (libraryUpdateVo.getInvisibleRange() != null) { if (libraryUpdateVo.getInvisibleRange() != null) {
deviceLibraryEntity.setInvisibleRange(libraryUpdateVo.getInvisibleRange()); deviceLibraryEntity.setInvisibleRange(libraryUpdateVo.getInvisibleRange());
//添加装备日志 TODO
// String remark = "将装备的"+
// DeviceLogDto deviceLogDto = new DeviceLogDto(deviceEditVo.getDeviceId(),remark,null);
// deviceLogService.addLog(deviceLogDto);
} }
if (libraryUpdateVo.getLifeStatus() != null) { if (libraryUpdateVo.getLifeStatus() != null) {
deviceLibraryEntity.setLifeStatus(libraryUpdateVo.getLifeStatus()); deviceLibraryEntity.setLifeStatus(libraryUpdateVo.getLifeStatus());
......
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 业务枚举
*/
@AllArgsConstructor
public enum BusinessEnum {
/**
* 列装业务
*/
PACKING(1,"列装业务"),
/**
* 入库业务
*/
STORAGE(2,"入库业务"),
/**
* 配发业务
*/
ALLOT(3,"配发业务"),
/**
* 自查业务
*/
SELF_CHECK(4,"自查业务"),
/**
* 维修业务
*/
REPAIR(5,"维修业务"),
/**
* 核查业务
*/
CONFIRM_CHECK(6,"核查业务"),
/**
* 核查统计业务
*/
CONFIRM_CHECK_STAT(7,"核查统计"),
/**
* 核查详情业务
*/
CONFIRM_CHECK_DETAIL(8,"核查详情"),
/**
* 申请业务
*/
APPLY(9,"申请业务"),
/**
* 维修退回
*/
REPAIR_BACK(10,"维修退回"),
/**
* 维修继续送修
*/
REPAIR_SEND(11,"维修业务"),
/**
* 培训
*/
TRAIN(13,"培训业务"),
/**
* 销毁业务
*/
DESTROY(14,"销毁业务"),
/**
* 退装业务
*/
RETIRED(15,"退装业务"),
/**
* 清退业务
*/
SEND_BACK(16,"清退业务"),
/**
* 清退异常处理
*/
SEND_BACK_EXCEPTION(17,"清退异常处理"),
/**
* 清退出库
*/
SEND_BACK_OUT(18,"清退出库"),
/**
* 新增配套设备
*/
ADD_MATCHING_DEVICE(19,"新增配套设备"),
/**
* 标签修改
*/
TAG(20,"标签修改"),
/**
* 工作交接
*/
WORK_HANDOVER(21,"工作交接")
;
public Integer id;
public String name;
}
package com.tykj.dev.misc.base;
import java.util.Arrays;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @author dengdiyi
*/
public class GlobalMap {
private static final Map<Integer, StatusEnum> statusEnumMap;
private static final Map<Integer, RepairStatusEnum> repairStatusMap;
static {
statusEnumMap = Arrays.stream(StatusEnum.values())
.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() {
return statusEnumMap;
}
public static Map<Integer, RepairStatusEnum> getRepairStatusMap() {
return repairStatusMap;
}
}
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 维修状态枚举
*/
@AllArgsConstructor
public enum RepairStatusEnum {
/**
* 等待维修
*/
WAIT_REPAIR(0,"等待维修"),
/**
* 维修中
*/
REPAIRING(1,"维修中"),
/**
* 待领取
*/
WAIT_RECEIVE(2,"待领取"),
/**
* 库存换新
*/
CHANGE_NEW(3,"库存换新"),
/**
* 已报废
*/
SCRAPPED(4,"已报废"),
/**
* 已领取
*/
RECEIVED(5,"已领取"),
/**
* 新装备换新
*/
CHANGE_NEW_DEVICE(6,"新装备换新")
;
public Integer id;
public String name;
}
package com.tykj.dev.misc.base;
import lombok.AllArgsConstructor;
/**
* @author dengdiyi
* 业务状态枚举
*/
@AllArgsConstructor
public enum StatusEnum {
/**
* RFID标签制作
*/
CREATE_RFID_BUSINESS(8100,"标签制作业务开始"),
RFID_BUSINESS_NEED_CONFIRM(8101,"等待审核"),
RFID_BUSINESS_CONFIRM_FINISH_SUCCESS(8102,"审核成功"),
RFID_BUSINESS_CONFIRM_FINISH_FAILED(8103,"审核失败"),
/**
* 销毁业务
*/
CREATE_DESTROY_BUSINESS(8110,"标签制作业务开始"),
DESTROY_BUSINESS_NEED_CONFIRM(8111,"等待审核"),
DESTROY_BUSINESS_CONFIRM_FINISH_SUCCESS(8112,"审核成功"),
DESTROY_BUSINESS_CONFIRM_FINISH_FAILED(8113, "审核失败"),
/**
* 退装业务
*/
CREATE_RETIRED_BUSINESS(8120, "标签制作业务开始"),
RETIRED_BUSINESS_NEED_CONFIRM(8121, "等待审核"),
RETIRED_BUSINESS_CONFIRM_FINISH_SUCCESS(8122, "审核成功"),
RETIRED_BUSINESS_CONFIRM_FINISH_FAILED(8123, "审核失败"),
/**
* 核查任务
*/
//以下为stat状态
CHECK_STAT_0(110, "统计数据收集中"),
CHECK_STAT_1(111, "统计数据等待确认"),
//以下为detail状态
CHECK_DETAIL_0(120, "等待专管员A处理"),
CHECK_DETAIL_1(121, "等待专管员B处理"),
CHECK_DETAIL_2(122, "等待核查员A处理"),
CHECK_DETAIL_3(123, "等待核查员B处理"),
/**
* 业务完结
*/
END(9999, "业务完结"),
TRAIN1000(1000, "报名中"),
TRAIN1001(1001, "报名确认"),
TRAIN1002(1002,"待报名"),
TRAIN1003(1003,"等待培训"),
TRAIN1004(1004,"培训中"),
TRAIN1005(1005,"申请发证"),
TRAIN1006(1006,"市培训申请发证审核"),
TRAIN1007(1007,"省培训发证审核"),
TRAIN1008(1008,"成绩录入"),
TRAIN1009(1009,"成绩确认"),
//
TRAIN1010(1010,"待培训"),
//
// TRAIN1011(1011,""),
//
// TRAIN1012(1012,""),
//
// TRAIN1013(1013,""),
/**
* 业务封存
*/
ARCHIVE(8888,"业务封存"),
/**
* 列装待审核
*/
PACKING_CONFIRM(100,"列装待审核"),
/**
* 入库待审核
*/
STORAGE_CONFIRM(200,"入库待审核"),
/**
* 待配发
*/
WAIT_ALLOT(300,"待配发"),
/**
* 配发出库待审核
*/
ALLOT_SEND_CONFIRM(301,"配发出库待审核"),
/**
* 配发中
*/
ALLOTING(302,"配发中"),
/**
* 配发入库待审核
*/
ALLOT_RECEIVE_CONFIRM(303,"配发入库待审核"),
/**
* 待自查
*/
WAIT_SELF_CHECK(400,"待自查"),
/**
* 自查待审核
*/
SELF_CHECK_CONFIRM(401,"自查待审核"),
/**
* 装备申请待批复
*/
DEVICE_APPLY_CONFIRM(500,"装备申请待批复"),
/**
* 新增配套设备待审核
*/
ADD_MATCHING_DEVICE_CONFIRM(600,"新增配套设备待审核"),
/**
* 维修送修状态
*/
REPAIR_SEND_CONFIRM(700,"维修送修出库待审核"),
WAIT_RECEIVE(701,"等待接收维修装备"),
REPAIR_RECEIVE_CONFIRM(702,"接收维修装备待审核"),
REPAIRING(703,"维修中"),
COUNTRY_REPAIRING(777,"等待接收维修退回装备"),
/**
* 维修完成退回状态
*/
REPAIR_BACK_CONFIRM(800,"维修退回装备出库待审核"),
WAIT_BACK_RECEIVE(801,"等待接收维修退回装备"),
REPAIR_BACK_RECEIVE_CONFIRM(802,"接收维修退回装备待审核")
;
public Integer id;
public String name;
}
...@@ -95,7 +95,7 @@ public class RepairBillSelectController { ...@@ -95,7 +95,7 @@ public class RepairBillSelectController {
List<RepairDetail> repairDetails = repairDetailService.findByBillId(repairBillId); List<RepairDetail> repairDetails = repairDetailService.findByBillId(repairBillId);
List<RepairDetail> orderList = new ArrayList<>(); List<RepairDetail> orderList = new ArrayList<>();
repairDetails.forEach(repairDetail -> { repairDetails.forEach(repairDetail -> {
if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id)) { if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id)&&!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW_DEVICE.id)) {
orderList.add(repairDetail); orderList.add(repairDetail);
if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) { if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) {
if (repairDetail.getNewDeviceDetailId()!=null&&repairDetail.getNewDeviceDetailId() > 0) { if (repairDetail.getNewDeviceDetailId()!=null&&repairDetail.getNewDeviceDetailId() > 0) {
......
...@@ -496,94 +496,6 @@ public class RepairController { ...@@ -496,94 +496,6 @@ public class RepairController {
return ResultUtil.success(repairOutPutDeviceVo); return ResultUtil.success(repairOutPutDeviceVo);
} }
// @ApiOperation(value = "送国家维修装备出库",notes = "可以通过这个接口送国家维修装备出库")
// @PostMapping(value = "/sendCountry")
// public ResponseEntity sendCountry(@RequestBody RepairBillSaveVo repairBillSaveVo){
// //获取父任务
// TaskBto fatherTask = taskService.get(repairBillSaveVo.getTaskId());
// //添加维修单,送修单
// RepairBill repairbill= new RepairBill();
// RepairSendBill repairSendBill = new RepairSendBill();
// Integer userId = userUtils.getCurrentUserId();
// BeanUtils.copyProperties(repairBillSaveVo,repairbill);
// BeanUtils.copyProperties(repairBillSaveVo,repairSendBill);
// repairbill.setRepairStatus(0);
// if (repairBillSaveVo.getRepairUserA()!=null) {
// repairbill.setRepairUserA(repairBillSaveVo.getRepairUserA());
// }
// repairbill.setStartUserA(userPublicService.getOne(repairBillSaveVo.getStartUseraId()).getName());
// repairbill.setStartUserB(userPublicService.getOne(repairBillSaveVo.getStartUserbId()).getName());
// RepairBill repairBill1 = deviceRepairBillService.addEntity(repairbill);
// Calendar calendar = Calendar.getInstance();
// String s1 ="NO:第"+calendar.get(Calendar.YEAR)+"PF"+repairBill1.getId()+"号";
// repairBill1.setDocNum(s1);
// deviceRepairBillService.update(repairBill1);
// //发起维修业务
// List<Integer> userIds = new ArrayList<>();
// userIds.add(userId);
// userIds.add(repairBillSaveVo.getStartUserbId());
// TaskBto taskBto = new TaskBto(StatusEnum.REPAIR_SEND_CONFIRM.id,"维修业务",repairBillSaveVo.getTaskId(),fatherTask.getNodeIdDetail()+fatherTask.getId()+".",repairBill1.getId(),5,userUtils.getCurrentUnitId(),1,null,userIds);
// Task saveEntity = taskService.start(taskBto);
// //存业务日志
// List<FileVo> fileVoList = new ArrayList<>();
// fileVoList.add(new FileVo("出库确认单",repairBillSaveVo.getFileName(),repairBillSaveVo.getFileUrl()));
// TaskLogBto taskLogBto = new TaskLogBto(saveEntity.getId(),"向"+repairBillSaveVo.getReceiveUnit()+"发起装备维修",fileVoList);
// taskLogService.addLog(taskLogBto);
// repairSendBill.setRepairStatus(0);
// repairSendBill.setSendTime(new Date());
// StringBuffer stringBuffer = new StringBuffer();
// //存维修详情单
// for (DeviceDetailVo d:repairBillSaveVo.getDeviceList()) {
// stringBuffer.append(d.getDeviceId());
// stringBuffer.append("Ǵ");
// stringBuffer.append(d.getRemark());
// stringBuffer.append("Ǵ");
// RepairDetail repairDetail = new RepairDetail();
// repairDetail.setDeviceId(d.getDeviceId());
// DeviceLibrary deviceLibraryEntity =deviceLibraryService.getOne(d.getDeviceId());
// repairDetail.setLocationUnit(userUtils.getCurrentUserUnitName());
// repairDetail.setModel(deviceLibraryEntity.getModel());
// repairDetail.setName(deviceLibraryEntity.getName());
// repairDetail.setOwnUnit(deviceLibraryEntity.getOwnUnit());
// repairDetail.setRemark(d.getRemark());
// repairDetail.setRepairStatus(0);
// repairDetail.setRfidSurfaceId(deviceLibraryEntity.getRfidSurfaceId());
// repairDetail.setSeqNumber(deviceLibraryEntity.getSeqNumber());
// repairDetail.setType(deviceLibraryEntity.getType());
// repairDetail.setDeviceRepairBillId(repairBill1.getId());
// deviceRepairDetailService.save(repairDetail);
// //存装备日志
// DeviceLogDto deviceLogDto = new DeviceLogDto(d.getDeviceId(),"向"+repairBillSaveVo.getReceiveUnit()+"发起装备维修",fileVoList);
// deviceLogService.addLog(deviceLogDto);
// }
// //存送修单
// repairSendBill.setRepairDeviceDetail(stringBuffer.toString());
// repairSendBill.setDeviceRepairBillId(repairBill1.getId());
// repairSendBill.setAgent(repairBillSaveVo.getAgent());
// repairSendBill.setTitle("维修业务");
// deviceRepairSendBillService.addEntity(repairSendBill);
// myWebSocket.sendMessage1();
// return ResponseEntity.ok(saveEntity);
// }
// @ApiOperation(value = "送国家维修装备出库审核", notes = "可以通过这个接口送国家维修装备出库审核")
// @PostMapping(value = "/sendCountry/confirm")
// public ResponseEntity sendCountryConfirm(@RequestBody RepairConfirmVo deviceRepairConfirmVo) {
// return null;
// }
//
// @ApiOperation(value = "送国家维修装备入库接收", notes = "可以通过这个接口送国家维修装备入库接收")
// @PostMapping(value = "/sendCountry/receive")
// public ResponseEntity sendCountryReceive() {
// return null;
// }
//
// @ApiOperation(value = "送国家维修装备入库审核", notes = "可以通过这个接口送国家维修装备入库审核")
// @PostMapping(value = "/sendCountry/receive/confirm")
// public ResponseEntity sendCountryReceiveConfirm(@RequestBody RepairConfirmVo deviceRepairConfirmVo) {
// return null;
// }
@ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库") @ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库")
@PostMapping(value = "/back") @PostMapping(value = "/back")
public ResponseEntity repairBack(@RequestBody RepairBackBillSaveVo repairBackBillSaveVo) { public ResponseEntity repairBack(@RequestBody RepairBackBillSaveVo repairBackBillSaveVo) {
...@@ -893,9 +805,18 @@ public class RepairController { ...@@ -893,9 +805,18 @@ public class RepairController {
//获取装备名称 //获取装备名称
String deviceName = deviceLibraryService.getOne(repairDetail1.getDeviceId()).getName(); String deviceName = deviceLibraryService.getOne(repairDetail1.getDeviceId()).getName();
//添加业务日志 //添加业务日志
List<FileVo> fileVos = new ArrayList<>();
if (repairStatusChangeVo.getFileName()!=null&&repairStatusChangeVo.getFileUrl()!=null){
FileVo fileVo = new FileVo("报废单",repairStatusChangeVo.getFileName(),repairStatusChangeVo.getFileUrl());
fileVos.add(fileVo);
}
String remark = "将装备" + deviceName + "状态由" + GlobalMap.getRepairStatusMap().get(oldStatus).name + "改为" + GlobalMap.getRepairStatusMap().get(repairStatusChangeVo.getNewStatus()).name; String remark = "将装备" + deviceName + "状态由" + GlobalMap.getRepairStatusMap().get(oldStatus).name + "改为" + GlobalMap.getRepairStatusMap().get(repairStatusChangeVo.getNewStatus()).name;
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, null); //业务日志
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, fileVos);
taskLogService.addLog(taskLogBto); taskLogService.addLog(taskLogBto);
//装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(repairDetail1.getDeviceId(),remark,fileVos);
deviceLogService.addLog(deviceLogDto);
} }
return ResultUtil.success("修改成功"); return ResultUtil.success("修改成功");
} }
...@@ -925,7 +846,12 @@ public class RepairController { ...@@ -925,7 +846,12 @@ public class RepairController {
repairDetail.setDeviceRepairBillId(repairDetail1.getDeviceRepairBillId()); repairDetail.setDeviceRepairBillId(repairDetail1.getDeviceRepairBillId());
repairDetail.setOwnUnit(repairDetail1.getOwnUnit()); repairDetail.setOwnUnit(repairDetail1.getOwnUnit());
repairDetail.setLocationUnit(repairDetail1.getLocationUnit()); repairDetail.setLocationUnit(repairDetail1.getLocationUnit());
repairDetail.setRepairStatus(RepairStatusEnum.CHANGE_NEW.id); if (changeNewDeviceVo.getType()==0) {
repairDetail.setRepairStatus(RepairStatusEnum.CHANGE_NEW.id);
}
else {
repairDetail.setRepairStatus(RepairStatusEnum.CHANGE_NEW_DEVICE.id);
}
repairDetail.setDeviceId(changeNewDeviceVo.getDeviceId()); repairDetail.setDeviceId(changeNewDeviceVo.getDeviceId());
repairDetail.setNewDeviceDetailId(null); repairDetail.setNewDeviceDetailId(null);
repairDetail.setRfidSurfaceId(deviceLibrary.getRfidSurfaceId()); repairDetail.setRfidSurfaceId(deviceLibrary.getRfidSurfaceId());
...@@ -952,6 +878,13 @@ public class RepairController { ...@@ -952,6 +878,13 @@ public class RepairController {
deviceChange.setOldDeviceId(originDevice.getId()); deviceChange.setOldDeviceId(originDevice.getId());
deviceChangeService.add(deviceChange); deviceChangeService.add(deviceChange);
} }
//添加业务日志
String remark = "添加维修换新装备" + deviceLibrary.getName();
TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), remark, null);
taskLogService.addLog(taskLogBto);
//添加装备日志
DeviceLogDto deviceLogDto = new DeviceLogDto(originDevice.getId(),remark,null);
deviceLogService.addLog(deviceLogDto);
} }
return ResultUtil.success("换新成功"); return ResultUtil.success("换新成功");
} }
...@@ -1074,7 +1007,7 @@ public class RepairController { ...@@ -1074,7 +1007,7 @@ public class RepairController {
List<RepairDetail> repairDetails = deviceRepairDetailService.findByBillId(repairBillId); List<RepairDetail> repairDetails = deviceRepairDetailService.findByBillId(repairBillId);
List<RepairDetail> orderList = new ArrayList<>(); List<RepairDetail> orderList = new ArrayList<>();
repairDetails.forEach(repairDetail -> { repairDetails.forEach(repairDetail -> {
if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id)) { if (!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW.id)&&!repairDetail.getRepairStatus().equals(RepairStatusEnum.CHANGE_NEW_DEVICE.id)) {
orderList.add(repairDetail); orderList.add(repairDetail);
if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) { if (repairDetail.getRepairStatus().equals(RepairStatusEnum.SCRAPPED.id)) {
if (repairDetail.getNewDeviceDetailId() > 0) { if (repairDetail.getNewDeviceDetailId() > 0) {
......
...@@ -6,6 +6,7 @@ import com.tykj.dev.device.repair.repository.RepairBillDao; ...@@ -6,6 +6,7 @@ import com.tykj.dev.device.repair.repository.RepairBillDao;
import com.tykj.dev.device.repair.service.RepairBillService; import com.tykj.dev.device.repair.service.RepairBillService;
import com.tykj.dev.device.repair.subject.domin.RepairBill; import com.tykj.dev.device.repair.subject.domin.RepairBill;
import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo; import com.tykj.dev.device.repair.subject.vo.RepairBillSelectVo;
import com.tykj.dev.device.user.util.UserUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
...@@ -25,6 +26,9 @@ public class RepairBillServiceImpl implements RepairBillService { ...@@ -25,6 +26,9 @@ public class RepairBillServiceImpl implements RepairBillService {
@Autowired @Autowired
private RepairBillDao deviceRepairBillDao; private RepairBillDao deviceRepairBillDao;
@Autowired
private UserUtils userUtils;
@Override @Override
public RepairBill addEntity(RepairBill deviceRepairBillEntity) { public RepairBill addEntity(RepairBill deviceRepairBillEntity) {
return deviceRepairBillDao.save(deviceRepairBillEntity); return deviceRepairBillDao.save(deviceRepairBillEntity);
...@@ -53,6 +57,10 @@ public class RepairBillServiceImpl implements RepairBillService { ...@@ -53,6 +57,10 @@ public class RepairBillServiceImpl implements RepairBillService {
private Specification<RepairBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo){ private Specification<RepairBill> getSelectSpecification(RepairBillSelectVo deviceRepairBillSelectVo){
PredicateBuilder<RepairBill> predicateBuilder = Specifications.and(); PredicateBuilder<RepairBill> predicateBuilder = Specifications.and();
PredicateBuilder<RepairBill> predicateBuilder1 = Specifications.or();
predicateBuilder1.eq("sendUnit",userUtils.getCurrentUserUnitName());
predicateBuilder1.eq("receiveUnit",userUtils.getCurrentUserUnitName());
predicateBuilder.predicate(predicateBuilder1.build());
if (deviceRepairBillSelectVo!=null) { if (deviceRepairBillSelectVo!=null) {
if (deviceRepairBillSelectVo.getReceiveUnit()!=null){ if (deviceRepairBillSelectVo.getReceiveUnit()!=null){
predicateBuilder.eq("receiveUnit",deviceRepairBillSelectVo.getReceiveUnit()); predicateBuilder.eq("receiveUnit",deviceRepairBillSelectVo.getReceiveUnit());
......
...@@ -21,4 +21,10 @@ public class RepairStatusChangeVo { ...@@ -21,4 +21,10 @@ public class RepairStatusChangeVo {
@ApiModelProperty(name = "新的维修状态",value = "1") @ApiModelProperty(name = "新的维修状态",value = "1")
private Integer newStatus; private Integer newStatus;
@ApiModelProperty(name = "报废单文件名")
private String fileName;
@ApiModelProperty(name = "报废单URL")
private String fileUrl;
} }
...@@ -19,5 +19,9 @@ ...@@ -19,5 +19,9 @@
<groupId>com.tykj.dev</groupId> <groupId>com.tykj.dev</groupId>
<artifactId>config</artifactId> <artifactId>config</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.tykj</groupId>
<artifactId>dev-library</artifactId>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
package com.tykj.dev.device.scrap;
import com.tykj.dev.config.swagger.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 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(ScrapPage.builder().data(listVos)
.page(scrapConditions.getPage()).size(scrapConditions.getSize()).total(listVos.size()).build());
}
@ApiOperation(value = "查询列表", notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/summary/{scrapId}")
public ResponseEntity 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);
}
}
package com.tykj.dev.device.scrap;
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 com.tykj.dev.device.scrap.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");
}
}
package com.tykj.dev.device.scrap;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
}
package com.tykj.dev.device.scrap;
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;
}
package com.tykj.dev.device.scrap.controller;
import com.tykj.dev.config.swagger.AutoDocument;
import com.tykj.dev.device.library.service.DeviceLibraryService;
import com.tykj.dev.device.scrap.service.ScrapBillService;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.scrap.subject.vo.ScrapSelectVo;
import com.tykj.dev.device.scrap.subject.vo.ScrapSaveVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author zjm
*/
@RestController
@RequestMapping(value = "/scrap")
@AutoDocument
@Api(tags = "报废模块",description = "报废模块")
public class DeviceScrapController {
@Autowired
private DeviceLibraryService deviceLibraryService;
@Autowired
private ScrapBillService scrapBillService;
@ApiOperation(value = "查询列表", notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/summary")
public ResponseEntity selectRepairBill(@RequestBody ScrapSelectVo scrapSelectVo) {
return ResponseEntity.ok(scrapBillService.getPage(scrapSelectVo));
}
@ApiOperation(value = "查询列表详情", notes = "可以通过这个接口查询销毁单")
@PostMapping(value = "/summary/{scrapId}")
public ResponseEntity selectRepairBill1(@PathVariable Integer scrapId) {
return ResponseEntity.ok(scrapBillService.getOne(scrapId));
}
@ApiOperation(value = "提交报废单", notes = "提交报废单")
@PostMapping(value = "/form")
public ResponseEntity commitScrap(@RequestBody ScrapSaveVo scrapSaveVo){
//转实体类
ScrapBill scrapBill = scrapSaveVo.toDo();
//计算所有不同的型号
Set<String> models = scrapSaveVo.getDeviceIds().stream().map(integer -> deviceLibraryService.getOne(integer).getModel()).collect(Collectors.toSet());
StringBuffer stringBuffer = new StringBuffer();
models.forEach(s -> stringBuffer.append(s).append(","));
stringBuffer.deleteCharAt(stringBuffer.length()-1);
scrapBill.setModels(stringBuffer.toString());
//计算所有不同的名称
Set<String> names = scrapSaveVo.getDeviceIds().stream().map(integer -> deviceLibraryService.getOne(integer).getName()).collect(Collectors.toSet());
StringBuffer stringBuffer2 = new StringBuffer();
models.forEach(s -> stringBuffer2.append(s).append(","));
stringBuffer2.deleteCharAt(stringBuffer2.length()-1);
scrapBill.setNames(stringBuffer2.toString());
ScrapBill scrapBill1 = scrapBillService.add(scrapBill);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
String num = "NO:第" + year + "BF" + scrapBill1.getId() + "号";
scrapBill1.setDocNumber(num);
scrapBillService.update(scrapBill1);
return ResponseEntity.ok(scrapBill1);
}
}
package com.tykj.dev.device.scrap.repository;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author dengdiyi
*/
public interface ScrapBillDao extends JpaRepository<ScrapBill,Integer>, JpaSpecificationExecutor<ScrapBill> {
}
package com.tykj.dev.device.scrap.service;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.scrap.subject.vo.ScrapSelectVo;
import org.springframework.data.domain.Page;
import java.util.List;
/**
* @author dengdiyi
*/
public interface ScrapBillService {
ScrapBill add(ScrapBill scrapBill);
ScrapBill getOne(Integer id);
ScrapBill update(ScrapBill scrapBill);
Page<ScrapBill> getPage(ScrapSelectVo scrapSelectVo);
}
package com.tykj.dev.device.scrap.service.impl;
import com.github.wenhao.jpa.PredicateBuilder;
import com.github.wenhao.jpa.Specifications;
import com.tykj.dev.device.scrap.repository.ScrapBillDao;
import com.tykj.dev.device.scrap.service.ScrapBillService;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.device.scrap.subject.vo.ScrapSelectVo;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import javax.persistence.Transient;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Optional;
/**
* @author dengdiyi
*/
@Service
public class ScrapBillServiceImpl implements ScrapBillService {
@Autowired
private ScrapBillDao scrapBillDao;
@Override
public ScrapBill add(ScrapBill scrapBill) {
return scrapBillDao.save(scrapBill);
}
@Override
public ScrapBill getOne(Integer id) {
Optional<ScrapBill> scrapBill = scrapBillDao.findById(id);
if (scrapBill.isPresent()){
return scrapBill.get();
}
else {
throw new ApiException(ResultUtil.failed("查询Id不存在"));
}
}
@Override
public ScrapBill update(ScrapBill scrapBill) {
return scrapBillDao.save(scrapBill);
}
@Override
public Page<ScrapBill> getPage(ScrapSelectVo scrapSelectVo) {
PredicateBuilder<ScrapBill> predicateBuilder = Specifications.and();
if (scrapSelectVo.getContent()!=null){
Class<ScrapBill> scrapBillClass = ScrapBill.class;
Field[] declaredFields = scrapBillClass.getDeclaredFields();
PredicateBuilder<ScrapBill> p = Specifications.or();
for (Field field : declaredFields) {
if (field.getType().equals(String.class)&&field.getAnnotation(Transient.class)==null) {
p.like(field.getName(), "%" + scrapSelectVo.getContent() + "%");
}
}
predicateBuilder.predicate(p.build());
}
if (scrapSelectVo.getStartTime() != null) {
predicateBuilder.gt("scrapTime", scrapSelectVo.getStartTime());
}
if (scrapSelectVo.getEndTime() != null) {
predicateBuilder.lt("scrapTime", scrapSelectVo.getEndTime());
}
return scrapBillDao.findAll(predicateBuilder.build(),scrapSelectVo.getPageable());
}
}
package com.tykj.dev.device.scrap.subject.domin;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
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;
/**
* @author dengdiyi
*/
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update scrap_bill set delete_tag = 1 where id = ?")
@Where(clause = "delete_tag = 0")
@ApiModel("装备报废账单")
public class ScrapBill {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(name = "主键id")
private Integer id ;
@ApiModelProperty(value = "维修单id")
private Integer repairBillId ;
@ApiModelProperty(value = "报废单位")
private String scrapUnit ;
@ApiModelProperty(value = "报废时间")
private Date scrapTime ;
@ApiModelProperty(value = "文号")
private String docNumber ;
@ApiModelProperty(value = "监销人")
private String supervisor ;
@ApiModelProperty(value = "主管领导")
private String leader ;
@ApiModelProperty(value = "经办人")
private String manager ;
@ApiModelProperty(value = "承办人")
private String undertaker ;
@ApiModelProperty(value = "报废单文件名")
private String fileName ;
@ApiModelProperty(value = "报废单文件URL")
private String fileUrl ;
@ApiModelProperty(value = "报废装备主键Id以x拼接")
private String scrapDetail ;
@ApiModelProperty(value = "报废型号,以,拼接")
private String models ;
@ApiModelProperty(value = "报废名称,以,拼接")
private String names ;
@ApiModelProperty(value = "创建用户id")
@CreatedBy
private Integer createUserId ;
@ApiModelProperty(value = "创建时间")
@CreatedDate
private Date createTime ;
@ApiModelProperty(value = "更新用户id")
@LastModifiedBy
private Integer updateUserId ;
@ApiModelProperty(value = "更新时间")
@LastModifiedDate
private Date updateTime ;
@ApiModelProperty(value = "删除标记(0:未删除,1:已删除)")
private Integer deleteTag = 0 ;
}
package com.tykj.dev.device.scrap.subject.vo;
import com.tykj.dev.device.scrap.subject.domin.ScrapBill;
import com.tykj.dev.misc.base.BeanHelper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper;
import java.util.Date;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "报废单存储类", description = "报废单存储类")
public class ScrapSaveVo {
@ApiModelProperty(value = "维修单id")
private Integer repairBillId ;
@ApiModelProperty(value = "报废单位")
private String scrapUnit ;
@ApiModelProperty(value = "报废时间")
private Date scrapTime ;
@ApiModelProperty(value = "监销人")
private String supervisor ;
@ApiModelProperty(value = "主管领导")
private String leader ;
@ApiModelProperty(value = "经办人")
private String manager ;
@ApiModelProperty(value = "承办人")
private String undertaker ;
@ApiModelProperty(value = "报废单文件名")
private String fileName ;
@ApiModelProperty(value = "报废单文件URL")
private String fileUrl ;
@ApiModelProperty(value = "报废装备Id列表")
private List<Integer> deviceIds;
public ScrapBill toDo(){
ModelMapper modelMapper = BeanHelper.getUserMapper();
ScrapBill scrapBill = modelMapper.map(this,ScrapBill.class);
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("x");
if (this.deviceIds!=null&&this.deviceIds.size()>0){
deviceIds.forEach(integer -> stringBuffer.append(integer).append("x"));
}
scrapBill.setScrapDetail(stringBuffer.toString());
return scrapBill;
}
}
package com.tykj.dev.device.scrap; package com.tykj.dev.device.scrap.subject.vo;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tykj.dev.misc.base.CustomPage;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
...@@ -20,17 +21,14 @@ import java.util.Date; ...@@ -20,17 +21,14 @@ import java.util.Date;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "报废装备查询条件", description = "报废装备查询条件") @ApiModel(value = "报废装备查询条件", description = "报废装备查询条件")
public class ScrapConditions { public class ScrapSelectVo extends CustomPage {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "开始时间",example = "bmxx",name = "statusTime") @ApiModelProperty(value = "模糊查询关键字",example = "测试")
private Date statusTime; public String content;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(value = "结束时间",example = "bmxx",name = "endTime") @ApiModelProperty(value = "开始时间",example = "2020-10-10 01:10:10")
private Date endTime; public Date startTime;
@ApiModelProperty(value = "模糊搜索",example = "bmxx",name = "dimName")
private String dimName; @ApiModelProperty(value = "结束时间",example = "2020-10-10 01:10:10")
@ApiModelProperty(value = "页数",example = "bmxx",name = "page") public Date endTime;
private Integer page;
@ApiModelProperty(value = "条数",example = "bmxx",name = "size")
private Integer size;
} }
...@@ -121,7 +121,7 @@ public class TaskController { ...@@ -121,7 +121,7 @@ public class TaskController {
} }
//按日志时间排序 //按日志时间排序
List<TaskLogUserVo> taskLogUserVoList = taskLogUserVos.stream() List<TaskLogUserVo> taskLogUserVoList = taskLogUserVos.stream()
.sorted(Comparator.comparing(TaskLogUserVo::getCreateTime)) .sorted(Comparator.comparing(TaskLogUserVo::getCreateTime).reversed())
.collect(Collectors.toList()); .collect(Collectors.toList());
return ResultUtil.success(taskLogUserVoList); return ResultUtil.success(taskLogUserVoList);
} }
......
...@@ -51,7 +51,7 @@ public class TaskLogServiceImpl implements TaskLogService { ...@@ -51,7 +51,7 @@ public class TaskLogServiceImpl implements TaskLogService {
*/ */
@Override @Override
public List<TaskLogUserVo> getByTaskId(Integer taskId) { public List<TaskLogUserVo> getByTaskId(Integer taskId) {
List<TaskLog> taskLogs = taskUtils.orderByCreateTimeAsc(taskLogDao.getAllByTaskId(taskId)); List<TaskLog> taskLogs = taskUtils.orderByCreateTimeDesc(taskLogDao.getAllByTaskId(taskId));
return taskLogs.stream().map(TaskLog::parse2bto).map(TaskLogBto::toVo).collect(Collectors.toList()); return taskLogs.stream().map(TaskLog::parse2bto).map(TaskLogBto::toVo).collect(Collectors.toList());
} }
......
...@@ -22,9 +22,9 @@ public enum RepairStatusEnum { ...@@ -22,9 +22,9 @@ public enum RepairStatusEnum {
*/ */
WAIT_RECEIVE(2,"待领取"), WAIT_RECEIVE(2,"待领取"),
/** /**
* 换新 * 库存换新
*/ */
CHANGE_NEW(3,"换新"), CHANGE_NEW(3,"库存换新"),
/** /**
* 已报废 * 已报废
*/ */
...@@ -32,7 +32,11 @@ public enum RepairStatusEnum { ...@@ -32,7 +32,11 @@ public enum RepairStatusEnum {
/** /**
* 已领取 * 已领取
*/ */
RECEIVED(5,"已领取") RECEIVED(5,"已领取"),
/**
* 新装备换新
*/
CHANGE_NEW_DEVICE(6,"新装备换新")
; ;
public Integer id; public Integer id;
......
spring.datasource.url=jdbc:mysql://192.168.100.249:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false spring.datasource.url=jdbc:mysql://192.168.100.249:3306/device?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=root
\ No newline at end of file spring.jpa.hibernate.ddl-auto=update
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论