| 
					
				 | 
			
			
				@ -11,6 +11,7 @@ import com.yihu.jw.entity.iot.workType.IotWorkTypeDO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.iot.platform.IotInterfaceLogVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.restmodel.web.MixEnvelop; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.rm.iot.IotRequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.util.date.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.mysql.query.BaseJpaService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.apache.commons.lang.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import org.slf4j.Logger; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -24,6 +25,7 @@ import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.InetAddress; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.net.UnknownHostException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.sql.Time; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.DecimalFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -54,7 +56,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 分页查询日志信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 分页查询所有接口日志信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -62,10 +64,8 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotInterfaceLogVO,IotInterfaceLogVO> findAll(Integer page, Integer size) throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "select * from iot_interface_log where 1=1;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sorts = "-updateTime";//按更新时间降序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String sql = "SELECT * FROM (select * from iot_interface_log c where 1=1  ORDER BY c.time desc) b GROUP BY b.interface_name;"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//        List<IotInterfaceLogDO> list = search(null, filters, sorts, page, size); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotInterfaceLogDO.class)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -83,6 +83,34 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 根据接口名称分页查询接口日志信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param size 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param interfaceName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public MixEnvelop<IotInterfaceLogVO, IotInterfaceLogVO> findInterfaceLog(Integer page, Integer size, String interfaceName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        List<IotInterfaceLogDO> list = iotInterfaceLogDao.findAllByInterfaceName(interfaceName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        list.forEach(one->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            IotInterfaceLogVO target = new IotInterfaceLogVO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            BeanUtils.copyProperties(one,target); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            resultList.add(target); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        long count =list.size(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 数据消费 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param page 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -169,9 +197,8 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param interfaceName 接口名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param method 方法名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param workTypeId 业务类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * @param time 调用时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveLog(String appId, String params, String response, HttpServletRequest request,Integer state,String  interfaceName,String method,String workTypeId,Date time){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public void saveLog(String appId, String params, String response, HttpServletRequest request,Integer state,String  interfaceName,String method,String workTypeId){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        IotInterfaceLogDO interfaceLogDO = new IotInterfaceLogDO(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //设置应用与公司 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -210,7 +237,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        interfaceLogDO.setState(state); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        interfaceLogDO.setInterfaceName(interfaceName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        interfaceLogDO.setMethod(method); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        interfaceLogDO.setTime(time); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        interfaceLogDO.setTime(DateUtil.getNowDate()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        iotInterfaceLogDao.save(interfaceLogDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 |