|  |  |  | 
|---|
|  |  |  | Date date = new Date(); | 
|---|
|  |  |  | SimpleDateFormat format = new SimpleDateFormat("yyyy"); | 
|---|
|  |  |  | String year = format.format(date); | 
|---|
|  |  |  | return R.ok(companyTargetService.selectByYear(year)); | 
|---|
|  |  |  | return R.ok(companyTargetService.selectCompanyByYear(year)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/{id}/auth") | 
|---|
|  |  |  | 
|---|
|  |  |  | EntityWrapper<CompanyTarget> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | wrapper.isNull("staff"); | 
|---|
|  |  |  | allLike(CompanyTarget.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(companyTargetService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/person/list/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R personList(@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<CompanyTarget> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | excludeTrash(param); | 
|---|
|  |  |  | convert(param, wrapper); | 
|---|
|  |  |  | wrapper.eq("staff", getUserId()); | 
|---|
|  |  |  | allLike(CompanyTarget.class, param.keySet(), wrapper, condition); | 
|---|
|  |  |  | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} | 
|---|
|  |  |  | return R.ok(companyTargetService.selectPage(new Page<>(curr, limit), wrapper)); | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/add/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "添加年度目标") | 
|---|
|  |  |  | public R add(CompanyTarget companyTarget) { | 
|---|
|  |  |  | CompanyTarget target = companyTargetService.selectCompanyByYear(companyTarget.getYear()); | 
|---|
|  |  |  | if (target != null) { | 
|---|
|  |  |  | return R.error("已存在年度目标"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | companyTarget.setCreateTime(new Date()); | 
|---|
|  |  |  | companyTarget.setUserId(getUserId()); | 
|---|
|  |  |  | companyTargetService.insert(companyTarget); | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/person/add/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "添加个人年度目标") | 
|---|
|  |  |  | public R addPerson(CompanyTarget companyTarget) { | 
|---|
|  |  |  | CompanyTarget target = companyTargetService.selectPersonByYear(companyTarget.getYear(), getUserId()); | 
|---|
|  |  |  | if (target != null) { | 
|---|
|  |  |  | return R.error("已存在年度目标"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | companyTarget.setCreateTime(new Date()); | 
|---|
|  |  |  | companyTarget.setUserId(getUserId()); | 
|---|
|  |  |  | companyTarget.setStaff(getUserId()); | 
|---|
|  |  |  | companyTargetService.insert(companyTarget); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/person/update/auth") | 
|---|
|  |  |  | @ManagerAuth(memo = "更新个人年度目标") | 
|---|
|  |  |  | public R updatePerson(CompanyTarget companyTarget){ | 
|---|
|  |  |  | if (Cools.isEmpty(companyTarget) || null==companyTarget.getId()){ | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | companyTarget.setUpdateTime(new Date()); | 
|---|
|  |  |  | companyTarget.setUpdateUserId(getUserId()); | 
|---|
|  |  |  | companyTargetService.updateById(companyTarget); | 
|---|
|  |  |  | return R.ok(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/companyTarget/export/auth") | 
|---|
|  |  |  | @ManagerAuth | 
|---|
|  |  |  | public R export(@RequestBody JSONObject param){ | 
|---|