package com.fgkj.actions;
|
|
import java.util.List;
|
|
import com.fgkj.dao.UinfDaoFactory;
|
import com.fgkj.dto.BattInf;
|
import com.fgkj.dto.Batt_replace;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.dto.User_inf;
|
import com.fgkj.dto.User_log;
|
import com.fgkj.services.Batt_replaceService;
|
import com.fgkj.services.User_logService;
|
import com.google.gson.reflect.TypeToken;
|
|
public class Batt_replaceAction extends ActionUtil{
|
private Batt_replaceService service=new Batt_replaceService();
|
private User_logService uservice=new User_logService();
|
private String json;
|
private String result;
|
|
//添加机房电池更改记录
|
public String add() {
|
Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
|
User_inf uinf=(User_inf) getUser();
|
re.setReplaced_uid(uinf.getUId());
|
ServiceModel model=service.add(re);
|
result=tojson(model);
|
{
|
String msg="添加新机房电池更改记录:"+re.getStationid();
|
User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
|
uservice.add(ulog);//将用户的操作记录下来
|
}
|
return SUCCESS;
|
}
|
|
//修改机房电池更改记录
|
public String update() {
|
Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
|
User_inf uinf=(User_inf) getUser();
|
re.setReplaced_uid(uinf.getUId());
|
ServiceModel model=service.update(re);
|
result=tojson(model);
|
{
|
String msg="修改"+re.getStationid()+"机房电池更改记录";
|
User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
|
uservice.add(ulog);//将用户的操作记录下来
|
}
|
return SUCCESS;
|
}
|
//删除机房电池更改记录(多条)
|
public String del() {
|
List<Batt_replace> list=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, new TypeToken<List<Batt_replace>>(){}.getType());
|
ServiceModel model=service.del(list);
|
result=tojson(model);
|
return SUCCESS;
|
}
|
//机房电池更换管理查询
|
public String serchByCondition() {
|
Batt_replace re=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, Batt_replace.class);
|
ServiceModel model=service.serchByCondition(re);
|
result=tojson(model);
|
return SUCCESS;
|
}
|
public String getResult() {
|
return result;
|
}
|
public void setJson(String json) {
|
this.json = json;
|
}
|
|
|
|
}
|