dev:代码规范修改
parent
56622a7e55
commit
c14eb8e8a0
|
|
@ -69,16 +69,14 @@ public class PostController {
|
|||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/getInfoById")
|
||||
public SingleResponse<PostCO> getInfoById(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.valueOf(id);
|
||||
return postService.getInfoById(idLong);
|
||||
public SingleResponse<PostCO> getInfoById(@RequestParam(value = "id") Long id) {
|
||||
return postService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PutMapping("/remove")
|
||||
public Response remove(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.valueOf(id);
|
||||
postService.remove(idLong);
|
||||
public Response remove(@RequestParam(value = "id") Long id) {
|
||||
postService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,10 +41,6 @@ public class UserQualificationInfoController {
|
|||
@PostMapping("/save")
|
||||
public SingleResponse<UserQualificationInfoCO> add(@Validated @RequestBody UserQualificationInfoAddCmd cmd) {
|
||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||
if(cmd.getQualificationinfoType() == 1
|
||||
&& (StringUtils.isEmpty(cmd.getOperatingProject()) || StringUtils.isEmpty(cmd.getOperatingProjectName()))){
|
||||
throw new BizException("操作项目不能为空。");
|
||||
}
|
||||
return userQualificationInfoService.add(cmd);
|
||||
}
|
||||
|
||||
|
|
@ -52,10 +48,6 @@ public class UserQualificationInfoController {
|
|||
@PutMapping("/edit")
|
||||
public SingleResponse edit(@Validated @RequestBody UserQualificationInfoUpdateCmd cmd) {
|
||||
|
||||
if(cmd.getQualificationinfoType() == 1
|
||||
&& (StringUtils.isEmpty(cmd.getOperatingProject()) || StringUtils.isEmpty(cmd.getOperatingProjectName()))){
|
||||
throw new BizException("操作项目不能为空。");
|
||||
}
|
||||
userQualificationInfoService.edit(cmd);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
|
@ -74,16 +66,14 @@ public class UserQualificationInfoController {
|
|||
|
||||
@ApiOperation("详情")
|
||||
@GetMapping("/getInfoById")
|
||||
public SingleResponse<UserQualificationInfoCO> getInfoById(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.valueOf(id);
|
||||
return userQualificationInfoService.getInfoById(idLong);
|
||||
public SingleResponse<UserQualificationInfoCO> getInfoById(@RequestParam(value = "id") Long id) {
|
||||
return userQualificationInfoService.getInfoById(id);
|
||||
}
|
||||
|
||||
@ApiOperation("删除")
|
||||
@PutMapping("/remove")
|
||||
public Response remove(@RequestParam(value = "id") String id) {
|
||||
Long idLong = Long.valueOf(id);
|
||||
userQualificationInfoService.remove(idLong);
|
||||
public Response remove(@RequestParam(value = "id") Long id) {
|
||||
userQualificationInfoService.remove(id);
|
||||
return SingleResponse.buildSuccess();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ public class UserQualificationInfoAddExe {
|
|||
userQualificationInfoE.checkNull(BeanUtil.copyToList(list, UserQualificationInfoE.class));
|
||||
|
||||
BeanUtils.copyProperties(cmd, userQualificationInfoE);
|
||||
|
||||
// 校验特种作业证书是否有操作项目
|
||||
userQualificationInfoE.checkOperatingProject(userQualificationInfoE);
|
||||
|
||||
boolean res = false;
|
||||
try {
|
||||
res = userQualificationInfoGateway.add(userQualificationInfoE);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ public class UserQualificationInfoUpdateExe {
|
|||
userQualificationInfoE.checkNull(BeanUtil.copyToList(list, UserQualificationInfoE.class));
|
||||
|
||||
BeanUtils.copyProperties(cmd, userQualificationInfoE);
|
||||
|
||||
// 校验特种作业证书是否有操作项目
|
||||
userQualificationInfoE.checkOperatingProject(userQualificationInfoE);
|
||||
|
||||
boolean res = userQualificationInfoGateway.update(userQualificationInfoE);
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ public class PostRemoveCmd extends Command {
|
|||
|
||||
@ApiModelProperty(value = "主键", name = "ids", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
@Size(min = 1, message = "至少需要一个主键")
|
||||
private Long[] ids;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import lombok.NoArgsConstructor;
|
|||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +26,7 @@ public class UserQualificationInfoRemoveCmd extends Command {
|
|||
|
||||
@ApiModelProperty(value = "主键", name = "ids", required = true)
|
||||
@NotNull(message = "主键不能为空")
|
||||
@Size(min = 1, message = "至少需要一个主键")
|
||||
private Long[] ids;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.alibaba.cola.exception.BizException;
|
|||
import com.jjb.saas.framework.domain.model.BaseE;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -77,5 +78,17 @@ public class UserQualificationInfoE extends BaseE {
|
|||
throw new BizException("该证书编号重复");
|
||||
}
|
||||
}
|
||||
|
||||
// 校验特种作业证书是否有操作项目
|
||||
public void checkOperatingProject(UserQualificationInfoE entity){
|
||||
if(entity == null){
|
||||
throw new BizException("对象不能为空。");
|
||||
}
|
||||
if(entity.getQualificationinfoType() == 1){
|
||||
if(StringUtils.isEmpty(entity.getOperatingProject()) || StringUtils.isEmpty(entity.getOperatingProjectName())){
|
||||
throw new BizException("操作项目不能为空。");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue