| | |
| | | package com.fgkj.services; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import com.fgkj.dto.User_task; |
| | | import com.fgkj.util.*; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.Task_Batt_Test; |
| | | import com.fgkj.mapper.impl.User_task_batt_testMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import com.fgkj.controller.ActionUtil; |
| | | import com.fgkj.mapper.BaseDAO; |
| | | import com.fgkj.mapper.BaseDAOFactory; |
| | | import com.fgkj.mapper.impl.User_task_batt_testImpl; |
| | | import com.fgkj.dto.BattInf; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.Task_Batt_Test; |
| | | import com.fgkj.dto.User_inf; |
| | | import com.fgkj.dto.User_task_batt_test; |
| | | |
| | | import javax.annotation.Resource; |
| | | @Service |
| | | public class User_task_batt_testService { |
| | | |
| | | |
| | | private ServiceModel model; |
| | | |
| | | |
| | | private Impl mapper;; |
| | | @Resource |
| | | private User_task_batt_testMapper mapper;; |
| | | |
| | | public User_task_batt_testService() { |
| | | model=new ServiceModel(); |
| | | dao=BaseDAOFactory.getBaseDAO(BaseDAO.USER_TASK_BATT_TEST); |
| | | } |
| | | public ServiceModel add(Object obj) { |
| | | Boolean bl=dao.add(obj); |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.add(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("添加成功!"); |
| | |
| | | } |
| | | //4.1作业管理(修改执行人) |
| | | public ServiceModel updateTask(Object obj) { |
| | | Boolean bl=((User_task_batt_testImpl)dao).updateTask(obj); |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.updateTask(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("修改成功!"); |
| | |
| | | } |
| | | //4.1作业管理(作业删除) |
| | | public ServiceModel delete(Object obj) { |
| | | Boolean bl=dao.del(obj); |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.del(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("删除成功!"); |
| | |
| | | } |
| | | //4.6作业报表(根据电池组信息以及统计方式查询user_task_batt_test信息) |
| | | public List serchByInfo(Object obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | Task_Batt_Test tbt=(Task_Batt_Test) obj; |
| | | System.out.println(tbt); |
| | | // 总作业数 |
| | | List<Task_Batt_Test> list=dao.serchByInfo(tbt); |
| | | List<Task_Batt_Test> list=mapper.serchByInfo(tbt); |
| | | //System.out.println(list.size()); |
| | | int allTask=list.size(); |
| | | //已完成作业总数 |
| | | tbt.getUtest().setTest_complete(1); |
| | | //System.out.println(tbt.getUtest().getTest_complete()); |
| | | List<Task_Batt_Test> listCompelete = dao.serchByInfo(tbt); |
| | | List<Task_Batt_Test> listCompelete = mapper.serchByInfo(tbt); |
| | | int compeleteTask=listCompelete.size(); |
| | | //及时完成作业数 |
| | | tbt.getUtest().setTest_complete(2); |
| | | //System.out.println(tbt.getUtest().getTest_complete()); |
| | | List<Task_Batt_Test> listRightNow = dao.serchByInfo(tbt); |
| | | List<Task_Batt_Test> listRightNow = mapper.serchByInfo(tbt); |
| | | int rightNowTask=listRightNow.size(); |
| | | // System.out.println(allTask+" "+compeleteTask+" "+rightNowTask); |
| | | // System.out.println(allTask+" "+compeleteTask+" "+uncompeleteTask); |
| | |
| | | // System.out.println(method+":"+perid_Time); |
| | | } |
| | | model = new ServiceModel(); |
| | | |
| | | model.setMsgN(perid_Time); // 时间段 |
| | | //TODO perry |
| | | /*model.setMsgN(perid_Time); // 时间段 |
| | | model.setSum(allTask); //总数 |
| | | Float percentTask=0f; |
| | | if(allTask!=0){ |
| | |
| | | model.setMsg(list.get(i).getBinf().getSignalName());//执行人 |
| | | model.setMsgO(list.get(i).getBinf().getStationName1()); //维护区 |
| | | model.setMsgV(list.get(i).getBinf().getStationName());//机房站点 |
| | | model.setMsgT(list.get(i).getBinf().getBattGroupName());//电池组名称 |
| | | model.setMsgT(list.get(i).getBinf().getBattGroupName());//电池组名称*/ |
| | | listmodel.add(model); |
| | | } |
| | | } else { |
| | |
| | | listmodel.add(model); |
| | | } |
| | | ServiceModel lastModel=new ServiceModel(); |
| | | lastModel.setMsgN("0"); |
| | | List<ServiceModel> last=new ArrayList<ServiceModel>(); |
| | | //TODO perry |
| | | /*lastModel.setMsgN("0"); |
| | | lastModel.setCode(model.getCode()); |
| | | lastModel.setMsg(model.getMsg()); |
| | | lastModel.setLowCA(model.getLowCA()); |
| | |
| | | time=listmodel.get(i).getMsgN(); |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | /*for (ServiceModel s : last) { |
| | | System.out.println(s); |
| | | }*/ |
| | |
| | | return last; |
| | | } |
| | | |
| | | public ServiceModel serchByCondition(Object obj){ |
| | | List list=dao.serchByCondition(obj); |
| | | public ServiceModel serchByCondition(User_task obj){ |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.serchByCondition(obj); |
| | | // for (Object object : list) { |
| | | // System.out.println(object); |
| | | // } |
| | |
| | | return model; |
| | | } |
| | | public ServiceModel searchAll(){ |
| | | List list=dao.searchAll(); |
| | | ServiceModel model = new ServiceModel(); |
| | | List list=mapper.searchAll(); |
| | | // for (Object object : list) { |
| | | // System.out.println(object); |
| | | // } |
| | |
| | | } |
| | | return model; |
| | | } |
| | | public static void main(String[] args) throws ParseException { |
| | | User_task_batt_testService us = new User_task_batt_testService(); |
| | | /*User_task_batt_test u=new User_task_batt_test(); |
| | | u.setNum(10578); |
| | | us.serchByCondition(u); |
| | | //us.searchAll();*/ |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date date1 = sdf.parse("2000-01-01"); |
| | | Date date2 = sdf.parse("2016-11-30"); |
| | | Date date3 = sdf.parse("2000-01-01"); |
| | | Date date4 = sdf.parse("2016-11-30"); |
| | | |
| | | User_task_batt_test utest=new User_task_batt_test(); |
| | | utest.setTask_usr_ids("0"); |
| | | utest.setTest_complete(100);//已完成:1 未完成:0 全部:100 |
| | | utest.setTask_exe_date(date3); |
| | | utest.setTask_exe_date1(date4); |
| | | utest.setNote("1");//1:按月份 2:按季度 3:按年份 |
| | | |
| | | BattInf binf = new BattInf(); |
| | | binf.setStationName(""); |
| | | binf.setStationName1(""); |
| | | binf.setBattGroupName(""); //电池组名 |
| | | binf.setSignalName(""); //执行人 |
| | | binf.setBattGroupId(0); |
| | | binf.setBattGroupName1(""); |
| | | binf.setBattProducer(""); |
| | | binf.setMonCapStd(0f); |
| | | binf.setMonVolStd(0f); |
| | | binf.setBattProductDate(ActionUtil.getSimpDate(date1)); |
| | | binf.setBattProductDate1(ActionUtil.getSimpDate(date2)); |
| | | binf.setBattInUseDate(ActionUtil.getSimpDate(date1)); |
| | | binf.setBattInUseDate1(ActionUtil.getSimpDate(date2)); |
| | | |
| | | User_inf uinf=new User_inf(); |
| | | uinf.setUId(0); |
| | | |
| | | Task_Batt_Test tbt=new Task_Batt_Test(); |
| | | tbt.setBinf(binf); |
| | | tbt.setUtest(utest); |
| | | tbt.setUinf(uinf); |
| | | us.serchByInfo(tbt); |
| | | } |
| | | |
| | | } |
| | | |
| | | |