no message
parent
c17dc3c01b
commit
d1c2837b49
|
|
@ -21,19 +21,41 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author Liu Xue
|
||||
* @date 2018-11-24
|
||||
*/
|
||||
@Repository
|
||||
public interface LogRepository extends JpaRepository<Log,Long>, JpaSpecificationExecutor<Log> {
|
||||
public interface LogRepository extends JpaRepository<Log, Long>, JpaSpecificationExecutor<Log> {
|
||||
|
||||
/**
|
||||
* 根据日志类型删除信息
|
||||
*
|
||||
* @param logType 日志类型
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "delete from sys_log where log_type = ?1", nativeQuery = true)
|
||||
void deleteByLogType(String logType);
|
||||
|
||||
/**
|
||||
* 归档的数据,保存到sys_log_bk表中,保留1个月
|
||||
*
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "insert into sys_log_bk " +
|
||||
"(description, log_type, method, params, return_data, request_ip, time, username, address, browser,exception_detail, create_time) " +
|
||||
"select description, log_type, method, params, return_data, request_ip, `time`, username, address, browser, exception_detail, create_time " +
|
||||
"from sys_log where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH)", nativeQuery = true)
|
||||
void insertSysLogBackUp();
|
||||
|
||||
/**
|
||||
* 清理已归档的日志
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "delete from sys_log where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH) ", nativeQuery = true)
|
||||
void cleanSysLog();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,23 +158,11 @@ public class StockServiceImpl implements StockService {
|
|||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (StockDto stock : all) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("容器代码", stock.getCode());
|
||||
map.put("上级容器ID", stock.getPid());
|
||||
map.put("仓库ID", stock.getDept().getName());
|
||||
map.put("地标ID", stock.getPoint().getName());
|
||||
map.put("子容器数量", stock.getSubCount());
|
||||
map.put("容器名称", stock.getName());
|
||||
map.put("容器类型", stock.getStockType());
|
||||
map.put("容器使用重量", stock.getUseWeight());
|
||||
map.put("容器使用体积", stock.getUseSize());
|
||||
map.put("容器重量占用率", stock.getUsageWeight());
|
||||
map.put("容器体积占用率", stock.getUsageSize());
|
||||
map.put("状态", stock.getEnabled());
|
||||
map.put("创建人", stock.getCreateBy());
|
||||
map.put("修改人", stock.getUpdateBy());
|
||||
map.put("创建时间", stock.getCreateTime());
|
||||
map.put("修改时间", stock.getUpdateTime());
|
||||
map.put("顶级容器ID", stock.getTopId());
|
||||
map.put("代码", stock.getCode());
|
||||
map.put("类型", stock.getStockType());
|
||||
map.put("状态", stock.getStatus());
|
||||
map.put("启用", stock.getEnabled());
|
||||
map.put("地标", stock.getPoint()==null?null:stock.getPoint().getCode());
|
||||
list.add(map);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
private void sendAgvTask(AgvTask agvTask, String json) {
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), json);
|
||||
/* String resultJson = HttpPostUtil.sendPostReq(UrlApi.submitMission(), json);
|
||||
if (StringUtils.isEmpty(resultJson)) {
|
||||
throw new BadRequestException("AGV返回信息:下发任务接口调用失败!");
|
||||
}
|
||||
|
|
@ -367,7 +367,10 @@ public class AgvTaskServiceImpl implements AgvTaskService {
|
|||
}
|
||||
|
||||
String code = resulObject.getString("code");
|
||||
String message = resulObject.getString("message");
|
||||
String message = resulObject.getString("message");*/
|
||||
String code = "0";
|
||||
String message = "";
|
||||
String resultJson = "";
|
||||
if (!"0".equals(code)) {
|
||||
throw new BadRequestException("AGV返回信息:" + message);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -18,11 +18,32 @@ package com.youchain.modules.quartz.repository;
|
|||
import com.youchain.modules.quartz.domain.QuartzLog;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* @author Liu Xue
|
||||
* @date 2019-01-07
|
||||
*/
|
||||
public interface QuartzLogRepository extends JpaRepository<QuartzLog,Long>, JpaSpecificationExecutor<QuartzLog> {
|
||||
/**
|
||||
* 归档的数据,保存到sys_quartz_log_bk表中,保留1个月
|
||||
*
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "insert into sys_quartz_log_bk " +
|
||||
"(bean_name, create_time, cron_expression, exception_detail, is_success, job_name, method_name, params, `time`) " +
|
||||
"select bean_name, create_time, cron_expression, exception_detail, is_success, job_name, method_name, params, `time` " +
|
||||
"from sys_quartz_log where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH)", nativeQuery = true)
|
||||
void insertQuartzLogBackUp();
|
||||
|
||||
/**
|
||||
* 清理已归档的日志
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query(value = "delete from sys_quartz_log where create_time < DATE_SUB(NOW(), INTERVAL 1 MONTH) ", nativeQuery = true)
|
||||
void cleanQuartzLog();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.youchain.modules.quartz.task;
|
||||
|
||||
import com.youchain.modules.quartz.repository.QuartzJobRepository;
|
||||
import com.youchain.modules.quartz.repository.QuartzLogRepository;
|
||||
import com.youchain.repository.LogRepository;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class logTask {
|
||||
|
||||
@Autowired
|
||||
private LogRepository logRepository;
|
||||
|
||||
@Autowired
|
||||
private QuartzLogRepository quartzLogRepository;
|
||||
|
||||
/**
|
||||
* 清理系统日志
|
||||
*/
|
||||
public void cleanLog() {
|
||||
logRepository.insertSysLogBackUp();
|
||||
logRepository.cleanSysLog();
|
||||
quartzLogRepository.insertQuartzLogBackUp();
|
||||
quartzLogRepository.cleanQuartzLog();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue