package com.fgkj.services;
|
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
import java.util.List;
|
|
import com.fgkj.actions.ActionUtil;
|
import com.fgkj.dao.BaseDAO;
|
import com.fgkj.dao.BaseDAOFactory;
|
import com.fgkj.dao.TestDaoFactory;
|
import com.fgkj.dao.UtilityFactory;
|
import com.fgkj.db.DBUtil;
|
import com.fgkj.db.IDatabaseName;
|
import com.fgkj.dto.BattInf;
|
import com.fgkj.dto.Page;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.dto.Task_Batt_Test;
|
import com.fgkj.dto.User_task_change;
|
|
public class User_task_changeService {
|
private ServiceModel model;
|
private BaseDAO dao;
|
public User_task_changeService() {
|
model=new ServiceModel();
|
dao=BaseDAOFactory.getBaseDAO(BaseDAO.USER_TASK_CHANGE);
|
}
|
|
//4.1作业变更申请
|
public ServiceModel add(Object obj) {
|
Boolean bl=dao.add(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("提交变更申请成功!");
|
}
|
else{
|
model.setMsg("提交变更申请失败!");
|
}
|
return model;
|
|
}
|
//4.5作业变更查询(审批)
|
public ServiceModel update(Object obj) {
|
Boolean bl=dao.update(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("作业审批成功!");
|
}
|
else{
|
model.setMsg("作业审批失败!");
|
}
|
return model;
|
}
|
//4.5作业变更查询(删除记录)
|
public ServiceModel delete(Object obj) {
|
Boolean bl=dao.del(obj);
|
if(bl){
|
model.setCode(1);
|
model.setMsg("删除记录成功!");
|
}
|
else{
|
model.setMsg("删除记录失败!");
|
}
|
return model;
|
}
|
//4.5作业变更查询
|
public ServiceModel serchByCondition(Object obj){
|
List<Task_Batt_Test> list=dao.serchByCondition(obj);
|
if(list!=null&&list.size()>0){
|
for(int i=0;i<list.size();i++){
|
|
String Uname=UtilityFactory.UidsToUnames(list.get(i).getUchange().getUsr_id().toString());
|
list.get(i).getBinf().setStationName2(Uname);
|
|
String Cname=UtilityFactory.UidsToUnames(list.get(i).getUchange().getCopy_uids());
|
list.get(i).getBinf().setStationName3(Cname);
|
|
String Aname=UtilityFactory.UidsToUnames(list.get(i).getUchange().getAppoint_uid().toString());
|
list.get(i).getBinf().setStationName4(Aname);
|
// System.out.println(Uname+" "+Cname+" "+Aname);
|
String task_type=TestDaoFactory.getTaskType(list.get(i).getUchange().getTask_type_id());
|
list.get(i).getBinf().setStationName5(task_type);
|
|
String change_type=TestDaoFactory.getChangeType(list.get(i).getUchange().getChange_type_id());
|
list.get(i).getBinf().setStationName6(change_type);
|
|
String Oname=UtilityFactory.UidsToUnames(list.get(i).getUchange().getOld_executor_ids());
|
list.get(i).getBinf().setStationName7(Oname);
|
|
String Nname=UtilityFactory.UidsToUnames(list.get(i).getUchange().getNew_executor_ids());
|
list.get(i).getBinf().setStationName8(Nname);
|
|
String approve_res=TestDaoFactory.getApprove_res(list.get(i).getUchange().getTask_change_approve_res());
|
list.get(i).getBinf().setStationName9(approve_res);
|
}
|
}
|
// for (Task_Batt_Test t : list) {
|
// System.out.println(t.getBinf());
|
// }
|
if(list!=null && list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
}
|
// System.out.println(model);
|
return model;
|
}
|
|
|
public ServiceModel searchAll(){
|
List list=dao.searchAll();
|
// for (Object object : list) {
|
// System.out.println(object);
|
// }
|
//System.out.println(list);
|
if(list!=null && list.size()>0){
|
model.setCode(1);
|
model.setData(list);
|
}
|
// System.out.println(model);
|
return model;
|
}
|
public static void main(String[] args) throws ParseException {
|
User_task_changeService uservice=new User_task_changeService();
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
Date date1 = sdf.parse("2000-01-01");
|
Date date2 = sdf.parse("2020-01-01");
|
|
BattInf binf = new BattInf();
|
binf.setStationName("");
|
binf.setStationName1("");
|
binf.setBattGroupId(0);
|
binf.setBattGroupName1("");
|
binf.setBattProducer("");
|
binf.setMonCapStd(0f);
|
binf.setMonVolStd(0f);
|
|
User_task_change uchange=new User_task_change();
|
uchange.setTask_type_id(100); //作业类型 100:全部
|
uchange.setChange_type_id(100); //作业变更类型
|
uchange.setUsr_id(0); //作业变更申请人
|
uchange.setTask_change_approve_res(100); //变更审批状态
|
uchange.setChange_ask_time(ActionUtil.getSimpDate(date1));
|
uchange.setChange_ask_time1(ActionUtil.getSimpDate(date2));
|
|
Page page=new Page();
|
page.setPageCurr(1);
|
page.setPageSize(10);
|
|
Task_Batt_Test tbt=new Task_Batt_Test();
|
tbt.setBinf(binf);
|
tbt.setUchange(uchange);
|
tbt.setPage(page);
|
|
uservice.serchByCondition(tbt);
|
}
|
}
|