|
|
@ -29,6 +29,7 @@ import com.thing.sys.security.context.UserContext; |
|
|
import com.thing.thing.api.controller.IotThingApiController; |
|
|
import com.thing.thing.api.controller.IotThingApiController; |
|
|
import com.thing.thing.api.dto.*; |
|
|
import com.thing.thing.api.dto.*; |
|
|
import com.thing.thing.api.entity.IotThingApiEntity; |
|
|
import com.thing.thing.api.entity.IotThingApiEntity; |
|
|
|
|
|
import com.thing.thing.api.entity.IotThingApiLogEntity; |
|
|
import com.thing.thing.api.excel.IotThingApiExcel; |
|
|
import com.thing.thing.api.excel.IotThingApiExcel; |
|
|
import com.thing.thing.api.mapper.IotThingApiMapper; |
|
|
import com.thing.thing.api.mapper.IotThingApiMapper; |
|
|
import com.thing.thing.api.service.IotThingApiLogService; |
|
|
import com.thing.thing.api.service.IotThingApiLogService; |
|
|
@ -295,6 +296,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
if (StringUtils.equals(remark, "0")) { |
|
|
if (StringUtils.equals(remark, "0")) { |
|
|
tenantCode = UserContext.getRealTenantCode(); |
|
|
tenantCode = UserContext.getRealTenantCode(); |
|
|
} |
|
|
} |
|
|
|
|
|
apiLog(apiEntity, apiEntity.getCreator().toString()); |
|
|
//获取函数主体 |
|
|
//获取函数主体 |
|
|
if (StringUtils.isBlank(apiEntity.getCallBody())) { |
|
|
if (StringUtils.isBlank(apiEntity.getCallBody())) { |
|
|
return encapsulationQuery(apiEntity.getThingCondition(), apiEntity.getAttrCondition(), apiEntity.getTimeCondition(), reqParams, page, limit, apiEntity.getSort(), tenantCode); |
|
|
return encapsulationQuery(apiEntity.getThingCondition(), apiEntity.getAttrCondition(), apiEntity.getTimeCondition(), reqParams, page, limit, apiEntity.getSort(), tenantCode); |
|
|
@ -822,7 +824,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
|
|
|
|
|
|
private void apiLog(IotThingApiEntity apiEntity, String caller) { |
|
|
private void apiLog(IotThingApiEntity apiEntity, String caller) { |
|
|
try { |
|
|
try { |
|
|
IotThingApiLogDTO apiLogDTO = new IotThingApiLogDTO(); |
|
|
|
|
|
|
|
|
IotThingApiLogEntity apiLogDTO = new IotThingApiLogEntity(); |
|
|
apiLogDTO.setApiId(apiEntity.getId()); |
|
|
apiLogDTO.setApiId(apiEntity.getId()); |
|
|
apiLogDTO.setCaller(caller); |
|
|
apiLogDTO.setCaller(caller); |
|
|
apiLogDTO.setApiName(apiEntity.getName()); |
|
|
apiLogDTO.setApiName(apiEntity.getName()); |
|
|
@ -841,7 +843,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
//调用IP |
|
|
//调用IP |
|
|
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|
|
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); |
|
|
apiLogDTO.setIp(IpUtils.getIpAddr(request)); |
|
|
apiLogDTO.setIp(IpUtils.getIpAddr(request)); |
|
|
apiLogService.saveDto(apiLogDTO); |
|
|
|
|
|
|
|
|
apiLogService.saveOrUpdate(apiLogDTO); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error(e.getMessage()); |
|
|
log.error(e.getMessage()); |
|
|
} |
|
|
} |
|
|
|