ReferApiController.java
2.26 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package com.huaheng.api.general.controller;
import com.huaheng.api.general.domain.ReferDomain;
import com.huaheng.api.general.service.ReferApiService;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.domain.AjaxResultRefer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/api")
@Api(tags = {"下发接口"}, value = "下发接口referApi")
public class ReferApiController extends BaseController {
@Resource
private ReferApiService referApiService;
/**
* 上游下发任务
*/
@Log(title = "上游下发任务", action = BusinessType.INSERT)
@PostMapping("/referApi")
@ApiOperation("上游下发任务")
@ResponseBody
@ApiLogger(apiName = "上游下发任务", from = "ERP")
public AjaxResultRefer referApi(@RequestBody ReferDomain referDomain) {
if (referDomain == null) {
return AjaxResultRefer.error("referApi:传参不能为空");
}
if (StringUtils.isEmpty(referDomain.getTRART())) {
return AjaxResultRefer.error("referApi:任务类型不能为空");
}
if (StringUtils.isEmpty(referDomain.getTANUM())) {
return AjaxResultRefer.error("referApi:任务号不能为空");
}
if (StringUtils.isEmpty(referDomain.getCREATOR())) {
return AjaxResultRefer.error("referApi:创建人不能为空");
}
AjaxResult result = handleMultiProcess(new BaseController.MultiProcessListener() {
@Override
public AjaxResult doProcess() {
AjaxResult ajaxResult = referApiService.getData(referDomain);
return ajaxResult;
}
});
if (result.hasErr()) {
return AjaxResultRefer.error(result.getMsg());
} else {
return AjaxResultRefer.success(result.getMsg());
}
}
}