Commit 32b9ad68 authored by 周健威's avatar 周健威

添加日志接口

parent 19f33e6c
...@@ -3,8 +3,11 @@ package com.upyuns.platform.rs.website.entity; ...@@ -3,8 +3,11 @@ package com.upyuns.platform.rs.website.entity;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import javax.persistence.*; import javax.persistence.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
/** /**
...@@ -148,6 +151,13 @@ public class GaindataLog implements Serializable { ...@@ -148,6 +151,13 @@ public class GaindataLog implements Serializable {
@Column(name = "content") @Column(name = "content")
@ApiModelProperty(value = "内容") @ApiModelProperty(value = "内容")
private String content; private String content;
/**
* 日志时间
*/
@Column(name = "log_time")
@ApiModelProperty(value = "日志时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date logTime;
} }
...@@ -3,8 +3,12 @@ package com.upyuns.platform.rs.website.controller.web; ...@@ -3,8 +3,12 @@ package com.upyuns.platform.rs.website.controller.web;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.upyuns.platform.rs.website.biz.GainDataBiz;
import com.upyuns.platform.rs.website.biz.GaindataLogBiz; import com.upyuns.platform.rs.website.biz.GaindataLogBiz;
import com.upyuns.platform.rs.website.entity.GainData;
import com.upyuns.platform.rs.website.entity.GaindataLog; import com.upyuns.platform.rs.website.entity.GaindataLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map; import java.util.Map;
...@@ -13,6 +17,9 @@ import java.util.Map; ...@@ -13,6 +17,9 @@ import java.util.Map;
@RequestMapping("gaindataLog/web") @RequestMapping("gaindataLog/web")
public class GaindataLogController extends BaseController<GaindataLogBiz,GaindataLog> { public class GaindataLogController extends BaseController<GaindataLogBiz,GaindataLog> {
@Autowired
GainDataBiz gainDataBiz;
//1001--录入;2211--生产线镶嵌;2212--生产线温度反演;2213--生产线植被覆盖度;2214--生产线植被识别;2215--生产线水体识别;2216--生产线风险等级;2217--生产线病虫害监测 //1001--录入;2211--生产线镶嵌;2212--生产线温度反演;2213--生产线植被覆盖度;2214--生产线植被识别;2215--生产线水体识别;2216--生产线风险等级;2217--生产线病虫害监测
// static Map<String, String> // static Map<String, String>
// //
...@@ -25,22 +32,28 @@ public class GaindataLogController extends BaseController<GaindataLogBiz,Gaindat ...@@ -25,22 +32,28 @@ public class GaindataLogController extends BaseController<GaindataLogBiz,Gaindat
public ObjectRestResponse<GaindataLog> appunauthBaseAdd(@RequestBody GaindataLog entity){ public ObjectRestResponse<GaindataLog> appunauthBaseAdd(@RequestBody GaindataLog entity){
// if(GaindataLog.TYPE_1001.equals()) // if(GaindataLog.TYPE_1001.equals())
String content = "进行了一次{}操作"; String content = "进行了一次{}操作";
if(GaindataLog.TYPE_2211.equals(entity.getType())) { if(null != entity.getGainId()) {
entity.setContent(StrUtil.format(content, "生产线镶嵌")); GainData gainData = gainDataBiz.selectById(entity.getGainId());
} else if(GaindataLog.TYPE_2212.equals(entity.getType())) { if(null != gainData) {
entity.setContent(StrUtil.format(content, "生产线温度反演")); if(GaindataLog.TYPE_2211.equals(entity.getType())) {
} else if(GaindataLog.TYPE_2213.equals(entity.getType())) { entity.setContent(StrUtil.format(content, "生产线镶嵌"));
entity.setContent(StrUtil.format(content, "生产线植被覆盖度")); } else if(GaindataLog.TYPE_2212.equals(entity.getType())) {
} else if(GaindataLog.TYPE_2214.equals(entity.getType())) { entity.setContent(StrUtil.format(content, "生产线温度反演"));
entity.setContent(StrUtil.format(content, "生产线植被识别")); } else if(GaindataLog.TYPE_2213.equals(entity.getType())) {
} else if(GaindataLog.TYPE_2215.equals(entity.getType())) { entity.setContent(StrUtil.format(content, "生产线植被覆盖度"));
entity.setContent(StrUtil.format(content, "生产线水体识别")); } else if(GaindataLog.TYPE_2214.equals(entity.getType())) {
} else if(GaindataLog.TYPE_2215.equals(entity.getType())) { entity.setContent(StrUtil.format(content, "生产线植被识别"));
entity.setContent(StrUtil.format(content, "生产线风险等级")); } else if(GaindataLog.TYPE_2215.equals(entity.getType())) {
} else if(GaindataLog.TYPE_2215.equals(entity.getType())) { entity.setContent(StrUtil.format(content, "生产线水体识别"));
entity.setContent(StrUtil.format(content, "生产线病虫害监测")); } else if(GaindataLog.TYPE_2215.equals(entity.getType())) {
entity.setContent(StrUtil.format(content, "生产线风险等级"));
} else if(GaindataLog.TYPE_2215.equals(entity.getType())) {
entity.setContent(StrUtil.format(content, "生产线病虫害监测"));
}
baseBiz.insertSelective(entity);
return ObjectRestResponse.succ();
}
} }
baseBiz.insertSelective(entity); return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "参数错误");
return ObjectRestResponse.succ();
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment