| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.enums.SqlLike; |
| | |
| | | import com.zy.asrs.entity.AgvWrkMast; |
| | | import com.zy.asrs.service.AgvWaitPakinService; |
| | | import com.zy.asrs.service.AgvWrkMastService; |
| | | import com.zy.asrs.task.core.WrkMastConfig; |
| | | import com.zy.common.web.BaseController; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | AgvWrkMastService agvWrkMastService; |
| | | |
| | | @Autowired |
| | | AgvWaitPakinService agvWaitPakinService; |
| | | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | |
| | | @RequestMapping(value = "/wrkMast/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(agvWrkMastPage); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/list/error") |
| | | @ManagerAuth |
| | | public R listerror(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam(required = false) String condition, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>(); |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "WRKMAST_WARN_CONFIG")); |
| | | if (config != null && config.getValue() != null) { |
| | | List<WrkMastConfig> wrkMastConfigs = JSONArray.parseArray(config.getValue(), WrkMastConfig.class); |
| | | for (WrkMastConfig wrkMastConfig : wrkMastConfigs) { |
| | | wrapper.eq("wrk_sts", wrkMastConfig.getSts()).le("modi_time", DateUtil.offsetHour(new Date(), -wrkMastConfig.getHours())); |
| | | if (!wrkMastConfigs.get(wrkMastConfigs.size() - 1).equals(wrkMastConfig)) { |
| | | wrapper.orNew(); |
| | | } |
| | | } |
| | | Page<AgvWrkMast> agvWrkMastPage = agvWrkMastService.selectPage(new Page<>(curr, limit), wrapper); |
| | | return R.ok(agvWrkMastPage); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/list/auth/dbList") |
| | | @ManagerAuth |
| | | public R dbList(@RequestParam(defaultValue = "1") Integer curr, |
| | |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | convert2(param, wrapper); |
| | | allLike(AgvWrkMast.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | if (orderByField.endsWith("$")) { |
| | |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("wrkMast")); |
| | | convert(map, wrapper); |
| | | convert2(map, wrapper); |
| | | List<AgvWrkMast> list = agvWrkMastService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |