Commit 656671e4 authored by 赵啸非's avatar 赵啸非

添加设备相关信息

parent 85b8593d
Pipeline #2634 canceled with stages
......@@ -8,6 +8,7 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.code.EnabledEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.LoginForm;
import com.mortals.xhx.common.pdu.device.DeviceReq;
import com.mortals.xhx.feign.device.IDeviceFeign;
......@@ -24,20 +25,20 @@ import org.springframework.util.ObjectUtils;
import java.util.Date;
/**
* DeviceService
* 设备 service实现
*
* @author zxfei
* @date 2023-02-25
*/
* DeviceService
* 设备 service实现
*
* @author zxfei
* @date 2023-02-25
*/
@Service("deviceService")
@Slf4j
public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, DeviceEntity, Long> implements DeviceService {
@Autowired
private IDeviceFeign deviceFeign;
@Value("${token.loginName:'admin'}")
@Value("${token.loginName:admin}")
private String loginName;
@Value("${token.password:'admin'}")
@Value("${token.password:admin}")
private String password;
......@@ -68,7 +69,6 @@ public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, Device
deviceEntity.setUpdateUserId(getContextUserId(context));
this.getDao().update(deviceEntity);
String token = getToken();
log.info("token:{}",token);
DeviceReq deviceReq = new DeviceReq();
deviceReq.setReceiveMethod(DeviceMethodEnum.ENABLED.getValue());
deviceReq.setDeviceCode(deviceEntity.getDeviceCode());
......@@ -82,7 +82,11 @@ public class DeviceServiceImpl extends AbstractCRUDServiceImpl<DeviceDao, Device
loginForm.setLoginName(loginName);
loginForm.setPassword(password);
Rest<String> rest = deviceFeign.getToken(loginForm);
if (YesNoEnum.YES.getValue() == rest.getCode()) {
String token = rest.getData();
return token;
} else {
throw new AppException("get token errors! " + rest.getMsg());
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment