Merge branch 'develop_3' into 'develop_master'

Develop 3

See merge request LiuChao/foton-slrs-system-rest!380
This commit is contained in:
王夏晖
2022-01-19 19:34:32 +08:00
3 changed files with 76 additions and 22 deletions
@@ -8,6 +8,7 @@ import com.adc.da.slrs.customWorkGroup.service.IWorkGroupService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.codec.language.Nysiis;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -37,18 +38,21 @@ public class WorkGroupController extends BaseController<WorkGroup> {
@ApiModelProperty("新增工作组")
@PostMapping
public ResponseMessage addWorkGroup(WorkGroup workGroup) {
String meg="";
if (isDistinct(workGroup.getWorkGroup())){
ResponseMessage<Object> result = Result.success();
if (isDistinct(workGroup.getWorkGroup(),null)){
if (iWorkGroupService.add(workGroup)){
meg="新增成功!";
result=Result.success("200","新增成功");
}else {
meg="新增失败!";
result=Result.error("201","新增失败");
}
}else {
meg="组名已存在!";
result=Result.error("202","组名已存在");
}
return Result.success("200",meg);
return result;
}
@@ -72,32 +76,39 @@ public class WorkGroupController extends BaseController<WorkGroup> {
@ApiModelProperty("修改工作组")
@PutMapping
public ResponseMessage updateWorkGroup(WorkGroup workGroup){
String meg="";
if (isDistinct(workGroup.getWorkGroup())){
ResponseMessage<Object> result = Result.success();
if (isDistinct(workGroup.getWorkGroup(),workGroup.getId())){
if (iWorkGroupService.update(workGroup)){
meg="修改成功!";
result=Result.success("200", "修改成功");
}else {
meg="修改失败";
result=Result.error("201", "修改失败");
}
}else {
meg="组名已存在!";
result=Result.error("202", "组名已存在");
}
return Result.success("200",meg);
return result;
}
/**
* 判断提交的工作组名称是否重复
* @param groupName
* @return true 没有重复 false 有重复
* @param groupName 条件
* @param id 排除id
* @returntrue 没有重复 false 有重复
*/
private boolean isDistinct(String groupName){
private boolean isDistinct(String groupName,String id){
QueryWrapper<WorkGroup> ew = new QueryWrapper<>();
ew.eq("work_group_name",groupName);
if (id!=null){
ew.ne("id",id);
}
List<WorkGroup> list = iWorkGroupService.list(ew);
return list.isEmpty();
}
@@ -135,6 +135,7 @@ public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> i
selectFieldMap.put("standSort","STANDCLASSIFY");
selectFieldMap.put("standState","STANDSTATE");
selectFieldMap.put("standNature","STANDNATURE");
selectFieldMap.put("textStatus","TEXTSTATUS");
} else if (SarTypeEnum.INLAND_LAWS.getValue().equals(sarType) || SarTypeEnum.FOREIGN_LAWS.getValue().equals(sarType)) {
selectFieldMap = InitStandAttrUtil.selectFieldMapLaws;
selectFieldMap.put("isRelateAccess","SHIFOUGL");
@@ -199,6 +200,7 @@ public class SarUpdLogServiceImpl extends ServiceImpl<SarUpdLogDao, SarUpdLog> i
public String changeStandName (String field,String sarType) throws Exception{
switch (field) {
case "textStatus":return "文本状态";
case "country": return "适用区域";
case "isRelateAccess": return "重要度";
case "issueTime": return "发布日期";