|
|
@@ -26,6 +26,7 @@ import com.zd.laboratory.api.feign.RemoteLaboratoryService;
|
|
|
import com.zd.model.constant.BaseConstants;
|
|
|
import com.zd.model.constant.HttpStatus;
|
|
|
import com.zd.model.domain.ResultData;
|
|
|
+import com.zd.model.entity.SysUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -86,23 +87,30 @@ public class DbStockController extends AbstractController {
|
|
|
if (count1 > 0) {
|
|
|
return ResultData.fail("当前信标已绑定!");
|
|
|
}
|
|
|
+ SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
//查询实验室所在学院
|
|
|
- ResultData<List<CheckSubjectDto>> resultData = remoteLaboratoryService.findSubjectInfoList(String.valueOf(dbStockBo.getSubjectId()));
|
|
|
- if (resultData != null && HttpStatus.SUCCESS == resultData.getCode()) {
|
|
|
- List<CheckSubjectDto> data = resultData.getData();
|
|
|
- dbStockBo.setCollegeId(data.get(0).getDeptId());
|
|
|
- dbStockBo.setCollegeName(data.get(0).getCollegeName());
|
|
|
- dbStockBo.setRoomNum(data.get(0).getRoomNumber());
|
|
|
- }
|
|
|
DbStock dbStock = new DbStock();
|
|
|
BeanUtils.copyProperties(dbStockBo, dbStock);
|
|
|
dbStock.setCreateBy(getCurrentUserId());
|
|
|
dbStock.setCreateName(getCurrentUserName());
|
|
|
+ ResultData<List<CheckSubjectDto>> resultData = remoteLaboratoryService.findSubjectInfoList(String.valueOf(dbStockBo.getSubjectId()));
|
|
|
+ if (resultData != null && HttpStatus.SUCCESS == resultData.getCode()) {
|
|
|
+ List<CheckSubjectDto> data = resultData.getData();
|
|
|
+ dbStock.setCollegeId(data.get(0).getDeptId());
|
|
|
+ dbStock.setCollegeName(data.get(0).getCollegeName());
|
|
|
+ dbStock.setRoomNum(data.get(0).getRoomNumber());
|
|
|
+ }
|
|
|
if (dbStockService.save(dbStock)) {
|
|
|
DbInOutRecord dbInOutRecord = new DbInOutRecord();
|
|
|
BeanUtils.copyProperties(dbStockBo, dbInOutRecord);
|
|
|
+ if(sysUser != null){
|
|
|
+ dbInOutRecord.setOperator(sysUser.getNickName());
|
|
|
+ dbInOutRecord.setOperatorId(sysUser.getUserId());
|
|
|
+ dbInOutRecord.setPhone(sysUser.getPhonenumber());
|
|
|
+ dbInOutRecord.setCreateBy(sysUser.getUserId());
|
|
|
+ dbInOutRecord.setCreateName(sysUser.getUserName());
|
|
|
+ }
|
|
|
dbInOutRecord.setType(1);
|
|
|
- dbInOutRecord.setPhone(tokenService.getLoginUser().getSysUser().getPhonenumber());
|
|
|
dbInOutRecordService.save(dbInOutRecord);
|
|
|
dbBeaconService.update(new LambdaUpdateWrapper<DbBeacon>().eq(DbBeacon::getBeaconTag, dbInOutRecord.getBeaconTag()).set(DbBeacon::getState, Boolean.TRUE).set(DbBeacon::getBindingTime, LocalDateTime.now()));
|
|
|
//todo 重新加载入库的信标到redis chai
|
|
|
@@ -127,9 +135,17 @@ public class DbStockController extends AbstractController {
|
|
|
if(dbStockBo.getGasPressure() != null){
|
|
|
dbStockService.update(new LambdaUpdateWrapper<DbStock>().set(DbStock::getGasPressure, dbStockBo.getGasPressure()).eq(DbStock::getGasPressure, dbStockBo.getGasPressure()));
|
|
|
}
|
|
|
+ SysUser sysUser = tokenService.getLoginUser().getSysUser();
|
|
|
if (dbStockService.removeById(stock.getId())) {
|
|
|
DbInOutRecord dbInOutRecord = new DbInOutRecord();
|
|
|
- BeanUtils.copyProperties(stock, dbInOutRecord);
|
|
|
+ BeanUtils.copyProperties(stock, dbInOutRecord,new String[] {"createBy","createTime","updateName","updateBy","updateTime","createName"});
|
|
|
+ if(sysUser != null){
|
|
|
+ dbInOutRecord.setOperator(sysUser.getNickName());
|
|
|
+ dbInOutRecord.setOperatorId(sysUser.getUserId());
|
|
|
+ dbInOutRecord.setPhone(sysUser.getPhonenumber());
|
|
|
+ dbInOutRecord.setCreateBy(sysUser.getUserId());
|
|
|
+ dbInOutRecord.setCreateName(sysUser.getUserName());
|
|
|
+ }
|
|
|
dbInOutRecord.setType(2);
|
|
|
dbInOutRecordService.save(dbInOutRecord);
|
|
|
//解除信标
|