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()); } } }