日志-调整

This commit is contained in:
luolm 2025-02-09 11:09:36 +08:00
parent 78be5a048f
commit 92134db503
8 changed files with 72 additions and 5 deletions

View File

@ -102,6 +102,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>

View File

@ -0,0 +1,45 @@
package com.nflg.mobilebroken.admin.config;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* @decription
* @Author 大米
* @Date 2022/7/20 17:57
**/
@Configuration
public class JacksonMapper {
@Bean
public ObjectMapper serializingObjectMapper() {
JavaTimeModule module = new JavaTimeModule();
module.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
// module.addDeserializer(LocalDateTime.class, MyLocalDateTimeDeserializer.INSTANCE);
SimpleModule simpleModule = new SimpleModule();
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
// simpleModule.addSerializer(BigDecimal.class, new BigDecimalSerializer());
return Jackson2ObjectMapperBuilder.json()
.modules(module, simpleModule)
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.build();
}
}

View File

@ -59,14 +59,14 @@ public class RequestLogController extends ControllerBase {
/**
* 清除日志
* @param rowIds
* @param query
* @return
*/
@PostMapping("del")
@Transactional(rollbackFor = Exception.class)
public ApiResult<Boolean> del(@RequestBody List<Long> rowIds){
public ApiResult<Boolean> del(@RequestBody RequestLogQuery query){
VUtils.trueThrow(CollUtil.isEmpty(rowIds)).throwMessage(STATE.ParamErr,"请选择要删除的行");
List<Long> rowIds = logService.selectRowIds(query);
logService.getBaseMapper().deleteByIds(rowIds);
logDetailService.getBaseMapper().deleteByIds(rowIds);

View File

@ -181,7 +181,8 @@ public class TicketController extends ControllerBase {
String html = templateEngine.process("ticketpdf", context);
response.setContentType(MediaType.APPLICATION_PDF_VALUE);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode(ticket.getTitle() + ".pdf", StandardCharsets.UTF_8));
String encode = URLEncoder.encode(ticket.getTitle() + ".pdf", StandardCharsets.UTF_8);
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" +encode );
// 生成PDF
try {
ConverterProperties converterProperties = new ConverterProperties();

View File

@ -22,4 +22,6 @@ public interface TBaseRequestLogMapper extends BaseMapper<TBaseRequestLog> {
Page<TBaseRequestLog> getList(@Param("page")Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
void delByIds(@Param("ids")List<Long> ids);
List<Long> selectRowIds(@Param("query") PageBaseQuery query);
}

View File

@ -22,4 +22,7 @@ public interface ITBaseRequestLogService extends IService<TBaseRequestLog> {
Page<TBaseRequestLog> getList(@Param("page")Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
void delByIds(@Param("ids") List<Long> ids);
List<Long> selectRowIds(@Param("query") PageBaseQuery query);
}

View File

@ -30,4 +30,8 @@ public class TBaseRequestLogServiceImpl extends ServiceImpl<TBaseRequestLogMappe
public void delByIds(@Param("ids") List<Long> ids){
this.getBaseMapper().delByIds(ids);
}
public List<Long> selectRowIds(@Param("query") PageBaseQuery query){
return this.getBaseMapper().selectRowIds(query);
}
}

View File

@ -15,7 +15,7 @@
and data_create_user_no=#{query.dataCreateUserNo}
</if>
<if test="query.createStartTime!=null and query.createStartTime!=''">
and data_create_time>= #{query.createStartTime} and data_create_time &lt;= #{query.createEndTime}
and data_create_time>= #{query.createStartTime} and data_create_time &lt;= date_add(#{query.createEndTime}, INTERVAL 1 DAY )
</if>
</sql>
@ -25,6 +25,10 @@
<include refid="whr"/>
</select>
<select id="selectRowIds" resultType="java.lang.Long">
select row_id from t_base_request_log where 1=1 <include refid="whr"/>
</select>
<delete id="delByIds">
delete from t_base_request_log where row_id in
<foreach collection="ids" open="(" close=")" separator="," item="item">