Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 1 year ago
parent
commit
8acef522c3
  1. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
  2. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
  3. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  4. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
  5. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java
  6. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml
  7. 10
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java
  8. 34
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml
  9. 3
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java
  10. 10
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java
  11. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java

@ -10,7 +10,7 @@ import org.springframework.context.annotation.ComponentScan;
@EnableBladeFeign
@SpringCloudApplication
@MapperScan("com.hnac.hzims.*.**.mapper.**")
@MapperScan("com.hnac.hzims.**.mapper.**")
@ComponentScan(basePackages = {"com.hnac.*"})
public class MiddleApplication {
static {

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java

@ -95,11 +95,11 @@ public class SysLogController {
* 根据Id获取日志数据
* @return
*/
@ApiOperation("根据Id获取日志数据")
@GetMapping("/get/{id}")
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = SysLog.class),
})
@ApiOperation("根据Id获取日志数据")
@GetMapping("/get/{id}")
public R getById(@PathVariable Long id) {
SysLog sysLog = sysLogService.getById(id);
return R.data(sysLog);

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java

@ -1,5 +1,6 @@
package com.hnac.hzims.middle.systemlog.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableField;
@ -33,7 +34,7 @@ public class Statistics implements Serializable {
* 编号
*/
@ApiModelProperty("编号")
@TableField("id")
@TableId("id")
private Long id;

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java

@ -1,5 +1,7 @@
package com.hnac.hzims.middle.systemlog.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;
@ -36,7 +38,7 @@ public class SysLog implements Serializable {
/**
* 操作日志编号
*/
@TableField("id")
@TableId(value = "id",type = IdType.ASSIGN_ID)
private Long id;

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.java

@ -6,7 +6,9 @@ import com.hnac.hzims.middle.systemlog.entity.Statistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.middle.systemlog.vo.StatisticsResponseVo;
import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* <p>

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/StatisticsMapper.xml

@ -5,6 +5,14 @@
<select id="selectPages" resultType="com.hnac.hzims.middle.systemlog.vo.StatisticsResponseVo">
select module_name moduleName, sum(module_name_num) moduleNameNum
from hzims_statistics
<where>
<if test="statistics.createTime != null">
date_format(date_calculated,'%Y-%m-%d') &gt;= #{statistics.createTime}
</if>
<if test="statistics.endTime != null">
and date_format(date_calculated,'%Y-%m-%d') &lt;= #{statistics.endTime}
</if>
</where>
group by module_name;
</select>
</mapper>

10
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.java

@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.middle.systemlog.vo.StatisticsTitleResponseVo;
import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
import com.hnac.hzims.middle.systemlog.vo.SysLogStatisticsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -37,4 +39,12 @@ public interface SysLogMapper extends BaseMapper<SysLog> {
* @return
*/
IPage<StatisticsTitleResponseVo> statisticsTitleByModuleName(Page<StatisticsTitleResponseVo> moduleName, @Param("statisticsVo") StatisticsVo statisticsVo);
/**
* 根据Id获取日志数据
* @param id
* @return
*/
SysLog getSysLogById(@Param("id") Long id);
}

34
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/mapper/SysLogMapper.xml

@ -35,4 +35,38 @@
group by title;
</select>
<select id="getSysLogById" resultType="com.hnac.hzims.middle.systemlog.entity.SysLog">
select id,
tenant_id,
server_ip,
server_host,
server_name,
env,
operation_user_id,
operation_user_name,
path,
user_agent,
method,
method_class,
method_name,
cost_time,
parameter,
module_name,
title,
action,
operator_type,
business_type,
json_result,
local_ip,
error_msg,
operation_time,
status,
create_time,
update_time,
is_deleted
from hzims_sys_log
where id = #{id}
</select>
</mapper>

3
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/SysLogService.java

@ -46,4 +46,7 @@ public interface SysLogService extends IService<SysLog> {
*/
IPage<StatisticsTitleResponseVo> statisticsTitleByModuleName(Page<StatisticsTitleResponseVo> statisticsTitleResponseVoPage,
StatisticsVo statisticsVo);
}

10
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/StatisticsServiceImpl.java

@ -33,10 +33,6 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
@Autowired
private SysLogService sysLogService;
@Autowired
private StatisticsService statisticsService;
/**
* 保存统计的数据
*/
@ -55,18 +51,18 @@ public class StatisticsServiceImpl extends ServiceImpl<StatisticsMapper, Statist
continue;
}
//查询数据
Statistics statistics = statisticsService.getStatisticsBydateCalculated(sysLogStatisticsVo);
Statistics statistics = this.getStatisticsBydateCalculated(sysLogStatisticsVo);
//如果为空保存数据,如果不为空更新数据
if (statistics == null) {
statistics = new Statistics();
statistics.setDateCalculated(sysLogStatisticsVo.getOperationTime());
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statistics.setModuleName(sysLogStatisticsVo.getModuleName());
statisticsService.save(statistics);
this.save(statistics);
} else {
statistics.setModuleName(sysLogStatisticsVo.getModuleName());
statistics.setModuleNameNum(sysLogStatisticsVo.getModuleNameCount());
statisticsService.updateById(statistics);
this.updateById(statistics);
}
}
}

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/service/impl/SysLogServiceImpl.java

@ -67,6 +67,8 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
}
/**
* 日志查询接口
* @param sysLog

Loading…
Cancel
Save