| | |
| | | package com.fgkj.services; |
| | | |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | 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.dto.*; |
| | | import com.fgkj.mapper.TestDaoFactory; |
| | | import com.fgkj.mapper.UtilityFactory; |
| | | 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; |
| | | import com.fgkj.mapper.impl.User_infMapper; |
| | | import com.fgkj.mapper.impl.User_task_changeMapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | @Service |
| | | public class User_task_changeService { |
| | | |
| | | private ServiceModel model; |
| | | |
| | | |
| | | private Impl mapper;; |
| | | public User_task_changeService() { |
| | | model=new ServiceModel(); |
| | | dao=BaseDAOFactory.getBaseDAO(BaseDAO.USER_TASK_CHANGE); |
| | | } |
| | | @Resource |
| | | private User_task_changeMapper mapper; |
| | | |
| | | //4.1作业变更申请 |
| | | public ServiceModel add(Object obj) { |
| | | Boolean bl=dao.add(obj); |
| | | public ServiceModel add(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl= null; |
| | | try { |
| | | bl = mapper.add(obj); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | model.setMsg("提交变更申请失败!"); |
| | | return model; |
| | | } |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("提交变更申请成功!"); |
| | |
| | | |
| | | } |
| | | //4.5作业变更查询(审批) |
| | | public ServiceModel update(Object obj) { |
| | | Boolean bl=dao.update(obj); |
| | | public ServiceModel update(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl= null; |
| | | try { |
| | | bl = mapper.update(obj); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | model.setMsg("作业审批失败!"); |
| | | return model; |
| | | } |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("作业审批成功!"); |
| | |
| | | return model; |
| | | } |
| | | //4.5作业变更查询(删除记录) |
| | | public ServiceModel delete(Object obj) { |
| | | Boolean bl=dao.del(obj); |
| | | public ServiceModel delete(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.del(obj); |
| | | if(bl){ |
| | | model.setCode(1); |
| | | model.setMsg("删除记录成功!"); |
| | |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private UtilityFactoryService utilityFactoryService; |
| | | //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); |
| | | } |
| | | public ServiceModel serchByCondition(Task_Batt_Test bmd) { |
| | | ServiceModel model = new ServiceModel(); |
| | | //分页 |
| | | PageBean pageBean = bmd.getPageBean(); |
| | | PageHelper.startPage(pageBean.getPageNum(),pageBean.getPageSize(),true); |
| | | List<Task_Batt_Test> list = mapper.serchByCondition(bmd); //TODO 待测试,数据不足 |
| | | System.out.println("list.size() = " + list.size()); |
| | | if (list != null && list.size() > 0) { |
| | | for (int i = 0; i < list.size(); i++) { |
| | | // System.out.println("list = " + list.get(i)); |
| | | // System.out.println("getUsr_id = " + list.get(i).getUchange().getUsr_id()); |
| | | String Uname = utilityFactoryService.UidsToUnames(list.get(i).getUchange().getUsr_id().toString()); |
| | | list.get(i).getBinf().setStationName2(Uname); |
| | | |
| | | // String Cname = UtilityFactory.UidsToUnames(list.get(i).getUchange().getCopy_uids()); |
| | | // String Cname = userInfMapper.searchUnams(list.get(i).getUchange().getCopy_uids()); |
| | | String Cname = utilityFactoryService.UidsToUnames(list.get(i).getUchange().getCopy_uids()); |
| | | list.get(i).getBinf().setStationName3(Cname); |
| | | |
| | | String Aname = utilityFactoryService.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()); |
| | | String Oname = utilityFactoryService.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()); |
| | | String Nname = utilityFactoryService.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){ |
| | | if (list != null && list.size() > 0) { |
| | | PageInfo<Task_Batt_Test> pageInfo = new PageInfo<>(list); |
| | | model.setCode(1); |
| | | model.setData(list); |
| | | model.setData(pageInfo); |
| | | } |
| | | // System.out.println(model); |
| | | // System.out.println(model); |
| | | 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); |
| | | // } |
| | |
| | | } |
| | | // 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); |
| | | } |
| | | |
| | | } |