| | |
| | | plan.setForm(JSON.toJSONString(param)); // 自定义表单内容 |
| | | plan.setSettle(1); // 1.开始 |
| | | |
| | | planService.insert(plan); |
| | | if (!planService.insert(plan)) { |
| | | throw new CoolException("保持失败,请重试"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/plan/update/auth") |
| | | @ManagerAuth |
| | | public R update(Plan plan){ |
| | | if (Cools.isEmpty(plan) || null==plan.getId()){ |
| | | public R update(@RequestParam Map<String, Object> param){ |
| | | if (Cools.isEmpty(param) || Cools.isEmpty(param.get("id"))){ |
| | | return R.error(); |
| | | } |
| | | // pre |
| | | Plan plan = JSON.parseObject(JSON.toJSONString(param), Plan.class); |
| | | param.entrySet().removeIf(next -> this.fields.contains(next.getKey())); |
| | | plan.setUpdateBy(getUserId()); |
| | | plan.setUpdateTime(new Date()); |
| | | planService.updateById(plan); |
| | | |
| | | plan.setForm(JSON.toJSONString(param)); // 自定义表单内容 |
| | | |
| | | if (!planService.updateById(plan)) { |
| | | throw new CoolException("保持失败,请重试"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |