|
@@ -43,17 +43,22 @@ public class RtkInfoController {
|
|
|
|
|
|
@PostMapping("/saveOrEdit")
|
|
|
public ResultData saveOrEdit(@RequestBody RtkInfo rtkInfo){
|
|
|
- RtkInfo dbRtkInfo = rtkInfoService.getByRtkSnCode(rtkInfo.getRtkSnCode());
|
|
|
+ if(StringUtils.isNotBlank(rtkInfo.getRtkSnCode())){
|
|
|
+ RtkInfo dbRtkInfo = rtkInfoService.getByRtkSnCode(rtkInfo.getRtkSnCode());
|
|
|
+ if(rtkInfo.getId() == null){
|
|
|
+ if(dbRtkInfo != null){
|
|
|
+ throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if( dbRtkInfo != null && !Objects.equals(dbRtkInfo.getId(), rtkInfo.getId()) ){
|
|
|
+ throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if(rtkInfo.getId() == null){
|
|
|
rtkInfo.setCreateUserId(Long.valueOf((String)StpUtil.getLoginId()));
|
|
|
- if(dbRtkInfo != null){
|
|
|
- throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
- }
|
|
|
}else {
|
|
|
rtkInfo.setUpdateUserId(Long.valueOf((String)StpUtil.getLoginId()));
|
|
|
- if( dbRtkInfo != null && !Objects.equals(dbRtkInfo.getId(), rtkInfo.getId()) ){
|
|
|
- throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
- }
|
|
|
}
|
|
|
if(rtkInfo.getRtkType() != null && rtkInfo.getRtkType() == 0){
|
|
|
rtkInfo.setIpAddr(null);
|