| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.task.handler.WCSReportHandler; |
| | | import com.zy.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WCSReportHandler wcsReportHandler; |
| | | |
| | | @RequestMapping(value = "/wrkMast/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | return R.ok(wrkMastService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | | } else if (entry.getKey().endsWith("<")) { |
| | | wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)){ |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), String.valueOf(entry.getValue())); |
| | | wrapper.eq(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/add/auth") |
| | | @ManagerAuth(memo = "工作档添加") |
| | | @ManagerAuth(memo = "response.wrk_mast_add") |
| | | public R add(WrkMast wrkMast) { |
| | | wrkMast.setModiUser(getUserId()); |
| | | wrkMast.setModiTime(new Date()); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/update/auth") |
| | | @ManagerAuth(memo = "工作档修改") |
| | | @ManagerAuth(memo = "response.wrk_mast_update") |
| | | public R update(WrkMast wrkMast){ |
| | | if (Cools.isEmpty(wrkMast) || null==wrkMast.getWrkNo()){ |
| | | return R.error(); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/delete/auth") |
| | | @ManagerAuth(memo = "工作档删除") |
| | | @ManagerAuth(memo = "response.wrk_mast_delete") |
| | | public R delete(@RequestParam String param){ |
| | | List<WrkMast> list = JSONArray.parseArray(param, WrkMast.class); |
| | | if (Cools.isEmpty(list)){ |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/export/auth") |
| | | @ManagerAuth(memo = "工作档导出") |
| | | @ManagerAuth(memo = "response.wrk_mast_export") |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<WrkMast> wrapper = new EntityWrapper<>(); |
| | |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<WrkMast> wrapper = new EntityWrapper<WrkMast>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != wrkMastService.selectOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(WrkMast.class, String.valueOf(param.get("key")))); |
| | | R r = R.parse(BaseRes.REPEAT); |
| | | r.put("data", getComment(WrkMast.class, String.valueOf(param.get("key")))); |
| | | return r; |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/add/pri/auth") |
| | | @ManagerAuth(memo = "工作档增加优先级") |
| | | @ManagerAuth(memo = "response.wrk_mast_add_pri") |
| | | public R addPri(@RequestBody List<WrkMast> list) { |
| | | if (list.isEmpty()) { |
| | | return R.error("请至少选择一行数据"); |
| | | return R.error("response.select_at_least_one_merge_data"); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | entity.setIoPri(entity.getIoPri() + 1); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/red/pri/auth") |
| | | @ManagerAuth(memo = "工作档降低优先级") |
| | | @ManagerAuth(memo = "response.wrk_mast_red_pri") |
| | | public R redPri(@RequestBody List<WrkMast> list) { |
| | | if (list.isEmpty()) { |
| | | return R.error("请至少选择一行数据"); |
| | | return R.error("response.select_at_least_one_merge_data"); |
| | | } |
| | | for (WrkMast entity : list){ |
| | | entity.setIoPri(entity.getIoPri() - 1); |