73 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			73 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using Model; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.Http;  | |||
|  | 
 | |||
|  | namespace WebAPI.Controllers | |||
|  | { | |||
|  |     /// <summary> | |||
|  |     /// 上报环保数据接口 | |||
|  |     /// </summary> | |||
|  |     public class EnvironmentalController : ApiController | |||
|  |     { | |||
|  |         #region 推送环境监测数据 | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 推送环境监测数据 | |||
|  |         /// </summary> | |||
|  |         /// <returns></returns>  | |||
|  |         [HttpPost] | |||
|  |         public Model.ResponeData PushEnvironmentalCheckData() | |||
|  |         { | |||
|  |             var responeData = new Model.ResponeData(); | |||
|  |             try | |||
|  |             { | |||
|  |                 var returndata = EnvironmentalCheckService.PushEnvironmentalCheckData(); | |||
|  |                 responeData.code = returndata.code; | |||
|  |                 responeData.message = returndata.message; | |||
|  |             } | |||
|  |             catch (Exception ex) | |||
|  |             { | |||
|  |                 responeData.code = 0; | |||
|  |                 responeData.message = ex.Message; | |||
|  |             } | |||
|  |             return responeData; | |||
|  |         } | |||
|  | 
 | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 保存环境监测数据 | |||
|  |         /// </summary> | |||
|  |         /// <param name="input"></param> | |||
|  |         /// <returns></returns> | |||
|  |         [HttpPost] | |||
|  |         public Model.ResponeData SaveEnvironmentData(Model.EnvironmentalCheckInput input) | |||
|  |         { | |||
|  |             var responeData = new Model.ResponeData(); | |||
|  |             try | |||
|  |             { | |||
|  |                 if (BLL.APIProjectService.getProjectByProjectId(input.ProjectId) != null) | |||
|  |                 { | |||
|  |                     responeData.data = LotAPIService.saveEnvironmentCheck(input); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     responeData.code = 0; | |||
|  |                     responeData.message = "此项目不存在!"; | |||
|  |                 } | |||
|  | 
 | |||
|  |             } | |||
|  |             catch (Exception ex) | |||
|  |             { | |||
|  |                 responeData.code = 0; | |||
|  |                 responeData.message = ex.Message; | |||
|  |             } | |||
|  | 
 | |||
|  |             return responeData; | |||
|  |         } | |||
|  |     } | |||
|  | } |