收藏减少必填字段

This commit is contained in:
caozhen
2023-09-12 17:50:26 +08:00
parent 2b4a154665
commit 4ca9ba7477
3 changed files with 11 additions and 22 deletions
@@ -53,6 +53,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
@ApiOperation(value="标准收藏-国内收藏", notes="标准收藏-国内收藏")
@PostMapping(value = "/domestic/add")
public Result<T> domesticAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
lawsStandardCollection.setSource("1");
lawsStandardCollectionService.add(lawsStandardCollection);
return Result.OK("操作成功!");
}
@@ -78,6 +79,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
@ApiOperation(value="标准收藏-海外收藏", notes="标准收藏-海外收藏")
@PostMapping(value = "/overseas/add")
public Result<T> overseasAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
lawsStandardCollection.setSource("2");
lawsStandardCollectionService.add(lawsStandardCollection);
return Result.OK("操作成功!");
}
@@ -103,6 +105,7 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
@ApiOperation(value="标准收藏-企标收藏", notes="标准收藏-企标收藏")
@PostMapping(value = "/enterprise/add")
public Result<T> enterpriseAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
lawsStandardCollection.setSource("3");
lawsStandardCollectionService.add(lawsStandardCollection);
return Result.OK("操作成功!");
}
@@ -14,6 +14,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotBlank;
/**
* @Description: 标准收藏
@@ -44,6 +46,7 @@ public class LawsStandardCollection implements Serializable {
/**标准ID*/
@ApiModelProperty(value = "标准ID")
@NotBlank(message = "standardId not null")
private String standardId;
/**标准类别(GB、GB/T)*/
@@ -52,6 +55,7 @@ public class LawsStandardCollection implements Serializable {
/**标准编号*/
@ApiModelProperty(value = "标准编号")
@NotBlank(message = "standardNumber not null")
private String standardNumber;
/**标准名称*/
@@ -5,6 +5,7 @@ import com.jero.common.system.vo.LoginUser;
import com.jero.modules.laws.common.service.ILawsCommonService;
import com.jero.modules.laws.enterprise.entity.EnterpriseStandard;
import com.jero.modules.laws.enterprise.service.EnterpriseStandardService;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.personal.entity.LawsStandardCollection;
@@ -94,28 +95,9 @@ public class LawsStandardCollectionServiceImpl extends ServiceImpl<LawsStandardC
*/
@Override
public void add(LawsStandardCollection lawsStandardCollection) {
//下面这些判断是给前端联调时给前端看的
String standardClass = lawsStandardCollection.getStandardClass();
if (StringUtils.isBlank(standardClass)){
throw new JeroBootException("standardClass标准类别参数不能为空");
}
String standardNumber = lawsStandardCollection.getStandardNumber();
if (StringUtils.isBlank(standardNumber)){
throw new JeroBootException("standardNumber标准编号参数不能为空");
}
String standardName = lawsStandardCollection.getStandardName();
if (StringUtils.isBlank(standardName)){
throw new JeroBootException("standardName标准名称参数不能为空");
}
String source1 = lawsStandardCollection.getSource();
if (StringUtils.isBlank(source1)){
throw new JeroBootException("source1收藏标准来源(1国内、2海外、3企标)参数不能为空");
}
String collectionStandardId = lawsStandardCollection.getStandardId();
if (StringUtils.isBlank(collectionStandardId)){
throw new JeroBootException("standardId标准ID(参数不能为空");
}
LawsDomesticStandard standard = lawsDomesticStandardService.queryById(lawsStandardCollection.getStandardId());
lawsStandardCollection.setStandardClass(standard.getStandardClass());
lawsStandardCollection.setStandardName(standard.getStandardName());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
lawsStandardCollection.setCollectorId(sysUser.getId());
Date now = new Date();