|
@@ -14,10 +14,8 @@ import io.swagger.annotations.ApiOperation;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* SecurityType RESTful接口:
|
|
* SecurityType RESTful接口:
|
|
@@ -58,8 +56,30 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
})
|
|
})
|
|
//@RequiresPermissions("securitytype:view")
|
|
//@RequiresPermissions("securitytype:view")
|
|
@GetMapping(value = "/like/")
|
|
@GetMapping(value = "/like/")
|
|
- public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize){
|
|
|
|
|
|
+ public RESTfulResult listLike(@RequestParam HashMap parmas,Integer pageNum, Integer pageSize,String[] Info){
|
|
PageList<SecurityType> list = securityTypeService.queryLikeForPage(parmas, pageNum, pageSize);
|
|
PageList<SecurityType> list = securityTypeService.queryLikeForPage(parmas, pageNum, pageSize);
|
|
|
|
+ //在前端已经判断过权限,后端保险,后期服务器压力大可以注释
|
|
|
|
+ List<String> infoList = Arrays.asList(Info);
|
|
|
|
+ List<SecurityType> securityTypeList= new ArrayList<>();
|
|
|
|
+ Integer total = 0;
|
|
|
|
+ for (int i = 0;i < list.getList().size();i++){
|
|
|
|
+ SecurityType securityInfo = (SecurityType) list.getList().get(i);
|
|
|
|
+ if (securityInfo.getSecurityInfo() != null && !"".equals(securityInfo.getSecurityInfo())) {
|
|
|
|
+ List<String> infoList2= Arrays.asList(securityInfo.getSecurityInfo().split(",")
|
|
|
|
+ ).stream().map(s -> (s.trim())).collect(Collectors.toList());
|
|
|
|
+ infoList2.retainAll(infoList);
|
|
|
|
+ if (infoList2.size()>0){
|
|
|
|
+ securityTypeList.add(securityInfo);
|
|
|
|
+ }else{
|
|
|
|
+ total++;
|
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ securityTypeList.add(securityInfo);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ list.setList(securityTypeList);
|
|
|
|
+ list.setTotal(list.getTotal()-total);
|
|
return success(list);
|
|
return success(list);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -139,6 +159,12 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
List<String> list = Arrays.asList(id.split(","));
|
|
List<String> list = Arrays.asList(id.split(","));
|
|
if(ListUtils.isNotEmpty(list)) {
|
|
if(ListUtils.isNotEmpty(list)) {
|
|
List<String> ids = ListUtils.convertList(list);
|
|
List<String> ids = ListUtils.convertList(list);
|
|
|
|
+ for (int i = 0; i < ids.size(); i++) {
|
|
|
|
+ if(securityTypeService.getParentNum(ids.get(i))>0)
|
|
|
|
+ {
|
|
|
|
+ return failed(null, "所选分类存在子级,请先删除子级分类");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
securityTypeService.delete(ids);
|
|
securityTypeService.delete(ids);
|
|
}
|
|
}
|
|
return success();
|
|
return success();
|
|
@@ -155,11 +181,17 @@ public class SecurityTypeController extends BaseRESTfulController {
|
|
@GetMapping(value = "/gettree/")
|
|
@GetMapping(value = "/gettree/")
|
|
public RESTfulResult getTree(@RequestParam HashMap parameters){
|
|
public RESTfulResult getTree(@RequestParam HashMap parameters){
|
|
TreeUtils treeUtils = new TreeUtils();
|
|
TreeUtils treeUtils = new TreeUtils();
|
|
- List<SecurityType> list = securityTypeService.getTree(parameters);
|
|
|
|
- return success(treeUtils.getTreeData(list));
|
|
|
|
|
|
+ String[] securityInfo =parameters.get("securityInfo").toString().split(",");
|
|
|
|
+ List<SecurityType> lists = securityTypeService.getTree();
|
|
|
|
+ for (int i = 0; i <securityInfo.length; i++) {
|
|
|
|
+ List<SecurityType> list = securityTypeService.getTreeByInfo(securityInfo[i]);
|
|
|
|
+ lists.removeAll(list);
|
|
|
|
+ lists.addAll(list);
|
|
|
|
+ }
|
|
|
|
+ return success(treeUtils.getTreeData(lists));
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "查询下拉框的值",notes = "根据 namd 和 id 来显示,可传参数ISSETTLE(列入结算),ISREAL(列入实绩),ISPLAN(列入计划),ISBALANCE(列入平衡表),HASPRODUCT(是否产出)")
|
|
|
|
|
|
+ @ApiOperation(value = "查询下拉框的值",notes = "根据 namd 和 id 来显示")
|
|
@GetMapping("/getIdAndName")
|
|
@GetMapping("/getIdAndName")
|
|
public RESTfulResult getIdAndName(@RequestParam HashMap<String, Object> parmas){
|
|
public RESTfulResult getIdAndName(@RequestParam HashMap<String, Object> parmas){
|
|
if(parmas.get("id") != null && !parmas.get("id").toString().isEmpty()){
|
|
if(parmas.get("id") != null && !parmas.get("id").toString().isEmpty()){
|