提交 d915524a authored 作者: zhoushaopan's avatar zhoushaopan

feat(配套设备库模块): 修改了设备生命状态

修改了设备生命状态
上级 344ce937
...@@ -37,6 +37,7 @@ public class SystemConfigServiceImpl implements SystemConfigService { ...@@ -37,6 +37,7 @@ public class SystemConfigServiceImpl implements SystemConfigService {
@Override @Override
public void delete(Integer id) { public void delete(Integer id) {
systemConfigDao.deleteById(id); systemConfigDao.deleteById(id);
configCache.refresh(systemConfigDao.findAll());
} }
@Override @Override
......
...@@ -382,10 +382,10 @@ public class MatchingDeviceController { ...@@ -382,10 +382,10 @@ public class MatchingDeviceController {
if (matchingDeviceSelectVo.getMatchingType() == 1){ if (matchingDeviceSelectVo.getMatchingType() == 1){
//只查询停用的 //只查询停用的
matchingDeviceLibraryList = matchingDeviceLibraryList.stream().filter(matchingDeviceLibrary -> matchingDeviceLibraryList = matchingDeviceLibraryList.stream().filter(matchingDeviceLibrary ->
matchingDeviceLibrary.getMatchingDeviceStatus() == 3).collect(Collectors.toList()); matchingDeviceLibrary.getLifeStatus() == 23).collect(Collectors.toList());
}else { }else {
matchingDeviceLibraryList = matchingDeviceLibraryList.stream().filter(matchingDeviceLibrary -> matchingDeviceLibraryList = matchingDeviceLibraryList.stream().filter(matchingDeviceLibrary ->
matchingDeviceLibrary.getMatchingDeviceStatus() != 3).collect(Collectors.toList()); matchingDeviceLibrary.getLifeStatus() != 23).collect(Collectors.toList());
} }
//处理装备的序列号 //处理装备的序列号
matchingDeviceLibraryList.forEach(matchingDeviceLibrary -> { matchingDeviceLibraryList.forEach(matchingDeviceLibrary -> {
...@@ -504,6 +504,7 @@ public class MatchingDeviceController { ...@@ -504,6 +504,7 @@ public class MatchingDeviceController {
DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null, null); DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null, null);
deviceLogService.addLog(deviceLogDto); deviceLogService.addLog(deviceLogDto);
m.setLifeStatus(matchingDeviceEditVo.getLifeStatus()); m.setLifeStatus(matchingDeviceEditVo.getLifeStatus());
m.setStopUnitId(userUtils.getCurrentUnitId());
} }
if (matchingDeviceEditVo.getDeviceId() != null && m.getDeviceId() == 0) { if (matchingDeviceEditVo.getDeviceId() != null && m.getDeviceId() == 0) {
//添加设备日志 //添加设备日志
...@@ -578,15 +579,15 @@ public class MatchingDeviceController { ...@@ -578,15 +579,15 @@ public class MatchingDeviceController {
m.setMatchingDeviceStorageLocationId(matchingDeviceEditVo.getMatchingDeviceStorageLocationId()); m.setMatchingDeviceStorageLocationId(matchingDeviceEditVo.getMatchingDeviceStorageLocationId());
} }
if (matchingDeviceEditVo.getMatchingDeviceStatus() != null && // if (matchingDeviceEditVo.getMatchingDeviceStatus() != null &&
!matchingDeviceEditVo.getMatchingDeviceStatus().equals(m.getMatchingDeviceStatus())) { // !matchingDeviceEditVo.getMatchingDeviceStatus().equals(m.getMatchingDeviceStatus())) {
//添加设备日志 设备的状态 // //添加设备日志 设备的状态
String remark = "将设备的状态改为" + matchingDeviceEditVo.getMatchingDeviceStatusName(); // String remark = "将设备的状态改为" + matchingDeviceEditVo.getMatchingDeviceStatusName();
DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null, null); // DeviceLogDto deviceLogDto = new DeviceLogDto(1, matchingDeviceEditVo.getMatchingDeviceId(), remark, null, null);
deviceLogService.addLog(deviceLogDto); // deviceLogService.addLog(deviceLogDto);
m.setMatchingDeviceStatus(matchingDeviceEditVo.getMatchingDeviceStatus()); // m.setMatchingDeviceStatus(matchingDeviceEditVo.getMatchingDeviceStatus());
m.setStopUnitId(userUtils.getCurrentUnitId()); //
} // }
if (matchingDeviceEditVo.getRemake() != null && if (matchingDeviceEditVo.getRemake() != null &&
!matchingDeviceEditVo.getRemake().equals(m.getRemake())) { !matchingDeviceEditVo.getRemake().equals(m.getRemake())) {
//添加设备 设备的状态 //添加设备 设备的状态
...@@ -612,7 +613,7 @@ public class MatchingDeviceController { ...@@ -612,7 +613,7 @@ public class MatchingDeviceController {
@ApiOperation(value = "查询新增配套任务详情", notes = "可以通过这个接口查询新增配套任务详情") @ApiOperation(value = "查询新增配套任务详情", notes = "可以通过这个接口查询新增配套任务详情")
@GetMapping(value = "/detail/{billId}") @GetMapping(value = "/detail/{billId}")
public ResponseEntity selectDetail(@PathVariable("billId") int billId) { public ResponseEntity selectDetail(@PathVariable("billId") int billId) {
MacthingDetailVo macthingDetailVo = new MacthingDetailVo(); MatchingDetailVo macthingDetailVo = new MatchingDetailVo();
//获取业务 //获取业务
TaskBto taskBto = taskService.get(billId, BusinessEnum.ADD_MATCHING_DEVICE.id); TaskBto taskBto = taskService.get(billId, BusinessEnum.ADD_MATCHING_DEVICE.id);
//获取账单 //获取账单
......
...@@ -19,6 +19,8 @@ public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLi ...@@ -19,6 +19,8 @@ public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLi
List<MatchingDeviceLibrary> findAllByCreateUnitId(Integer unitId); List<MatchingDeviceLibrary> findAllByCreateUnitId(Integer unitId);
List<MatchingDeviceLibrary> findAllBySeqNumber(String seqNumber);
List<MatchingDeviceLibrary> findAllByCreateUnitIdIn(List<Integer> unitIds); List<MatchingDeviceLibrary> findAllByCreateUnitIdIn(List<Integer> unitIds);
@Transactional @Transactional
...@@ -29,11 +31,17 @@ public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLi ...@@ -29,11 +31,17 @@ public interface MatchingDeviceLibraryDao extends JpaRepository<MatchingDeviceLi
@Transactional @Transactional
@Modifying @Modifying
@Query("update MatchingDeviceLibrary m set m.matchingDeviceStatus = :status, m.remake = :remake, m.statusJson = :statusJson, m.stopUnitId = :stopUnitId where m.id in :matchingDeviceIds") @Query("update MatchingDeviceLibrary m set m.lifeStatus = :status, m.remake = :remake, m.statusJson = :statusJson, m.stopUnitId = :stopUnitId where m.id in :matchingDeviceIds")
int batchUpdateStatus(@Param("status") Integer status, int batchUpdateStatus(@Param("status") Integer status,
@Param("remake") String remake, @Param("remake") String remake,
@Param("statusJson") String statusJson, @Param("statusJson") String statusJson,
@Param("matchingDeviceIds") List<Integer> matchingDeviceIds, @Param("matchingDeviceIds") List<Integer> matchingDeviceIds,
@Param("stopUnitId") Integer stopUnitId); @Param("stopUnitId") Integer stopUnitId);
@Transactional
@Modifying
@Query("update MatchingDeviceLibrary o set o.lifeStatus = :lifeStatus where o.id in :ids")
int batchUpdate2(Integer lifeStatus,List<Integer> ids);
} }
package com.tykj.dev.device.matching.service; package com.tykj.dev.device.matching.service;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import com.tykj.dev.device.matching.subject.vo.MatchingUnitVo; import com.tykj.dev.device.matching.subject.vo.MatchingUnitVo;
import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo; import com.tykj.dev.device.matching.subject.vo.MatchingDeviceSelectVo;
...@@ -22,6 +23,7 @@ public interface MatchingDeviceLibraryService { ...@@ -22,6 +23,7 @@ public interface MatchingDeviceLibraryService {
*/ */
MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity); MatchingDeviceLibrary addEntity(MatchingDeviceLibrary matchingDeviceLibraryEntity);
/** /**
* @param matchingDeviceLibraries 异步上链 * @param matchingDeviceLibraries 异步上链
*/ */
...@@ -115,4 +117,36 @@ public interface MatchingDeviceLibraryService { ...@@ -115,4 +117,36 @@ public interface MatchingDeviceLibraryService {
void updateMatchingDeviceCreateUnitNameByUnitName(MatchingUnitVo matchingUnitVo); void updateMatchingDeviceCreateUnitNameByUnitName(MatchingUnitVo matchingUnitVo);
void batchUpdateStatus(StatusVO statusVO); void batchUpdateStatus(StatusVO statusVO);
/**
* 判断装备状态是否在库(若不是抛出303异常)
*/
void isInStock(List<Integer> ids);
/**
* 根据id查询集合
* @param ids 配套设备id的集合
* @return 配套设备
*/
List<MatchingDeviceLibrary> findAllById(List<Integer> ids);
/**
* 判断配套设备是不是在库或者维修
* @param split
*/
void isInStockOrRepairing(List<Integer> split);
List<MatchingDeviceLibrary> getAllBySeqNumber(String seqNumber);
/**
* 获取所有配套设备装备id map
*/
Map<Integer, MatchingDeviceLibrary> getAllDeviceMap();
/**
* @param lifeStatus 更新装备生命信息
*/
void updateLifeStatus2(Integer lifeStatus,List<Integer> ids);
} }
...@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil; ...@@ -7,6 +7,7 @@ import com.tykj.dev.blockcha.subject.service.BlockChainUtil;
import com.tykj.dev.config.TaskBeanConfig; import com.tykj.dev.config.TaskBeanConfig;
import com.tykj.dev.device.library.service.DeviceLogService; 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.matching.repository.MatchingDeviceLibraryDao; import com.tykj.dev.device.matching.repository.MatchingDeviceLibraryDao;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService; import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidService;
import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl; import com.tykj.dev.device.matching.rfid.MatchingDeviceRfidServiceImpl;
...@@ -30,6 +31,7 @@ import com.tykj.dev.rfid.entity.vo.RfidPrintVo; ...@@ -30,6 +31,7 @@ import com.tykj.dev.rfid.entity.vo.RfidPrintVo;
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;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -229,7 +231,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -229,7 +231,7 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
List<Integer> unitIds = userPublicService.findByUnitIdSubordinateAll(unitId).stream().map(Units::getUnitId).collect(Collectors.toList()); List<Integer> unitIds = userPublicService.findByUnitIdSubordinateAll(unitId).stream().map(Units::getUnitId).collect(Collectors.toList());
return matchingDeviceLibraryDao.findAllByCreateUnitIdIn(unitIds).stream().filter(matchingDeviceLibrary -> matchingDeviceLibrary.getMatchingDeviceStatus()!=3).collect(Collectors.toList()); return matchingDeviceLibraryDao.findAllByCreateUnitIdIn(unitIds).stream().filter(matchingDeviceLibrary -> matchingDeviceLibrary.getLifeStatus()!=5).collect(Collectors.toList());
} }
/** /**
...@@ -368,6 +370,48 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe ...@@ -368,6 +370,48 @@ public class MatchingDeviceLibraryServiceImpl implements MatchingDeviceLibrarySe
deviceLogService.addAllLog(deviceLogDtos); deviceLogService.addAllLog(deviceLogDtos);
} }
@Override
public void isInStock(List<Integer> ids) {
ids.forEach(integer -> {
MatchingDeviceLibrary library = getOne(integer);
if (library.getLifeStatus()!=2&&library.getLifeStatus()!=3){
throw new ApiException(ResponseEntity.status(303).body("序列号"+library.getSeqNumber()+"的装备已被其他专管员操作"));
}
});
}
@Override
public List<MatchingDeviceLibrary> findAllById(List<Integer> ids) {
return matchingDeviceLibraryDao.findAllById(ids);
}
@Override
public void isInStockOrRepairing(List<Integer> split) {
split.forEach(integer -> {
MatchingDeviceLibrary library = getOne(integer);
if (library.getLifeStatus()!=2 &&library.getLifeStatus()!=3 && library.getLifeStatus()!=4){
throw new ApiException(ResponseEntity.status(303).body("序列号"+library.getSeqNumber()+"的装备已被其他专管员操作"));
}
});
}
@Override
public List<MatchingDeviceLibrary> getAllBySeqNumber(String seqNumber) {
return matchingDeviceLibraryDao.findAllBySeqNumber(seqNumber);
}
@Override
public Map<Integer, MatchingDeviceLibrary> getAllDeviceMap() {
List<MatchingDeviceLibrary> libraries = matchingDeviceLibraryDao.findAll();
libraries.forEach(MatchingDeviceLibrary::setConfigName);
return libraries.stream().collect(Collectors.toMap(MatchingDeviceLibrary::getId, Function.identity()));
}
@Override
public void updateLifeStatus2(Integer lifeStatus, List<Integer> ids) {
matchingDeviceLibraryDao.batchUpdate2(lifeStatus,ids);
}
/** /**
* @param matchingDeviceSelectVo 配套设备查询vo * @param matchingDeviceSelectVo 配套设备查询vo
......
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
*/ */
@Data @Data
@ApiModel("新增配套详情返回类") @ApiModel("新增配套详情返回类")
public class MacthingDetailVo { public class MatchingDetailVo {
@ApiModelProperty(name = "新增单") @ApiModelProperty(name = "新增单")
private MatchingDeviceBill matchingDeviceBill; private MatchingDeviceBill matchingDeviceBill;
......
package com.tykj.dev.device.matching.subject.vo; package com.tykj.dev.device.matching.subject.vo;
import com.tykj.dev.device.library.subject.domin.DeviceLibrary;
import com.tykj.dev.device.library.subject.vo.DeviceLogUserVo; import com.tykj.dev.device.library.subject.vo.DeviceLogUserVo;
import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary; import com.tykj.dev.device.matching.subject.domin.MatchingDeviceLibrary;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/** /**
...@@ -14,14 +12,11 @@ import java.util.List; ...@@ -14,14 +12,11 @@ import java.util.List;
*/ */
@Data @Data
@ApiModel("配套设备详情返回类") @ApiModel("配套设备详情返回类")
public class MacthingDeviceDetailVo { public class MatchingDeviceDetailVo {
@ApiModelProperty(name = "配套设备") @ApiModelProperty(name = "配套设备")
private MatchingDeviceLibrary matchingDeviceLibrary; private MatchingDeviceLibrary matchingDeviceLibrary;
@ApiModelProperty(name = "关联装备")
private DeviceLibrary deviceLibrary;
@ApiModelProperty(name = "设备履历日志") @ApiModelProperty(name = "设备履历日志")
private List<DeviceLogUserVo> deviceLogUserVos; private List<DeviceLogUserVo> deviceLogUserVos;
} }
...@@ -58,6 +58,9 @@ public class MatchingDeviceEditVo { ...@@ -58,6 +58,9 @@ public class MatchingDeviceEditVo {
@ApiModelProperty(value = "生命状态", example = "1") @ApiModelProperty(value = "生命状态", example = "1")
private Integer lifeStatus; private Integer lifeStatus;
@ApiModelProperty(value = "设备状态",example = "2-在库 3 使用中 4 维修 5停用")
private String lifeStatusName;
@ApiModelProperty(value = "新增装备信息列表") @ApiModelProperty(value = "新增装备信息列表")
private Integer addDeviceId; private Integer addDeviceId;
...@@ -70,11 +73,7 @@ public class MatchingDeviceEditVo { ...@@ -70,11 +73,7 @@ public class MatchingDeviceEditVo {
@ApiModelProperty(value = "存放位置id") @ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId; private Integer matchingDeviceStorageLocationId;
@ApiModelProperty(value = "设备状态",example = "0 在库 1 使用中 2 维修")
private Integer matchingDeviceStatus;
@ApiModelProperty(value = "设备状态",example = "0 在库 1 使用中 2 维修")
private String matchingDeviceStatusName;
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remake; private String remake;
......
package com.tykj.dev.device.matching.subject.vo;
import com.tykj.dev.device.library.subject.vo.PackingVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zsp
* @version 1.0
* @date 2022/6/7 10:23
*/
@Data
@ApiModel("配套设备编辑更新类")
public class MatchingDeviceLibraryUpdateVo {
@ApiModelProperty(value = "型号", example = "bmxx")
public String model;
@ApiModelProperty(value = "类型", example = "1")
public Integer type;
@ApiModelProperty(value = "密级", example = "1")
public Integer secretLevel;
@ApiModelProperty(value = "可见范围(应用领域)", example = "1")
public Integer invisibleRange;
@ApiModelProperty(value = "名称", example = "BM-1")
public String name;
@ApiModelProperty(value = "所属单位", example = "省机要局")
public String ownUnit;
@ApiModelProperty(value = "所在单位", example = "省机要局")
public String locationUnit;
/**
* 生命状态,0-入库待审核,1-入库审核失败,2-在库,3-运输中,4-维修中,5,维修失败(报废在省库),6-清退,7-待退装,8-退装,9-待销毁,10-已销毁,11-丢失,12-退役,13-报废不在省库,14-使用
*/
@ApiModelProperty(value = "生命状态", example = "1")
public Integer lifeStatus;
@ApiModelProperty(value = "需要更新信息的装备id")
private Integer deviceId;
@ApiModelProperty(value = "装备序列号")
private String seqNumber;
@ApiModelProperty(value = "生产序列号")
private String prodNumber;
@ApiModelProperty("备注")
private String record;
}
...@@ -40,6 +40,10 @@ public class MatchingDeviceSaveVo { ...@@ -40,6 +40,10 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "创建单位Id") @ApiModelProperty(value = "创建单位Id")
private Integer createUnitId; private Integer createUnitId;
@NotNull(message = "createUnitId不能为空")
@ApiModelProperty(value = "所在单位Id")
private Integer locationUnitId;
@NotNull(message = "seqNumber不能为空") @NotNull(message = "seqNumber不能为空")
@ApiModelProperty(value = "设备序列号") @ApiModelProperty(value = "设备序列号")
private String seqNumber; private String seqNumber;
...@@ -64,14 +68,21 @@ public class MatchingDeviceSaveVo { ...@@ -64,14 +68,21 @@ public class MatchingDeviceSaveVo {
@ApiModelProperty(value = "存放位置id") @ApiModelProperty(value = "存放位置id")
private Integer matchingDeviceStorageLocationId; private Integer matchingDeviceStorageLocationId;
@ApiModelProperty(value = "设备状态") // @ApiModelProperty(value = "设备状态")
private Integer matchingDeviceStatus =0; // private Integer matchingDeviceStatus =0;
/**
* 锁定状态,0-未锁定可用,1-锁定不可用
*/
@ApiModelProperty(value = "锁定状态,0-未锁定可用,1-锁定不可用")
private Integer lockStatus = 0;
public MatchingDeviceLibrary toDo() { public MatchingDeviceLibrary toDo() {
MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary(); MatchingDeviceLibrary matchingDeviceLibraryEntity = new MatchingDeviceLibrary();
BeanUtils.copyProperties(this, matchingDeviceLibraryEntity); BeanUtils.copyProperties(this, matchingDeviceLibraryEntity);
matchingDeviceLibraryEntity.setLifeStatus(2); matchingDeviceLibraryEntity.setLifeStatus(2);
matchingDeviceLibraryEntity.setDeviceId(0); matchingDeviceLibraryEntity.setDeviceId(0);
matchingDeviceLibraryEntity.setLocationUnitId(this.createUnitId);
// if (matchingDeviceLibraryEntity.getRfidCardId()==null||"".equals(matchingDeviceLibraryEntity.getRfidCardId())){ // if (matchingDeviceLibraryEntity.getRfidCardId()==null||"".equals(matchingDeviceLibraryEntity.getRfidCardId())){
// matchingDeviceLibraryEntity.setRfidCardId(UUID.randomUUID().toString()); // matchingDeviceLibraryEntity.setRfidCardId(UUID.randomUUID().toString());
// } // }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论