|  |  |  | 
|---|
|  |  |  | package com.doumee.service.system.impl; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
|---|
|  |  |  | import com.doumee.core.constants.Constants; | 
|---|
|  |  |  | import com.doumee.core.exception.BusinessException; | 
|---|
|  |  |  | import com.doumee.dao.dto.PlatformConfigDTO; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemDict; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemMenu; | 
|---|
|  |  |  | import com.doumee.service.system.SystemDictService; | 
|---|
|  |  |  | import com.github.pagehelper.Constant; | 
|---|
|  |  |  | import com.github.pagehelper.PageHelper; | 
|---|
|  |  |  | import com.github.pagehelper.PageInfo; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | 
|---|
|  |  |  | Wrapper<SystemDictData> wrapper = new QueryWrapper<>(systemDictData); | 
|---|
|  |  |  | return systemDictDataMapper.selectCount(wrapper); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public PlatformConfigDTO getPlatformConfigDTO(){ | 
|---|
|  |  |  | PlatformConfigDTO platformConfigDTO = new PlatformConfigDTO(); | 
|---|
|  |  |  | platformConfigDTO.setAutoConfirm("0"); | 
|---|
|  |  |  | platformConfigDTO.setReceiveCancelTime("0"); | 
|---|
|  |  |  | platformConfigDTO.setReceiveCancelTimes("0"); | 
|---|
|  |  |  | platformConfigDTO.setReleaseCancelTimes("0"); | 
|---|
|  |  |  | platformConfigDTO.setReleaseCancelTime("0"); | 
|---|
|  |  |  | platformConfigDTO.setAutoDispatch("0"); | 
|---|
|  |  |  | platformConfigDTO.setAutoDispatchDistance("0"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>() | 
|---|
|  |  |  | .lambda().eq(SystemDictData::getDictId,100) | 
|---|
|  |  |  | .in(SystemDictData::getLabel, Constants.AUTO_DISPATCH | 
|---|
|  |  |  | ,Constants.AUTO_CONFIRM,Constants.AUTO_DISPATCH_DISTANCE,Constants.RELEASE_CANCEL_TIME | 
|---|
|  |  |  | ,Constants.RELEASE_CANCEL_TIMES,Constants.RECEIVE_CANCEL_TIMES,Constants.RECEIVE_CANCEL_TIME) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)){ | 
|---|
|  |  |  | for (SystemDictData systemDictData:systemDictDataList) { | 
|---|
|  |  |  | if(systemDictData.getLabel().equals(Constants.AUTO_DISPATCH)){ | 
|---|
|  |  |  | platformConfigDTO.setAutoDispatch(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.AUTO_CONFIRM)){ | 
|---|
|  |  |  | platformConfigDTO.setAutoConfirm(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.AUTO_DISPATCH_DISTANCE)){ | 
|---|
|  |  |  | platformConfigDTO.setAutoDispatchDistance(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RELEASE_CANCEL_TIME)){ | 
|---|
|  |  |  | platformConfigDTO.setReleaseCancelTime(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RELEASE_CANCEL_TIMES)){ | 
|---|
|  |  |  | platformConfigDTO.setReleaseCancelTimes(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RECEIVE_CANCEL_TIMES)){ | 
|---|
|  |  |  | platformConfigDTO.setReceiveCancelTimes(systemDictData.getCode()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RECEIVE_CANCEL_TIME)){ | 
|---|
|  |  |  | platformConfigDTO.setReceiveCancelTime(systemDictData.getCode()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return platformConfigDTO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | @Transactional(rollbackFor = {Exception.class, BusinessException.class}) | 
|---|
|  |  |  | public void updPlatformConfig(PlatformConfigDTO platformConfigDTO){ | 
|---|
|  |  |  | List<SystemDictData> systemDictDataList = systemDictDataMapper.selectList(new QueryWrapper<SystemDictData>() | 
|---|
|  |  |  | .lambda().eq(SystemDictData::getDictId,100) | 
|---|
|  |  |  | .in(SystemDictData::getLabel, Constants.AUTO_DISPATCH | 
|---|
|  |  |  | ,Constants.AUTO_CONFIRM,Constants.AUTO_DISPATCH_DISTANCE,Constants.RELEASE_CANCEL_TIME | 
|---|
|  |  |  | ,Constants.RELEASE_CANCEL_TIMES,Constants.RECEIVE_CANCEL_TIMES,Constants.RECEIVE_CANCEL_TIME) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(systemDictDataList)){ | 
|---|
|  |  |  | for (SystemDictData systemDictData:systemDictDataList) { | 
|---|
|  |  |  | if(systemDictData.getLabel().equals(Constants.AUTO_DISPATCH)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getAutoDispatch()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.AUTO_CONFIRM)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getAutoConfirm()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.AUTO_DISPATCH_DISTANCE)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getAutoDispatchDistance()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RELEASE_CANCEL_TIME)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getReleaseCancelTime()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RELEASE_CANCEL_TIMES)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getReleaseCancelTimes()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RECEIVE_CANCEL_TIMES)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getReceiveCancelTimes()); | 
|---|
|  |  |  | }else if(systemDictData.getLabel().equals(Constants.RECEIVE_CANCEL_TIME)){ | 
|---|
|  |  |  | systemDictData.setCode(platformConfigDTO.getReceiveCancelTime()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | systemDictDataMapper.update(new UpdateWrapper<SystemDictData>().lambda() | 
|---|
|  |  |  | .set(SystemDictData::getCode,systemDictData.getCode()) | 
|---|
|  |  |  | .eq(SystemDictData::getId,systemDictData.getId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|