| | |
| | | package com.fgkj.services; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.fgkj.dto.*; |
| | | import com.fgkj.mapper.TestDaoFactory; |
| | | import com.fgkj.mapper.UtilityFactory; |
| | | import com.fgkj.dto.ServiceModel; |
| | | import com.fgkj.dto.Task_Batt_Test; |
| | | 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 { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private User_task_changeMapper mapper; |
| | | |
| | | //4.1作业变更申请 |
| | | public ServiceModel add(Object obj) { |
| | | public ServiceModel add(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.add(obj); |
| | | 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) { |
| | | public ServiceModel update(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.update(obj); |
| | | 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) { |
| | | public ServiceModel delete(User_task_change obj) { |
| | | ServiceModel model = new ServiceModel(); |
| | | Boolean bl=mapper.del(obj); |
| | | if(bl){ |
| | |
| | | } |
| | | return model; |
| | | } |
| | | |
| | | |
| | | |
| | | @Resource |
| | | private UtilityFactoryService utilityFactoryService; |
| | | //4.5作业变更查询 |
| | | public ServiceModel serchByCondition(Object obj){ |
| | | public ServiceModel serchByCondition(Task_Batt_Test bmd) { |
| | | ServiceModel model = new ServiceModel(); |
| | | List<Task_Batt_Test> list=mapper.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); |
| | | } |
| | | //分页 |
| | | 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; |
| | | } |
| | | |