| | |
| | | specification.setFileUrl(specificationHttpUrl+File.separator+file1Name); |
| | | specification.setExcelUrl(specificationHttpUrl+File.separator+file2Name); |
| | | specification.setCreateTime(date); |
| | | specification.setUploadUser(ActionUtil.getUser().getName()); |
| | | //锁定-负责人才能解锁 |
| | | specification.setLockFlag(1); |
| | | mapper.insert(specification); |
| | |
| | | lockOtherByAppliedProduct(specification); |
| | | //锁定日志 |
| | | TechnicalSpecificationLockLog lockLog = new TechnicalSpecificationLockLog(); |
| | | lockLog.setUserName(ActionUtil.getUser().getName()); |
| | | lockLog.setUserName("系统"); |
| | | lockLog.setTechnicalSpecificationId(specification.getId()); |
| | | lockLog.setReason("系统默认锁定,新版本技术规则书上传"); |
| | | lockLog.setCreateTime(date); |
| | |
| | | } |
| | | |
| | | private void lockOtherByAppliedProduct(TechnicalSpecification specification) { |
| | | //先查询 |
| | | QueryWrapper<TechnicalSpecification> query = Wrappers.query(); |
| | | query.eq("apply_material_code",specification.getApplyMaterialCode()); |
| | | query.eq("apply_custom_code", specification.getApplyCustomCode()); |
| | | query.eq("lock_flag",0); |
| | | query.last(" limit 1"); |
| | | TechnicalSpecification specificationToBeLocked = mapper.selectOne(query); |
| | | if(specificationToBeLocked !=null){ //存在生效的,需要被锁定 |
| | | specificationToBeLocked.setLockFlag(1); |
| | | mapper.updateById(specificationToBeLocked); |
| | | //锁定日志 |
| | | TechnicalSpecificationLockLog lockLog = new TechnicalSpecificationLockLog(); |
| | | lockLog.setUserName("系统"); |
| | | lockLog.setTechnicalSpecificationId(specificationToBeLocked.getId()); |
| | | lockLog.setReason("系统默认锁定,新版本技术规则书上传,旧版本锁定"); |
| | | lockLog.setCreateTime(new Date()); |
| | | lockLog.setStatus(0); |
| | | lockLogService.add(lockLog); |
| | | } |
| | | |
| | | |
| | | UpdateWrapper<TechnicalSpecification> update = Wrappers.update(); |
| | | update.set("lock_flag",1); |
| | | //update.set("lock_reason","系统默认锁定,新版本技术规则书上传,旧版本锁定"); |
| | |
| | | for (TechnicalSpecification t:list) { |
| | | TechnicalSpecification enableTe=getEnableVersion(t); |
| | | if(enableTe!=null){ |
| | | if(enableTe.getOwner()!=t.getOwner()){ |
| | | t.setFlag(0); |
| | | }else{ |
| | | if(enableTe.getOwner().equals(t.getOwner())){ |
| | | t.setFlag(1); |
| | | }else{ |
| | | t.setFlag(0); |
| | | } |
| | | }else { |
| | | t.setFlag(1); |
| | |
| | | wrapper.eq("apply_material_code",t.getApplyMaterialCode()); |
| | | wrapper.eq("apply_model",t.getApplyModel()); |
| | | wrapper.eq("apply_custom_code",t.getApplyCustomCode()); |
| | | wrapper.last("limit1"); |
| | | wrapper.last("limit 1"); |
| | | TechnicalSpecification enableTe=mapper.selectOne(wrapper); |
| | | return enableTe; |
| | | } |
| | |
| | | query.eq("apply_custom_code",applyCustomCode); |
| | | } |
| | | List<TechnicalSpecification> list=mapper.selectList(query); |
| | | //标识每条记录适用机型可用的版本的负责人是不是这条记录的负责人 |
| | | if(list!=null&&list.size()>0){ |
| | | for (TechnicalSpecification t:list) { |
| | | TechnicalSpecification enableTe=getEnableVersion(t); |
| | | if(enableTe!=null){ |
| | | if(enableTe.getOwner().equals(t.getOwner())){ |
| | | t.setFlag(1); |
| | | }else{ |
| | | t.setFlag(0); |
| | | } |
| | | }else { |
| | | t.setFlag(1); |
| | | } |
| | | } |
| | | } |
| | | return new Response().setII(1,list!=null,list,"查询指定技术规格书的所有版本"); |
| | | } |
| | | } |