5 changed files with 290 additions and 168 deletions
-
52src/main/java/a8k/app/controler/api/v1/app/setting/DeviceInfoControler.java
-
114src/main/java/a8k/app/controler/api/v1/app/setting/DeviceSettingControler.java
-
95src/main/java/a8k/app/controler/api/v1/app/setting/LISSettingControler.java
-
1src/main/java/a8k/app/dao/db/AppSettingDao.java
@ -0,0 +1,52 @@ |
|||||
|
package a8k.app.controler.api.v1.app.setting; |
||||
|
|
||||
|
import a8k.app.a8ktype.ui.ApiRet; |
||||
|
import a8k.app.service.statemgr.GStateMgrService; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
|
||||
|
@Tag(name = "设备信息", description = "") |
||||
|
@Slf4j |
||||
|
@Controller |
||||
|
@RequestMapping(value = "/api/v1/app/DeviceInfo/") |
||||
|
@ResponseBody |
||||
|
public class DeviceInfoControler { |
||||
|
@Resource |
||||
|
GStateMgrService gstate; |
||||
|
|
||||
|
public static class DeviceInfo { |
||||
|
public String appVersion; |
||||
|
public String mcuVersion; |
||||
|
public String sn; |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "获取设备信息") |
||||
|
@PostMapping("/getDeviceInfo") |
||||
|
public ApiRet<DeviceInfo> getDeviceInfo() { |
||||
|
DeviceInfo info = new DeviceInfo(); |
||||
|
info.appVersion = gstate.getAppVersion(); |
||||
|
info.mcuVersion = gstate.getMcuVersion(); |
||||
|
info.sn = gstate.getSn(); |
||||
|
return ApiRet.success(info); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "更新MCU版本") |
||||
|
@PostMapping("/updateMcuVersion") |
||||
|
public void updateMcuVersion() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "更新APP代码") |
||||
|
@PostMapping("/updateAppVersion") |
||||
|
public void updateAppVersion() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,114 @@ |
|||||
|
package a8k.app.controler.api.v1.app.setting; |
||||
|
|
||||
|
import a8k.app.a8ktype.ui.ApiRet; |
||||
|
import a8k.app.dao.db.type.AppSetting; |
||||
|
import a8k.app.dao.db.type.appsetting.settingenum.*; |
||||
|
import a8k.app.service.setting.AppSettingsMgrService; |
||||
|
import a8k.app.service.statemgr.GStateMgrService; |
||||
|
import a8k.app.utils.ZList; |
||||
|
import a8k.extui.type.ret.AppRetV1; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
@Tag(name = "设备设置", description = "") |
||||
|
@Slf4j |
||||
|
@Controller |
||||
|
@RequestMapping(value = "/api/v1/app/DeviceSetting/") |
||||
|
@ResponseBody |
||||
|
public class DeviceSettingControler { |
||||
|
@Resource |
||||
|
AppSettingsMgrService appSettingsMgrService; |
||||
|
|
||||
|
@Resource |
||||
|
GStateMgrService gstate; |
||||
|
|
||||
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
|
// EXT FUNC |
||||
|
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||||
|
|
||||
|
public static class DeviceSetting { |
||||
|
public LanguageType language; |
||||
|
public Boolean autoPrint; |
||||
|
public Boolean autoLogout; |
||||
|
public Integer temperature; |
||||
|
public Boolean DHCP; |
||||
|
public String localIp; |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "获取系统设置") |
||||
|
@PostMapping("/getSetting") |
||||
|
public ApiRet<DeviceSetting> getAppSettings() { |
||||
|
DeviceSetting setting = new DeviceSetting(); |
||||
|
AppSetting appSetting = appSettingsMgrService.getAppSettings(); |
||||
|
setting.language = appSetting.language; |
||||
|
setting.autoPrint = appSetting.autoPrint; |
||||
|
setting.autoLogout = appSetting.autoLogout; |
||||
|
setting.temperature = appSetting.temperature; |
||||
|
setting.DHCP = appSetting.DHCP; |
||||
|
setting.localIp = appSetting.localIp; |
||||
|
return ApiRet.success(setting); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Operation(summary = "设置语言") |
||||
|
@PostMapping("/setLanguage") |
||||
|
public ApiRet<Void> setLanguage(LanguageType val) { |
||||
|
appSettingsMgrService.setLanguage(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Operation(summary = "设置自动打印报告") |
||||
|
@PostMapping("/setAutoPrint") |
||||
|
public ApiRet<Void> setAutoPrint(Boolean val) { |
||||
|
appSettingsMgrService.setAutoPrint(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Operation(summary = "设置自动登出") |
||||
|
@PostMapping("/setAutoLogout") |
||||
|
public ApiRet<Void> setAutoLogout(Boolean val) { |
||||
|
appSettingsMgrService.setAutoLogout(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "设置设备温度") |
||||
|
@PostMapping("/setTemperature") |
||||
|
public ApiRet<Void> setTemperature(Integer val) { |
||||
|
log.info("setTemperature:{}", val); |
||||
|
appSettingsMgrService.setTemperature(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Operation(summary = "设置DHCP") |
||||
|
@PostMapping("/setDHCCP") |
||||
|
public ApiRet<Void> setDHCP(Boolean val) { |
||||
|
appSettingsMgrService.setDHCP(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "设置本地IP") |
||||
|
@PostMapping("/setLocalIp") |
||||
|
public ApiRet<Void> setLocalIp(String val) { |
||||
|
appSettingsMgrService.setLocalIp(val); |
||||
|
return ApiRet.success(); |
||||
|
} |
||||
|
|
||||
|
@Operation(summary = "获取温度范围") |
||||
|
@PostMapping("/getTemperatureAvailableRange") |
||||
|
public ApiRet<List<Integer>> getTemperatureAvailableRange() { |
||||
|
return ApiRet.success(ZList.of(25, 35)); |
||||
|
} |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue