update:法规释疑库保存/发布前添加标准号和条款号的校验(部分完成,差调用)
This commit is contained in:
+3
-5
@@ -56,8 +56,7 @@ public class LawsRegulationsQuestionLibraryController {
|
|||||||
public Result<?> save(@RequestBody LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
public Result<?> save(@RequestBody LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
||||||
// 第一次保存,附上初值
|
// 第一次保存,附上初值
|
||||||
lawsRegulationsQuestionLibrary.setReleaseStatus(Constant.UN_PUBLISH); // 未发布
|
lawsRegulationsQuestionLibrary.setReleaseStatus(Constant.UN_PUBLISH); // 未发布
|
||||||
lawsRegulationsQuestionLibraryService.add(lawsRegulationsQuestionLibrary);
|
return lawsRegulationsQuestionLibraryService.add(lawsRegulationsQuestionLibrary);
|
||||||
return Result.OK(ResultCommon.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AutoLog(value = "法规释疑库-发布")
|
@AutoLog(value = "法规释疑库-发布")
|
||||||
@@ -68,14 +67,13 @@ public class LawsRegulationsQuestionLibraryController {
|
|||||||
// 不管第几次发布,发布时间都更新
|
// 不管第几次发布,发布时间都更新
|
||||||
lawsRegulationsQuestionLibrary.setReleaseTime(new Date());
|
lawsRegulationsQuestionLibrary.setReleaseTime(new Date());
|
||||||
lawsRegulationsQuestionLibrary.setReleaseStatus(Constant.PUBLISH);
|
lawsRegulationsQuestionLibrary.setReleaseStatus(Constant.PUBLISH);
|
||||||
lawsRegulationsQuestionLibraryService.add(lawsRegulationsQuestionLibrary);
|
return lawsRegulationsQuestionLibraryService.add(lawsRegulationsQuestionLibrary);
|
||||||
return Result.OK(ResultCommon.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AutoLog(value = "法规释疑库-通过id删除")
|
@AutoLog(value = "法规释疑库-通过id删除")
|
||||||
@ApiOperation(value = "法规释疑库-通过id删除", notes = "法规释疑库-通过id删除")
|
@ApiOperation(value = "法规释疑库-通过id删除", notes = "法规释疑库-通过id删除")
|
||||||
@PostMapping(value = "/delete")
|
@PostMapping(value = "/delete")
|
||||||
// @RequiresPermissions("legalClarificationDatabase:delete")
|
@RequiresPermissions("legalClarificationDatabase:delete")
|
||||||
public Result<?> delete(@RequestBody @ApiParam(name = "id", value = "主键") JSONObject jsonObject) {
|
public Result<?> delete(@RequestBody @ApiParam(name = "id", value = "主键") JSONObject jsonObject) {
|
||||||
if (Objects.isNull(jsonObject) || StringUtils.isBlank(jsonObject.getString("id"))) {
|
if (Objects.isNull(jsonObject) || StringUtils.isBlank(jsonObject.getString("id"))) {
|
||||||
throw new JeroBootException(ResultCommon.SELECT_DATA);
|
throw new JeroBootException(ResultCommon.SELECT_DATA);
|
||||||
|
|||||||
+6
@@ -43,9 +43,15 @@ public class LawsRegulationsQuestionLibrary implements Serializable {
|
|||||||
@ApiModelProperty(value = "标准编号")
|
@ApiModelProperty(value = "标准编号")
|
||||||
private String standardNumber;
|
private String standardNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "标准名称")
|
||||||
|
private String standardName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "条款号")
|
@ApiModelProperty(value = "条款号")
|
||||||
private String regulationNumber;
|
private String regulationNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "条款名称")
|
||||||
|
private String regulationName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "问题描述")
|
@ApiModelProperty(value = "问题描述")
|
||||||
private String problemDescription;
|
private String problemDescription;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -2,6 +2,7 @@ package com.jero.modules.laws.businessSupport.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.modules.laws.businessSupport.entity.LawsRegulationsQuestionLibrary;
|
import com.jero.modules.laws.businessSupport.entity.LawsRegulationsQuestionLibrary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,7 +28,7 @@ public interface ILawsRegulationsQuestionLibraryService extends IService<LawsReg
|
|||||||
* 保存
|
* 保存
|
||||||
* @param lawsRegulationsQuestionLibrary
|
* @param lawsRegulationsQuestionLibrary
|
||||||
*/
|
*/
|
||||||
void add(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary);
|
Result<?> add(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除
|
* 通过id删除
|
||||||
|
|||||||
+26
-2
@@ -3,6 +3,7 @@ package com.jero.modules.laws.businessSupport.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.api.vo.ResultCommon;
|
import com.jero.common.api.vo.ResultCommon;
|
||||||
import com.jero.common.exception.JeroBootException;
|
import com.jero.common.exception.JeroBootException;
|
||||||
import com.jero.common.system.vo.LoginUser;
|
import com.jero.common.system.vo.LoginUser;
|
||||||
@@ -15,6 +16,7 @@ import org.apache.shiro.SecurityUtils;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -49,7 +51,7 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
public Result<?> add(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
||||||
if (StringUtils.isBlank(lawsRegulationsQuestionLibrary.getQuestionSpecializedModule())) {
|
if (StringUtils.isBlank(lawsRegulationsQuestionLibrary.getQuestionSpecializedModule())) {
|
||||||
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "questionSpecializedModule");
|
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "questionSpecializedModule");
|
||||||
}
|
}
|
||||||
@@ -59,7 +61,29 @@ public class LawsRegulationsQuestionLibraryServiceImpl extends ServiceImpl<LawsR
|
|||||||
lawsRegulationsQuestionLibrary.setWriter(loginUser.getId());
|
lawsRegulationsQuestionLibrary.setWriter(loginUser.getId());
|
||||||
// 编辑后更新创建时间为最新时间,让其排在最前面
|
// 编辑后更新创建时间为最新时间,让其排在最前面
|
||||||
lawsRegulationsQuestionLibrary.setCreateTime(new Date());
|
lawsRegulationsQuestionLibrary.setCreateTime(new Date());
|
||||||
saveOrUpdate(lawsRegulationsQuestionLibrary);
|
saveOrUpdate(lawsRegulationsQuestionLibrary); // 不影响数据的正常保存或更新
|
||||||
|
// 校验标准编号和条款号是否存在,并给出提示信息
|
||||||
|
String standardNumber = lawsRegulationsQuestionLibrary.getStandardNumber();
|
||||||
|
String regulationNumber = lawsRegulationsQuestionLibrary.getRegulationNumber();
|
||||||
|
if (StringUtils.isNotBlank(standardNumber)) {
|
||||||
|
// 标准编号
|
||||||
|
List<String> standardNumberList = Arrays.asList(standardNumber.split(","));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(regulationNumber)) {
|
||||||
|
// 条款号
|
||||||
|
List<String> regulationNumberList = Arrays.asList(regulationNumber.split(","));
|
||||||
|
}
|
||||||
|
// TODO 调用校验标准号和条款号的接口拿到结果的信息, 如:xxx条款不存在
|
||||||
|
StringBuilder msg = new StringBuilder();
|
||||||
|
if (StringUtils.isNotEmpty(msg.toString())) {
|
||||||
|
Result<String> result = new Result<>();
|
||||||
|
result.setCode(61010); // 规定一个特殊的code码,前端会根据这个code码展示提示的消息
|
||||||
|
result.setMessage(msg.toString());
|
||||||
|
result.setSuccess(true);
|
||||||
|
return result;
|
||||||
|
}else {
|
||||||
|
return Result.OK(ResultCommon.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void isHaveOperateAuth(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
private void isHaveOperateAuth(LawsRegulationsQuestionLibrary lawsRegulationsQuestionLibrary) {
|
||||||
|
|||||||
Reference in New Issue
Block a user