|  | @@ -1,14 +1,14 @@
 | 
	
		
			
				|  |  |  package thyyxxk.webserver.service.reports;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import lombok.Data;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.config.exception.ExceptionEnum;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.dao.his.reports.ReportQueryCenterDao;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.ResultVo;
 | 
	
		
			
				|  |  |  import thyyxxk.webserver.entity.reports.reportQueryCenter.ReportForms;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.utils.ResultVoUtil;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.utils.SnowFlakeId;
 | 
	
		
			
				|  |  | -import thyyxxk.webserver.utils.StringUtil;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.service.PublicServer;
 | 
	
		
			
				|  |  | +import thyyxxk.webserver.utils.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.ArrayList;
 | 
	
		
			
				|  |  |  import java.util.HashMap;
 | 
	
	
		
			
				|  | @@ -19,10 +19,18 @@ import java.util.Map;
 | 
	
		
			
				|  |  |  @Slf4j
 | 
	
		
			
				|  |  |  public class ReportQueryCenterService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Data
 | 
	
		
			
				|  |  | +    public static class PersonRoleCode {
 | 
	
		
			
				|  |  | +        private String userCode;
 | 
	
		
			
				|  |  | +        private List<String> list;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      private final ReportQueryCenterDao dao;
 | 
	
		
			
				|  |  | +    private final PublicServer publicServer;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public ReportQueryCenterService(ReportQueryCenterDao dao) {
 | 
	
		
			
				|  |  | +    public ReportQueryCenterService(ReportQueryCenterDao dao, PublicServer publicServer) {
 | 
	
		
			
				|  |  |          this.dao = dao;
 | 
	
		
			
				|  |  | +        this.publicServer = publicServer;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public ResultVo<String> addReportQueryCenter(ReportForms param) {
 | 
	
	
		
			
				|  | @@ -35,7 +43,12 @@ public class ReportQueryCenterService {
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      public ResultVo<List<ReportForms>> getReportTree() {
 | 
	
		
			
				|  |  | -        List<ReportForms> list = dao.selectReportForms();
 | 
	
		
			
				|  |  | +        List<ReportForms> list;
 | 
	
		
			
				|  |  | +        if (publicServer.needRule()) {
 | 
	
		
			
				|  |  | +            list = dao.selectReportFormsAll();
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  | +            list = dao.selectReportForms(TokenUtil.getInstance().getTokenUserId());
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return ResultVoUtil.success(toTree(list));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -73,4 +86,25 @@ public class ReportQueryCenterService {
 | 
	
		
			
				|  |  |          return tree;
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public ResultVo<List<String>> getRulesByCode(String userCode) {
 | 
	
		
			
				|  |  | +        return ResultVoUtil.success(dao.getRulesByCode(userCode));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public ResultVo<String> updateParentById(String id, String parentId) {
 | 
	
		
			
				|  |  | +        if (StringUtil.isBlank(parentId)) {
 | 
	
		
			
				|  |  | +            parentId = null;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        dao.updateParentById(id, parentId);
 | 
	
		
			
				|  |  | +        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功。");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public ResultVo<String> saveThePersonRoleCode(PersonRoleCode data) {
 | 
	
		
			
				|  |  | +        dao.delRules(data.getUserCode());
 | 
	
		
			
				|  |  | +        ListUtil.batchList(data.getList(), ReportQueryCenterDao.class, (mapper, item) -> {
 | 
	
		
			
				|  |  | +            mapper.insertRules(data.getUserCode(), item);
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +        return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功。");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  }
 |