| | |
| | | package com.zy.crm.manager.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | |
| | | ); |
| | | } |
| | | |
| | | private final List<String> fields = new ArrayList<>(); |
| | | |
| | | { |
| | | Arrays.asList(Cools.getAllFields(Plan.class)).forEach(item -> { |
| | | fields.add(item.getName()); |
| | | }); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/add/auth") |
| | | @ManagerAuth |
| | | public R add(Plan plan) { |
| | | public R add0(@RequestParam Map<String, Object> param) { |
| | | // pre |
| | | Plan plan = JSON.parseObject(JSON.toJSONString(param), Plan.class); |
| | | Iterator<Map.Entry<String, Object>> iterator = param.entrySet().iterator(); |
| | | while (iterator.hasNext()) { |
| | | Map.Entry<String, Object> next = iterator.next(); |
| | | if (this.fields.contains(next.getKey())) { |
| | | iterator.remove(); |
| | | } |
| | | } |
| | | // begin |
| | | Long hostId = getHostId(); |
| | | if (planService.selectByUuid(hostId, plan.getUuid()) != null) { |
| | | throw new CoolException("规划单已存在"); |
| | |
| | | plan.setUpdateTime(new Date()); |
| | | plan.setStatus(1); |
| | | |
| | | plan.setForm(JSON.toJSONString(param)); // 自定义表单内容 |
| | | plan.setSettle(1); // 1.开始 |
| | | |
| | | planService.insert(plan); |
| | | return R.ok(); |
| | | return R.error(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/update/auth") |