|  | @@ -507,16 +507,22 @@ public class RuralProjectRecordsController extends BaseController {
 | 
	
		
			
				|  |  |  	 * 删除项目
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  |  	@RequestMapping(value = "adminDelete")
 | 
	
		
			
				|  |  | -	public String adminDelete(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
 | 
	
		
			
				|  |  | +	@ResponseBody
 | 
	
		
			
				|  |  | +	public Map adminDelete(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
 | 
	
		
			
				|  |  |  		int status = projectRecords.getProjectStatus();
 | 
	
		
			
				|  |  | +		Map map = new HashMap();
 | 
	
		
			
				|  |  |  		if(status== ProjectStatusEnum.SIGNED.getValue()){
 | 
	
		
			
				|  |  |  			projectRecordsService.adminDelete(projectRecords);
 | 
	
		
			
				|  |  |  			addMessage(redirectAttributes, "管理员删除项目成功");
 | 
	
		
			
				|  |  | -			return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectRecords/?repage";
 | 
	
		
			
				|  |  | +//			return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectRecords/?repage";
 | 
	
		
			
				|  |  | +			map.put("success","删除成功");
 | 
	
		
			
				|  |  | +			return map;
 | 
	
		
			
				|  |  |  		}else {
 | 
	
		
			
				|  |  |  			addMessage(redirectAttributes, "管理员删除项目失败");
 | 
	
		
			
				|  |  | +			map.put("failure","删除失败");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  | -		return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectRecords/?repage";
 | 
	
		
			
				|  |  | +//		return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralProjectRecords/?repage";
 | 
	
		
			
				|  |  | +		return map;
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
	
		
			
				|  | @@ -1238,15 +1244,33 @@ public class RuralProjectRecordsController extends BaseController {
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -//	/**
 | 
	
		
			
				|  |  | -//	 * 查询项目名称是否重复
 | 
	
		
			
				|  |  | -//	 */
 | 
	
		
			
				|  |  | -//	@RequestMapping(value = "reProjectName")
 | 
	
		
			
				|  |  | -//	@ResponseBody
 | 
	
		
			
				|  |  | -//	public Integer reProjectName(String projectName){
 | 
	
		
			
				|  |  | -//		Integer count = projectRecordsService.reProjectName(projectName);
 | 
	
		
			
				|  |  | -//		return count;
 | 
	
		
			
				|  |  | -//	}
 | 
	
		
			
				|  |  | +	/**
 | 
	
		
			
				|  |  | +	 * 查询项目的数量
 | 
	
		
			
				|  |  | +	 */
 | 
	
		
			
				|  |  | +	@RequestMapping(value = "queryProjectIsUse")
 | 
	
		
			
				|  |  | +	@ResponseBody
 | 
	
		
			
				|  |  | +	public Map queryProjectIsUse(RuralProjectRecords projectRecords, RedirectAttributes redirectAttributes) {
 | 
	
		
			
				|  |  | +		int status = projectRecords.getProjectStatus();
 | 
	
		
			
				|  |  | +		//判断该项目是否在发票或者报销中被引用,如果被引用则不允许作废
 | 
	
		
			
				|  |  | +		//查询报告中调用的次数(若被调用的发票也被作废 则可进行作废)
 | 
	
		
			
				|  |  | +		Map map = new HashMap();
 | 
	
		
			
				|  |  | +		Integer cancellationRelationCount = workInvoiceService.getProjectRelationListByProjectId(projectRecords.getId());
 | 
	
		
			
				|  |  | +		//查询报销中调用的次数(若被调用的报销被作废,则可进行作废)
 | 
	
		
			
				|  |  | +		Integer cancellationReimbursementCount = workReimbursementService.getWorkAccountByProjectId(projectRecords.getId());
 | 
	
		
			
				|  |  | +		if (cancellationRelationCount > 0 || cancellationReimbursementCount > 0) {
 | 
	
		
			
				|  |  | +			addMessage(redirectAttributes, "项目在开票或报销中已被使用,无法删除");
 | 
	
		
			
				|  |  | +			map.put("success", false);
 | 
	
		
			
				|  |  | +			map.put("message", "项目在开票或报销中已被使用,无法删除");
 | 
	
		
			
				|  |  | +			if ("1".equals(projectRecords.getProjectType())) {
 | 
	
		
			
				|  |  | +//				return "redirect:" + Global.getAdminPath() + "/ruralProject/ruralProjectRecords/?repage";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +//			return "redirect:"+Global.getAdminPath()+"/ruralProject/ruralCostProjectRecords/?repage";
 | 
	
		
			
				|  |  | +			return map;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		map.put("success", true);
 | 
	
		
			
				|  |  | +		map.put("message", "项目在开票或报销中未被使用,可以删除");
 | 
	
		
			
				|  |  | +		return map;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  }
 |