| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { |
| | |
| | | private IProcessStreamPermissionService processStreamPermissionService; |
| | | @Autowired |
| | | private IProductMixService productMixService; |
| | | @Autowired |
| | | private IProductPermissionService productPermissionService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | } |
| | | } |
| | | //添加用户权限 |
| | | b = productPermissionService.add(stream.getProcessId(), userId,"5"); |
| | | if (!b) { |
| | | ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); |
| | | } |
| | | //添加结构树 |
| | | ProductMix productMix; |
| | | if (stream.getPartsId() != null) { |
| | | productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPartsId()) |
| | | ,stream.getProcessName(),stream.getProcessCode(),"5"); |
| | | if (stream.getPsvId() != null) { |
| | | productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPsvId()) |
| | | ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); |
| | | }else { |
| | | productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getComponentId()) |
| | | ,stream.getProcessName(),stream.getProcessCode(),"5"); |
| | | ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); |
| | | } |
| | | productMixService.save(productMix); |
| | | //添加权限验证 |
| | |
| | | permissionStream.setUserId(userId); |
| | | permissionStream.setBusinessId(stream.getProcessId()); |
| | | permissionStream.setBusinessType("5"); |
| | | return permissionStreamNewService.save(permissionStream); |
| | | return permissionStreamNewService.addPermissionStreamNew(permissionStream); |
| | | } |
| | | |
| | | @Override |
| | |
| | | stream.setComponentId(null); |
| | | stream.setPartsId(null); |
| | | stream.setProcessName(stream.getProcessName().toUpperCase()); |
| | | stream.setProcessCode(null); |
| | | stream.setProcessCode(stream.getProcessCode().toUpperCase()); |
| | | boolean b = super.updateById(stream); |
| | | //同步修改结构树 |
| | | ProductMix productMix = productMixService.getById(Long.parseLong(id)); |
| | | productMix.setName(stream.getProcessName()); |
| | | productMix.setCode(stream.getProcessCode()); |
| | | productMixService.updateById(productMix); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | ProcessInfo processInfo = new ProcessInfo(); |