-
Notifications
You must be signed in to change notification settings - Fork 41
/
ApplicationController.java
45 lines (36 loc) · 1.49 KB
/
ApplicationController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.softeng.dingtalk.controller;
import com.softeng.dingtalk.entity.AcItem;
import com.softeng.dingtalk.entity.Application;
import com.softeng.dingtalk.repository.AcItemRepository;
import com.softeng.dingtalk.service.AcItemService;
import com.softeng.dingtalk.service.ApplicationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author zhanyeye
* @description
* @create 12/11/2019 1:59 PM
*/
@RestController
@RequestMapping("/api")
@Slf4j
public class ApplicationController {
@Autowired
ApplicationService applicationService;
@Autowired
AcItemService acItemService;
/**
* @description 添加申请
* @date 3:02 PM 12/11/2019
**/
@PostMapping("/application")
public void addApplication(@RequestBody Application application) {
List<AcItem> acItems = application.getAcItems(); //获取该绩效申请的ac申请
//拼接 month, week, applicant_id, auditor_id 字段,插入flag约束字段中
application.setFlag(application.getMonth()+ "-" + application.getWeek() + "-" + application.getApplicant().getId() + "-" + application.getAuditor().getId());
Application a = applicationService.addApplication(application); //持久化绩效申请
acItemService.addAcItemList(acItems, a); //持久化ac申请,并将绩效申请作为外键
}
}