|
@ -173,6 +173,62 @@ public class MedicinedeviceService extends BaseJpaService<Mediicinedevice, Medi
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 更新设备状态
|
|
|
* @param deviceId
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String updateDeviceStatus(String deviceId, String status){
|
|
|
JSONObject result = new JSONObject();
|
|
|
if(StringUtils.isEmpty(deviceId) && StringUtils.isEmpty(status)){
|
|
|
result.put("msg","deviceId and status is null");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
if (mediicinedevice == null) {
|
|
|
result.put("msg","device doesn't exist");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
mediicinedevice.setStatus(status);
|
|
|
this.save(mediicinedevice);
|
|
|
result.put("response",ConstantUtils.SUCCESS);
|
|
|
result.put("msg",mediicinedevice);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 更新设备销售状态
|
|
|
* @param deviceId
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String updateDeviceSaleStatus(String deviceId, String saleStatus){
|
|
|
JSONObject result = new JSONObject();
|
|
|
if(StringUtils.isEmpty(deviceId) && StringUtils.isEmpty(saleStatus)){
|
|
|
result.put("msg","deviceId and saleStatus is null");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
Mediicinedevice mediicinedevice = deviceDao.findOne(deviceId);
|
|
|
if (mediicinedevice == null) {
|
|
|
result.put("msg","device doesn't exist");
|
|
|
result.put("response", ConstantUtils.FAIL);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
mediicinedevice.setSaleStatus(saleStatus);
|
|
|
this.save(mediicinedevice);
|
|
|
result.put("response",ConstantUtils.SUCCESS);
|
|
|
result.put("msg",mediicinedevice);
|
|
|
return result.toJSONString();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 分页查询设备信息
|
|
|
* @param content
|