Commit 086dd6f9 authored by tangwei's avatar tangwei

处理提示数据

parent 1ef8f611
...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller; ...@@ -3,6 +3,9 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.yeejoin.amos.boot.module.jxiop.api.dto.PersonDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.PersonDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.UserMapperDto; import com.yeejoin.amos.boot.module.jxiop.api.dto.UserMapperDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -10,6 +13,9 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -10,6 +13,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List; import java.util.List;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PersonBasicServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.PersonBasicServiceImpl;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -43,10 +49,20 @@ public class PersonBasicController extends BaseController { ...@@ -43,10 +49,20 @@ public class PersonBasicController extends BaseController {
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增人员基本信息", notes = "新增人员基本信息") @ApiOperation(httpMethod = "POST", value = "新增人员基本信息", notes = "新增人员基本信息")
public ResponseModel<Object> save(@RequestBody PersonDto model,HttpServletRequest httpServletRequest) { public ResponseModel<Object> save(@RequestBody PersonDto model,HttpServletRequest httpServletRequest) {
personBasicServiceImpl.addPerson(model,httpServletRequest);
try {
personBasicServiceImpl.addPerson(model,httpServletRequest);
}catch (InnerInvokException e){
return this.buildResponseFalse(e.getMessage());
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
...@@ -57,7 +73,13 @@ public class PersonBasicController extends BaseController { ...@@ -57,7 +73,13 @@ public class PersonBasicController extends BaseController {
@PutMapping(value = "/update") @PutMapping(value = "/update")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新人员基本信息", notes = "根据sequenceNbr更新人员基本信息") @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新人员基本信息", notes = "根据sequenceNbr更新人员基本信息")
public ResponseModel<PersonDto> updateBySequenceNbrPersonBasic(@RequestBody PersonDto model,@RequestParam(value = "sequenceNbr") Long sequenceNbr,HttpServletRequest httpServletRequest) { public ResponseModel<PersonDto> updateBySequenceNbrPersonBasic(@RequestBody PersonDto model,@RequestParam(value = "sequenceNbr") Long sequenceNbr,HttpServletRequest httpServletRequest) {
return ResponseHelper.buildResponse(personBasicServiceImpl.updatePerson(model,httpServletRequest,sequenceNbr)); try {
personBasicServiceImpl.updatePerson(model,httpServletRequest,sequenceNbr);
}catch (InnerInvokException e){
return this.buildResponseFalse(e.getMessage());
}
return ResponseHelper.buildResponse(null);
} }
/** /**
...@@ -70,10 +92,16 @@ public class PersonBasicController extends BaseController { ...@@ -70,10 +92,16 @@ public class PersonBasicController extends BaseController {
@DeleteMapping(value = "/delete") @DeleteMapping(value = "/delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除人员基本信息", notes = "根据sequenceNbr删除人员基本信息") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除人员基本信息", notes = "根据sequenceNbr删除人员基本信息")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "ids") String ids){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "ids") String ids){
String[] idss=ids.split(","); int num=0;
int num= personBasicServiceImpl.deletePerson(idss); try {
String[] idss=ids.split(",");
num= personBasicServiceImpl.deletePerson(idss);
}catch (InnerInvokException e){
return this.buildResponseFalse(e.getMessage());
}
return ResponseHelper.buildResponse(num>0?true:false);
return ResponseHelper.buildResponse(num>0?true:false);
} }
/** /**
...@@ -127,4 +155,15 @@ public class PersonBasicController extends BaseController { ...@@ -127,4 +155,15 @@ public class PersonBasicController extends BaseController {
public ResponseModel<List<PersonBasicDto>> selectForList() { public ResponseModel<List<PersonBasicDto>> selectForList() {
return ResponseHelper.buildResponse(personBasicServiceImpl.queryForPersonBasicList()); return ResponseHelper.buildResponse(personBasicServiceImpl.queryForPersonBasicList());
} }
public ResponseModel buildResponseFalse(String message) {
ResponseModel response = new ResponseModel();
response.setResult(null);
response.setDevMessage("FAILURE");
response.setStatus(HttpStatus.BAD_REQUEST.value());
response.setMessage(message);
response.setDevMessage(message);
return response;
}
} }
...@@ -293,7 +293,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas ...@@ -293,7 +293,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas
if(amosUser.getStatus()==200){ if(amosUser.getStatus()==200){
user = amosUser.getResult(); user = amosUser.getResult();
}else{ }else{
throw new RuntimeException(); throw new RuntimeException(amosUser.getMessage());
} }
} }
return user; return user;
...@@ -308,7 +308,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas ...@@ -308,7 +308,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas
if(amosUser.getStatus()==200){ if(amosUser.getStatus()==200){
user = amosUser.getResult(); user = amosUser.getResult();
}else{ }else{
throw new RuntimeException(); throw new RuntimeException(amosUser.getMessage());
} }
} }
return user; return user;
...@@ -323,7 +323,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas ...@@ -323,7 +323,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas
if(de.getStatus()==200){ if(de.getStatus()==200){
departmentModel = de.getResult(); departmentModel = de.getResult();
}else{ }else{
throw new RuntimeException(); throw new RuntimeException(de.getMessage());
} }
} }
return departmentModel; return departmentModel;
...@@ -336,7 +336,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas ...@@ -336,7 +336,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas
if(cResult.getStatus()==200){ if(cResult.getStatus()==200){
companyModel = cResult.getResult(); companyModel = cResult.getResult();
}else{ }else{
throw new RuntimeException(); throw new RuntimeException(cResult.getMessage());
} }
} }
return companyModel; return companyModel;
...@@ -346,7 +346,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas ...@@ -346,7 +346,7 @@ public class PersonBasicServiceImpl extends BaseService<PersonBasicDto,PersonBas
if (!ObjectUtils.isEmpty(cResult)) { if (!ObjectUtils.isEmpty(cResult)) {
if(cResult.getStatus()!=200){ if(cResult.getStatus()!=200){
throw new RuntimeException(); throw new RuntimeException(cResult.getMessage());
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment