|
@@ -7,13 +7,18 @@ import com.fdkankan.agent.common.ResultData;
|
|
import com.fdkankan.agent.entity.AgentAuthorizeModeling;
|
|
import com.fdkankan.agent.entity.AgentAuthorizeModeling;
|
|
import com.fdkankan.agent.exception.BusinessException;
|
|
import com.fdkankan.agent.exception.BusinessException;
|
|
import com.fdkankan.agent.mapper.IAgentAuthorizeModelingMapper;
|
|
import com.fdkankan.agent.mapper.IAgentAuthorizeModelingMapper;
|
|
|
|
+import com.fdkankan.agent.request.AuthModelingParam;
|
|
import com.fdkankan.agent.request.AuthorizeParam;
|
|
import com.fdkankan.agent.request.AuthorizeParam;
|
|
import com.fdkankan.agent.service.IAgentAuthorizeModelingService;
|
|
import com.fdkankan.agent.service.IAgentAuthorizeModelingService;
|
|
import com.fdkankan.agent.service.IExcelService;
|
|
import com.fdkankan.agent.service.IExcelService;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.util.StringUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 前端控制器
|
|
* 前端控制器
|
|
@@ -40,8 +45,19 @@ public class AgentAuthorizeModelingController extends BaseController {
|
|
|
|
|
|
@PostMapping("/addOrUpdate")
|
|
@PostMapping("/addOrUpdate")
|
|
public ResultData addOrUpdate(@RequestBody AgentAuthorizeModeling param){
|
|
public ResultData addOrUpdate(@RequestBody AgentAuthorizeModeling param){
|
|
|
|
+ if(StringUtils.isBlank(param.getAuthorizeKey())){
|
|
|
|
+ throw new BusinessException(ResultCode.PARAM_MISS);
|
|
|
|
+ }
|
|
|
|
+ List<AgentAuthorizeModeling> authModelings = authorizeModelingService.getByAuthorizeKey(param.getAuthorizeKey());
|
|
if(param.getId() == null){
|
|
if(param.getId() == null){
|
|
param.setCreateAgentId(getAgent().getId());
|
|
param.setCreateAgentId(getAgent().getId());
|
|
|
|
+ if(!authModelings.isEmpty()){
|
|
|
|
+ throw new BusinessException(ResultCode.AUTH_CODE_EXIST);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ if(!authModelings.get(0).getId().equals(param.getId())){
|
|
|
|
+ throw new BusinessException(ResultCode.AUTH_CODE_EXIST);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return ResultData.ok( authorizeModelingService.addOrUpdate(param));
|
|
return ResultData.ok( authorizeModelingService.addOrUpdate(param));
|
|
}
|
|
}
|