| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.log.annotation.Log; |
| | | import com.xinquan.common.log.enums.BusinessType; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.NoticeRecord; |
| | | import com.xinquan.system.domain.Version; |
| | | import com.xinquan.system.service.VersionService; |
| | | import com.xinquan.user.api.feign.RemoteAppUserService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private VersionService versionService; |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | @Autowired |
| | | private RemoteAppUserService remoteAppUserService; |
| | | @GetMapping("/detailVersionApp") |
| | | @ApiOperation(value = "查看详情版本管理", tags = "安卓版本管理") |
| | | public R<Version> detailVersionApp() { |
| | | List<Version> list = versionService.lambdaQuery().orderByDesc(BaseModel::getCreateTime).list(); |
| | | if (!list.isEmpty()){ |
| | | return R.ok(list.get(0)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | @GetMapping("/versionList") |
| | | @ApiOperation(value = "版本管理列表-分页", tags = {"管理后台-版本管理"}) |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | @PostMapping("/addVersion") |
| | | @ApiOperation(value = "新增版本管理", tags = "管理后台-版本管理") |
| | | @Log(title = "【版本管理】新增", businessType = BusinessType.INSERT) |
| | | |
| | | public R addVersion(@RequestBody Version homeBackgroundMusic) { |
| | | homeBackgroundMusic.setCreateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setCreateTime(LocalDateTime.now()); |
| | | List<AppUser> data = remoteAppUserService.getAllUserList().getData(); |
| | | for (AppUser datum : data) { |
| | | // 给用户添加一条系统消息 |
| | | NoticeRecord noticeRecord = new NoticeRecord(); |
| | | noticeRecord.setAppUserId(datum.getId()); |
| | | noticeRecord.setReadStatus(1); |
| | | noticeRecord.setNoticeType(1); |
| | | noticeRecord.setTitle("APP版本升级通知"); |
| | | noticeRecord.setContent("APP已更新至【"+homeBackgroundMusic.getVersionNo()+"】版本,请及时更新!"); |
| | | remoteAppUserService.addNoticeReplay(noticeRecord); |
| | | } |
| | | return R.ok(versionService.save(homeBackgroundMusic)); |
| | | } |
| | | @GetMapping("/detailVersion") |
| | |
| | | } |
| | | @PostMapping("/updateVersion") |
| | | @ApiOperation(value = "修改版本管理", tags = "管理后台-版本管理") |
| | | @Log(title = "【版本管理】修改", businessType = BusinessType.UPDATE) |
| | | |
| | | public R updateVersion(@RequestBody Version homeBackgroundMusic) { |
| | | homeBackgroundMusic.setUpdateBy(SecurityUtils.getUsername()); |
| | | homeBackgroundMusic.setUpdateTime(LocalDateTime.now()); |
| | |
| | | } |
| | | @PostMapping("/deleteVersion") |
| | | @ApiOperation(value = "批量删除", tags = "管理后台-版本管理") |
| | | @Log(title = "【版本管理】批量删除", businessType = BusinessType.DELETE) |
| | | |
| | | public R deleteVersion(String ids) { |
| | | return R.ok(versionService.removeBatchByIds(Arrays.asList(ids.split(",")).stream().map(Long::valueOf).collect(Collectors.toList()))); |
| | | } |