| | |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class ProcessSpecVersionServiceImpl extends ServiceImpl<ProcessSpecVersionMapper, ProcessSpecVersion> implements IProcessSpecVersionService{ |
| | |
| | | private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService; |
| | | @Autowired |
| | | private IProductMixService productMixService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IProductPermissionService productPermissionService; |
| | | /** |
| | | * 根据用户id获取授权的工艺规程版本表信息 |
| | | * @param userId |
| | |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | } |
| | | } |
| | | //添加用户权限 |
| | | b = productPermissionService.add(ProcessSpecVersion.getId(), userId,"4"); |
| | | if (!b) { |
| | | ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); |
| | | } |
| | | //添加结构树 |
| | | ProductMix productMix = new ProductMix(Long.parseLong(ProcessSpecVersion.getId()),Long.parseLong(ProcessSpecVersion.getPartsId()) |
| | | ,ProcessSpecVersion.getProcessSpecVersionName(),ProcessSpecVersion.getProcessSpecVersionCode(),"4"); |
| | | ,ProcessSpecVersion.getProcessSpecVersionName(), |
| | | ProcessSpecVersion.getProcessSpecVersionCode(),4,new Date()); |
| | | productMixService.save(productMix); |
| | | //添加用户权限 |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setBusinessId(ProcessSpecVersion.getId()); |
| | | stream.setBusinessType("4"); |
| | | stream.setUserId(userId); |
| | | return permissionStreamNewService.save(stream); |
| | | return permissionStreamNewService.addPermissionStreamNew(stream); |
| | | } |
| | | |
| | | /** |
| | |
| | | processSpecVersion.setComponentId(null); |
| | | processSpecVersion.setPartsId(null); |
| | | boolean b = super.updateById(processSpecVersion); |
| | | //同步修改结构树 |
| | | ProductMix productMix = productMixService.getById(Long.parseLong(id)); |
| | | productMix.setName(processSpecVersion.getProcessSpecVersionName()); |
| | | productMix.setCode(processSpecVersion.getProcessSpecVersionCode()); |
| | | productMixService.updateById(productMix); |
| | | if(!b) |
| | | return false; |
| | | ProcessSpecVersionPermission permission = processSpecVersionPermissionService.getByPsvIdAndUserId(id, userId); |
| | |
| | | ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); |
| | | List<ProcessStream> processStreams = processStreamService.findBypsvId(id); |
| | | if(processStreams!= null &&!processStreams.isEmpty()) |
| | | ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); |
| | | ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_PROCESS_EXIST); |
| | | boolean b = processSpecVersionPermissionService.deleteByPsvId(processSpecVersion.getId()); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | |
| | | */ |
| | | @Override |
| | | public Result<?> getProcessSpecVersionCount(String processSpecId){ |
| | | List<ProcessStream> list = processStreamService.findBypsvId(processSpecId); |
| | | List<WorkStep> workStepList=workStepService.list(new LambdaQueryWrapper<WorkStep>().eq(WorkStep::getPsvId,processSpecId)); |
| | | return null; |
| | | } |
| | | } |