| | |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setCreateDate(new Date()); |
| | | model.setStatus(Constants.ZERO); |
| | | model.setDealStatus(Constants.ZERO); |
| | | model.setEditDate(model.getCreateDate()); |
| | | model.setEditor(model.getCreator()); |
| | | ywWorkorderMapper.insert(model); |
| | |
| | | if(StringUtils.isBlank(multifile.getFileurl())){ |
| | | continue; |
| | | } |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setCreateDate(model.getCreateDate()); |
| | | multifile.setEditDate(model.getCreateDate()); |
| | | multifile.setCreator(model.getEditor()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjId(model.getId()); |
| | | multifile.setCreator(model.getCreator()); |
| | | multifile.setEditor(model.getCreator()); |
| | | multifile.setObjType(Constants.MultiFile.YW_WORKORDER_PROBLEM.getKey()); |
| | | multifile.setSortnum(i+1); |
| | | fileList.add(multifile); |
| | |
| | | if(model ==null || Constants.equalsInteger(model.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,工单信息不存在!"); |
| | | } |
| | | if(!Constants.equalsInteger(model.getDealStatus(),Constants.ZERO) && !Constants.equalsInteger(model.getDealStatus(),Constants.ONE)){ |
| | | if(!Constants.equalsInteger(model.getDealStatus(),Constants.ZERO) |
| | | // && !Constants.equalsInteger(model.getDealStatus(),Constants.ONE) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,工单状态已流转,不支持当前操作!"); |
| | | } |
| | | |
| | |
| | | update.setDispatchUserId(update.getEditor()); |
| | | update.setDispatchDate(update.getEditDate()); |
| | | update.setDispatchInfo(ywWorkorder.getDispatchInfo()); |
| | | update.setDealUserId(ywWorkorder.getDealUserId()); |
| | | ywWorkorderMapper.updateById(update); |
| | | dealLogBiz(model,Constants.YwLogType.WORKORDER_DISPATCH,model.getLoginUserInfo().getRealname(),user.getRealname());//记录新建日志 |
| | | dealLogBiz(model,Constants.YwLogType.WORKORDER_DISPATCH,ywWorkorder.getLoginUserInfo().getRealname(),user.getRealname());//记录新建日志 |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,工单状态已流转,不支持当前操作!"); |
| | | } |
| | | |
| | | SystemUser user = systemUserMapper.selectById(ywWorkorder.getDealUserId()); |
| | | if(user ==null || (user.getDeleted()!=null&& user.getDeleted() )){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,员工信息不存在!"); |
| | | } |
| | | // SystemUser user = systemUserMapper.selectById(ywWorkorder.getDealUserId()); |
| | | // if(user ==null || (user.getDeleted()!=null&& user.getDeleted() )){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,员工信息不存在!"); |
| | | // } |
| | | YwWorkorder update = new YwWorkorder(); |
| | | update.setId(model.getId()); |
| | | update.setEditDate(new Date()); |
| | |
| | | update.setDealStatus(Constants.TWO); |
| | | update.setDealUserId(update.getEditor()); |
| | | update.setDealDate(update.getEditDate()); |
| | | update.setDealInfo(ywWorkorder.getDispatchInfo()); |
| | | update.setDealInfo(ywWorkorder.getDealInfo()); |
| | | ywWorkorderMapper.updateById(update); |
| | | dealLogBiz(model,Constants.YwLogType.WORKORDER_DEAL,model.getLoginUserInfo().getRealname(),null);//记录新建日志 |
| | | |
| | | List<Multifile> fileList = new ArrayList<>(); |
| | | if(ywWorkorder.getDealFileList()!=null && ywWorkorder.getDealFileList().size()>0){ |
| | | for (int i = 0; i < ywWorkorder.getDealFileList().size(); i++) { |
| | | Multifile multifile = ywWorkorder.getDealFileList().get(i); |
| | | if(StringUtils.isBlank(multifile.getFileurl())){ |
| | | continue; |
| | | } |
| | | multifile.setCreateDate(update.getEditDate()); |
| | | multifile.setCreator(update.getEditor()); |
| | | multifile.setEditDate(update.getEditDate()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setObjId(model.getId()); |
| | | multifile.setEditor(update.getEditor()); |
| | | multifile.setObjType(Constants.MultiFile.YW_WORKORDER_DEAL.getKey()); |
| | | multifile.setSortnum(i+1); |
| | | fileList.add(multifile); |
| | | } |
| | | } |
| | | if(fileList.size()>0){ |
| | | multifileMapper.insert(fileList); |
| | | } |
| | | dealLogBiz(model,Constants.YwLogType.WORKORDER_DEAL,ywWorkorder.getLoginUserInfo().getRealname(),null);//记录新建日志 |
| | | } |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | |
| | | |
| | | @Override |
| | | public YwWorkorder findById(Integer id) { |
| | | MPJLambdaWrapper<YwWorkorder> wrapper = new MPJLambdaWrapper<>(); |
| | | wrapper.selectAll(YwWorkorder.class ) |
| | | .selectAs(SystemUser::getRealname,YwWorkorder::getDispatchUserName) |
| | | .select("t2.realname",YwWorkorder::getDealUserName) |
| | | MPJLambdaWrapper<YwWorkorder> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.selectAll(YwWorkorder.class ) |
| | | .selectAs(SystemUser::getRealname,YwWorkorder::getDealUserName) |
| | | .selectAs(Company::getName,YwWorkorder::getDealUserCompany) |
| | | .select("t3.realname",YwWorkorder::getCreatorName) |
| | | .selectAs(SystemUser::getMobile,YwWorkorder::getCreatorPhone) |
| | | .selectAs(Company::getCompanyNamePath,YwWorkorder::getCreatorCompany) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDispatchUserId) |
| | | .select("t3.mobile",YwWorkorder::getCreatorMobile) |
| | | .select("t9.name",YwWorkorder::getCreatorCompany) |
| | | .selectAs(Category::getName,YwWorkorder::getCategoryName) |
| | | .selectAs(YwRoom::getName,YwWorkorder::getRoomName) |
| | | .selectAs(YwRoom::getRoomNum,YwWorkorder::getRoomNum) |
| | | .selectAs(YwFloor::getName,YwWorkorder::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwWorkorder::getBuildingName) |
| | | .selectAs(YwProject::getName,YwWorkorder::getProjectName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDealUserId) |
| | | .leftJoin(Category.class,Category::getId,YwWorkorder::getCateId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getCreator) |
| | | .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId) |
| | | .leftJoin(YwRoom.class,YwRoom::getId,YwWorkorder::getRoomId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwWorkorder::getFloorId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwWorkorder::getProjectId) |
| | | .leftJoin(" company t9 on t9.id = t1.company_id ") |
| | | .eq(YwWorkorder::getId,id); |
| | | YwWorkorder model = ywWorkorderMapper.selectJoinOne(YwWorkorder.class,wrapper); |
| | | YwWorkorder model = ywWorkorderMapper.selectJoinOne(YwWorkorder.class,queryWrapper); |
| | | initFiles(model);//读取附件信息 |
| | | YwWorkorderLog log = new YwWorkorderLog(); |
| | | log.setJobId(model.getId()); |
| | |
| | | .selectAs(YwRoom::getRoomNum,YwWorkorder::getRoomNum) |
| | | .selectAs(YwFloor::getName,YwWorkorder::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwWorkorder::getBuildingName) |
| | | .selectAs(YwProject::getName,YwWorkorder::getProjectName) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getDealUserId) |
| | | .leftJoin(Category.class,Category::getId,YwWorkorder::getCateId) |
| | | .leftJoin(SystemUser.class,SystemUser::getId,YwWorkorder::getCreator) |
| | | .leftJoin(YwRoom.class,YwRoom::getId,YwWorkorder::getRoomId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwWorkorder::getFloorId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId); |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwWorkorder::getBuildingId) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwBuilding::getProjectId) |
| | | .apply(StringUtils.isNotBlank(pageWrap.getModel().getQueryStatus())," find_in_set(t.DEAL_STATUS ,'"+pageWrap.getModel().getQueryStatus()+"') "); |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.eq(YwWorkorder::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getDispatchUserId() != null) { |
| | | queryWrapper.eq(YwWorkorder::getDispatchUserId, pageWrap.getModel().getDispatchUserId()); |
| | | } |
| | | if(Objects.nonNull(pageWrap.getModel().getRoomName())){ |
| | | queryWrapper.and(i->i.like(YwFloor::getName,pageWrap.getModel().getRoomName()).or() |
| | | .like(YwRoom::getRoomNum,pageWrap.getModel().getRoomName()) |
| | | ); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.eq(YwWorkorder::getCreator, pageWrap.getModel().getCreator()); |
| | |
| | | queryWrapper.eq(YwWorkorder::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.eq(YwWorkorder::getStatus, pageWrap.getModel().getStatus()); |
| | | queryWrapper.eq(!Constants.equalsInteger(pageWrap.getModel().getStatus(),-1),YwWorkorder::getStatus, pageWrap.getModel().getStatus()); |
| | | queryWrapper.in(Constants.equalsInteger(pageWrap.getModel().getStatus(),-1),YwWorkorder::getStatus, Constants.ZERO,Constants.ONE); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.eq(YwWorkorder::getSortnum, pageWrap.getModel().getSortnum()); |
| | |
| | | if (pageWrap.getModel().getDealStatus() != null) { |
| | | queryWrapper.eq(YwWorkorder::getDealStatus, pageWrap.getModel().getDealStatus()); |
| | | } |
| | | if (pageWrap.getModel().getDispatchUserId() != null) { |
| | | queryWrapper.eq(YwWorkorder::getDispatchUserId, pageWrap.getModel().getDispatchUserId()); |
| | | } |
| | | if (pageWrap.getModel().getDispatchDate() != null) { |
| | | queryWrapper.ge(YwWorkorder::getDispatchDate, Utils.Date.getStart(pageWrap.getModel().getDispatchDate())); |
| | | queryWrapper.le(YwWorkorder::getDispatchDate, Utils.Date.getEnd(pageWrap.getModel().getDispatchDate())); |
| | |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | if(StringUtils.isNotBlank(pageWrap.getModel().getBuildingName())){ |
| | | queryWrapper.and(rw ->{ |
| | | rw.like(YwBuilding::getName,pageWrap.getModel().getBuildingName()).or() |
| | | .like(YwRoom::getName,pageWrap.getModel().getBuildingName()); |
| | | }); |
| | | } |
| | | queryWrapper.ge(Objects.nonNull(pageWrap.getModel().getQueryStartTime()), YwWorkorder::getCreateDate, pageWrap.getModel().getQueryStartTime()) |
| | | .le(Objects.nonNull(pageWrap.getModel().getQueryEndTime()), YwWorkorder::getCreateDate, pageWrap.getModel().getQueryEndTime()); |
| | | queryWrapper.orderByDesc(YwContract::getCreateDate ); |
| | | return PageData.from(ywWorkorderMapper.selectPage(page, queryWrapper)); |
| | | |
| | | PageData<YwWorkorder> result = PageData.from(ywWorkorderMapper.selectPage(page, queryWrapper)); |
| | | if(result!=null && result.getRecords()!=null){ |
| | | for(YwWorkorder m : result.getRecords()){ |
| | | if(Constants.equalsInteger(m.getAreaType(),Constants.ZERO)){ |
| | | //0室内维修 |
| | | m.setAreaNameInfo(StringUtils.defaultString(m.getBuildingName(),"")+"/"+StringUtils.defaultString(m.getRoomNum(),"")); |
| | | }else{ |
| | | m.setAreaNameInfo(StringUtils.defaultString(m.getBuildingName(),"")+"/"+StringUtils.defaultString(m.getFloorName(),"")); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |