| | |
| | | package com.qianwen.smartman.modules.andon.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.google.common.collect.Lists; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | import com.qianwen.smartman.common.cache.RegionCache; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.service.impl.BladeServiceImpl; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.utils.Lambda; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.andon.convert.AndonTypeConvert; |
| | | import com.qianwen.smartman.modules.andon.entity.AndonRecord; |
| | | import com.qianwen.smartman.modules.andon.entity.AndonType; |
| | |
| | | import com.qianwen.smartman.modules.andon.vo.BindingDeviceTypeVO; |
| | | import com.qianwen.smartman.modules.system.service.ICodeGeneratorService; |
| | | import com.qianwen.smartman.modules.tpm.enums.MetaTypeEnum; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/andon/service/impl/AndonTypeServiceImpl.class */ |
| | | public class AndonTypeServiceImpl extends BladeServiceImpl<AndonTypeMapper, AndonType> implements IAndonTypeService { |
| | | private final ICodeGeneratorService codeGeneratorService; |
| | | private final IDeviceAndonTypeService deviceAndonTypeService; |
| | |
| | | this.recordService = recordService; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public AndonTypeVO saveAndonType(AndonTypeSaveVO vo) { |
| | | andonTypeCodeGenerator(vo); |
| | |
| | | return AndonTypeConvert.INSTANCE.convert(type); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean updateAndonType(AndonTypeUpdateVO vo) { |
| | | Long typeId = vo.getId(); |
| | |
| | | saveDeviceTypeBinding(typeId, deviceTypeIds); |
| | | return Boolean.valueOf(update); |
| | | |
| | | /* |
| | | Long typeId = vo.getId(); |
| | | notUpdate(typeId); |
| | | boolean update = ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) ((LambdaUpdateChainWrapper) Lambda.updateWrapper(this.baseMapper).set((v0) -> { |
| | | return v0.getName(); |
| | | }, vo.getName())).set((v0) -> { |
| | | return v0.getRemark(); |
| | | }, vo.getRemark())).eq((v0) -> { |
| | | return v0.getId(); |
| | | }, typeId)).update(); |
| | | List<AndonRecord> list = this.recordService.list((Wrapper) Lambda.eq((v0) -> { |
| | | return v0.getTypeId(); |
| | | }, typeId).in((v0) -> { |
| | | return v0.getCurStatus(); |
| | | }, Lists.newArrayList(new Integer[]{AndonStatusEnum.ALREADY_RECEIVED.getStatus(), AndonStatusEnum.HAVA_INITIATED.getStatus()}))); |
| | | List<Long> deviceTypeIds = vo.getDeviceTypeIds(); |
| | | if (Func.isNotEmpty(list)) { |
| | | List<DeviceAndonType> typeList = this.deviceAndonTypeService.list(Lambda.eq((v0) -> { |
| | | return v0.getAndonTypeId(); |
| | | }, typeId)); |
| | | List<Long> collect = (List) typeList.stream().map((v0) -> { |
| | | return v0.getDeviceTypeId(); |
| | | }).collect(Collectors.toList()); |
| | | boolean sameList = sameList(collect, deviceTypeIds); |
| | | if (sameList) { |
| | | throw new ServiceException(MessageUtils.message("andon.type.device.type.update", new Object[0])); |
| | | } |
| | | } |
| | | boolean update2 = this.deviceAndonTypeService.remove(Lambda.eq((v0) -> { |
| | | return v0.getAndonTypeId(); |
| | | }, typeId)) && update; |
| | | saveDeviceTypeBinding(typeId, deviceTypeIds); |
| | | return Boolean.valueOf(update2); |
| | | */ |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | public Boolean removeAndonType(Long typeId) { |
| | | notRemove(typeId); |
| | | return Boolean.valueOf(removeById(typeId)); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | public List<AndonTypeVO> andonTypeList(String keyword) { |
| | | return this.baseMapper.andonTypeList(keyword); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | public AndonTypeDetailVO detail(Long typeId) { |
| | | return this.baseMapper.detail(typeId); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | public List<BindingDeviceTypeVO> allDeviceTypes(String typeId) { |
| | | return this.baseMapper.allDeviceTypes(typeId); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.andon.service.IAndonTypeService |
| | | @Override |
| | | public List<AndonTypeVO> workBanding(Long workstationId) { |
| | | return this.baseMapper.workBanding(workstationId); |
| | | } |
| | |
| | | if (l1.size() != l2.size()) { |
| | | return true; |
| | | } |
| | | String c1 = (String) l1.stream().sorted((v0, v1) -> { |
| | | String c1 = l1.stream().sorted((v0, v1) -> { |
| | | return v0.compareTo(v1); |
| | | }).map((v0) -> { |
| | | return String.valueOf(v0); |
| | | }).collect(Collectors.joining(",")); |
| | | String c2 = (String) l2.stream().sorted((v0, v1) -> { |
| | | String c2 = l2.stream().sorted((v0, v1) -> { |
| | | return v0.compareTo(v1); |
| | | }).map((v0) -> { |
| | | return String.valueOf(v0); |
| | |
| | | } |
| | | |
| | | private void notRemove(Long typeId) { |
| | | List<AndonRecord> list = this.recordService.list(Lambda.eq((v0) -> { |
| | | return v0.getTypeId(); |
| | | }, typeId)); |
| | | List<AndonRecord> list = this.recordService.list(Lambda.eq(AndonRecord::getTypeId, typeId)); |
| | | if (Func.isNotEmpty(list)) { |
| | | throw new ServiceException(MessageUtils.message("andon.type.has.record", new Object[0])); |
| | | } |
| | |
| | | Lists.newArrayList(AndonStatusEnum.ALREADY_RECEIVED.getStatus(), AndonStatusEnum.HAVA_INITIATED.getStatus()))); |
| | | if (Func.isNotEmpty(list)) |
| | | throw new ServiceException(MessageUtils.message("andon.type.not.update", new Object[0])); |
| | | /* |
| | | List<AndonRecord> list = this.recordService.list((Wrapper) Lambda.eq((v0) -> { |
| | | return v0.getTypeId(); |
| | | }, typeId).in((v0) -> { |
| | | return v0.getCurStatus(); |
| | | }, Lists.newArrayList(new Integer[]{AndonStatusEnum.ALREADY_RECEIVED.getStatus(), AndonStatusEnum.HAVA_INITIATED.getStatus()}))); |
| | | if (Func.isNotEmpty(list)) { |
| | | throw new ServiceException(MessageUtils.message("andon.type.not.update", new Object[0])); |
| | | } |
| | | */ |
| | | |
| | | } |
| | | |
| | | private void saveDeviceTypeBinding(Long andonTypeId, List<Long> deviceTypeIds) { |