whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/services/User_task_changeService.java
@@ -1,11 +1,12 @@
package com.fgkj.services;
import com.fgkj.dto.ServiceModel;
import com.fgkj.dto.Task_Batt_Test;
import com.fgkj.dto.User_task_change;
import com.fgkj.dto.*;
import com.fgkj.mapper.TestDaoFactory;
import com.fgkj.mapper.UtilityFactory;
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;
@@ -21,7 +22,14 @@
   //4.1作业变更申请
   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("提交变更申请成功!");
@@ -35,7 +43,14 @@
   //4.5作业变更查询(审批)
   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("作业审批成功!");
@@ -58,135 +73,32 @@
      }
      return model;   
   }
   @Resource
   private UtilityFactoryService utilityFactoryService;
   //4.5作业变更查询
    public ServiceModel serchByCondition(Task_Batt_Test obj) {
    public ServiceModel serchByCondition(Task_Batt_Test bmd) {
      ServiceModel model = new ServiceModel();
      List<Task_Batt_Test> list = mapper.serchByCondition(obj);
      //分页
      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));
/***
 * {
 *   utask=null,
 *   utest=null,
 *   ulist=null,
 *   binf=BattInf{
 *     num=null,
 *     stationId='null',
 *     stationName='山西省-太原市-迎泽区-局机房119-局机房站-1',
 *     stationName1='null',
 *     stationName2='null',
 *     stationName3='null',
 *     stationName4='null',
 *     stationName5='null',
 *     stationName6='null',
 *     stationName7='null',
 *     stationName8='null',
 *     stationName9='null',
 *     stationIp='null',
 *     fbsDeviceId=null,
 *     fbsDeviceIp='null',
 *     fbsDeviceIp_YM='null',
 *     fbsDeviceIp_WG='null',
 *     fbsDeviceIp_old='null',
 *     fbsDeviceIp_YM_old='null',
 *     fbsDeviceIp_WG_old='null',
 *     fbsDeviceName='null',
 *     groupIndexInFBSDevice=null,
 *     battModel='null',
 *     battGroupId=1000001,
 *     battGroupNum=null,
 *     battGroupName='电池组1',
 *     battGroupName1='null',
 *     battGroupName2='null',
 *     battGroupName3='null',
 *     battGroupName4='null',
 *     battGroupName5='null',
 *     battGroupName6='null',
 *     floatVolLevel=null,
 *     offlineVolLevel=null,
 *     battFloatCurrent=null,
 *     deviceId='null',
 *     deviceName='null',
 *     monCount=null,
 *     monCapStd=null,
 *     monResStd=null,
 *     monSerStd=null,
 *     monTmpStd=null,
 *     monVolStd=null,
 *     monVolLowToAvg=null,
 *     monNum=null,
 *     battProducer='null',
 *     battProductDate=null,
 *     battProductDate1=null,
 *     battInUseDate=null,
 *     battInUseDate1=null,
 *     battGuarantDayCount=null,
 *     signalId='null',
 *     cInterFaceId=null,
 *     load_curr=null,
 *     disCurrMax=null,
 *     signalName='null',
 *     startNum=null,
 *     size=null,
 *     station_phone='null',
 *     install_user='null',
 *     station_install=null,
 *     stationId_ex='null',
 *     videoOrImage='null',
 *     vol_grade=null,
 *     manufacturers='null',
 *     assetequipment='null',
 *     deviceclasspath='null',
 *     deviceoperationdepartment='null',
 *     propertyRightUnit='null',
 *     propertyAttribute='null',
 *     factoryNumber='null',
 *     operationTeam='null',
 *     deviceIdentityCode='null',
 *     projectType='null',
 *     batteryApplicationType='null',
 *     singleRatedVoltage=null,
 *     remoteMonitor='null',
 *     batttIndependentPlaced='null',
 *     junChargeVoltageValue=null
 *   },
 *   ucheck=null,
 *   mcheck=null,
 *   uchange=User_task_change[
 *     num=1,
 *     usr_id=1001,
 *     master_id=0,
 *     appoint_uid=1001,
 *     copy_uids=1001,
 *     change_type_id=0,
 *     task_type_id=0,
 *     task_rc_num=10580,
 *     BattgroupId=1000001,
 *     change_reason=有新的任务,
 *     old_executor_ids=1001,
 *     old_task_exe_time=ThuSep0800: 00: 00CST2016,
 *     new_executor_ids=0,
 *     new_task_exe_time=TueSep0600: 00: 00CST2016,
 *     change_ask_time=ThuSep0811: 32: 02CST2016,
 *     change_ask_time1=null,
 *     change_ask_time_limit=ThuSep0811: 32: 02CST2016,
 *     task_change_approve_time=SatOct2217: 13: 55CST2016,
 *     task_change_approve_time1=null,
 *     task_change_approve_res=1,
 *     remark=通过
 *   ],
 *   uinf=null,
 *   pageBean=null
 * }
 */
            String Uname = UtilityFactory.UidsToUnames(list.get(i).getUchange().getUsr_id().toString());//TODO 待完成
//            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 = 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 = UtilityFactory.UidsToUnames(list.get(i).getUchange().getAppoint_uid().toString());
            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());
@@ -195,10 +107,12 @@
            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 = 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 = 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());
@@ -209,8 +123,9 @@
//         System.out.println(t.getBinf());
//      }
      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);
      return model;