| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | |
| | | @RequestMapping(value = "/apkBuildTask/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(apkBuildTaskService.selectById(id)); |
| | | return R.ok(apkBuildTaskService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<ApkBuildTask> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<ApkBuildTask> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(orderByField, "asc".equalsIgnoreCase(orderByType)); |
| | | wrapper.orderBy(true, "asc".equalsIgnoreCase(orderByType), orderByField); |
| | | } else { |
| | | wrapper.orderBy("id", false); |
| | | wrapper.orderBy(true, false, "id"); |
| | | } |
| | | |
| | | return R.ok(apkBuildTaskService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(apkBuildTaskService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 搜索参数转换 |
| | | */ |
| | | private void convert(Map<String, Object> map, EntityWrapper<ApkBuildTask> wrapper) { |
| | | private void convert(Map<String, Object> map, QueryWrapper<ApkBuildTask> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | |
| | | try { |
| | | int count = apkBuildTaskService.refreshAllPendingTasks(); |
| | | // 返回所有任务列表 |
| | | EntityWrapper<ApkBuildTask> wrapper = new EntityWrapper<>(); |
| | | wrapper.orderBy("id", false); |
| | | List<ApkBuildTask> tasks = apkBuildTaskService.selectList(wrapper); |
| | | QueryWrapper<ApkBuildTask> wrapper = new QueryWrapper<>(); |
| | | wrapper.orderBy(true, false, "id"); |
| | | List<ApkBuildTask> tasks = apkBuildTaskService.list(wrapper); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("tasks", tasks); |
| | | result.put("refreshedCount", count); |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | return R.error(); |
| | | } |
| | | apkBuildTaskService.deleteBatchIds(Arrays.asList(ids)); |
| | | apkBuildTaskService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |