From bfcc5e7f2feebde631f1a442abca23bf5f659146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Thu, 7 Aug 2025 09:14:16 +0800 Subject: [PATCH 01/22] =?UTF-8?q?8-7=20=E5=88=A0=E9=99=A4=E4=B8=8Etarget?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E5=90=8C=E6=A0=B7=E7=9A=84ConvertsI?= =?UTF-8?q?mpl=E7=B1=BB=EF=BC=8C=E9=81=BF=E5=85=8D=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dite/znpt/converts/Impl/ConvertsImpl.java | 1351 ----------------- 1 file changed, 1351 deletions(-) delete mode 100644 core/src/main/java/com/dite/znpt/converts/Impl/ConvertsImpl.java diff --git a/core/src/main/java/com/dite/znpt/converts/Impl/ConvertsImpl.java b/core/src/main/java/com/dite/znpt/converts/Impl/ConvertsImpl.java deleted file mode 100644 index 842511e..0000000 --- a/core/src/main/java/com/dite/znpt/converts/Impl/ConvertsImpl.java +++ /dev/null @@ -1,1351 +0,0 @@ -package com.dite.znpt.converts.Impl; - -import com.dite.znpt.converts.Converts; -import com.dite.znpt.domain.entity.AttachInfoEntity; -import com.dite.znpt.domain.entity.AttendanceRecordEntity; -import com.dite.znpt.domain.entity.CertificationEntity; -import com.dite.znpt.domain.entity.CheckSchemeEntity; -import com.dite.znpt.domain.entity.DefectEntity; -import com.dite.znpt.domain.entity.DeptEntity; -import com.dite.znpt.domain.entity.EquipmentEntity; -import com.dite.znpt.domain.entity.EquipmentUseRecordEntity; -import com.dite.znpt.domain.entity.ImageCollectEntity; -import com.dite.znpt.domain.entity.ImageEntity; -import com.dite.znpt.domain.entity.InspectionReportEntity; -import com.dite.znpt.domain.entity.InsuranceCompanyEntity; -import com.dite.znpt.domain.entity.InsuranceInfoEntity; -import com.dite.znpt.domain.entity.InsuranceTypeEntity; -import com.dite.znpt.domain.entity.MaintainSuggestionEntity; -import com.dite.znpt.domain.entity.MenuEntity; -import com.dite.znpt.domain.entity.PartEntity; -import com.dite.znpt.domain.entity.PostEntity; -import com.dite.znpt.domain.entity.ProjectEntity; -import com.dite.znpt.domain.entity.RoleEntity; -import com.dite.znpt.domain.entity.TurbineEntity; -import com.dite.znpt.domain.entity.UserEntity; -import com.dite.znpt.domain.entity.WorkShiftEntity; -import com.dite.znpt.domain.vo.AttachInfoResp; -import com.dite.znpt.domain.vo.AttendanceRecordReq; -import com.dite.znpt.domain.vo.AttendanceRecordResp; -import com.dite.znpt.domain.vo.CertificationReq; -import com.dite.znpt.domain.vo.CertificationResp; -import com.dite.znpt.domain.vo.CheckSchemeReq; -import com.dite.znpt.domain.vo.CheckSchemeResp; -import com.dite.znpt.domain.vo.DefectReq; -import com.dite.znpt.domain.vo.DefectResp; -import com.dite.znpt.domain.vo.DeptReq; -import com.dite.znpt.domain.vo.DeptResp; -import com.dite.znpt.domain.vo.EquipmentReq; -import com.dite.znpt.domain.vo.EquipmentUseRecordReq; -import com.dite.znpt.domain.vo.ImageCollectReq; -import com.dite.znpt.domain.vo.ImageReq; -import com.dite.znpt.domain.vo.ImageSimpleReq; -import com.dite.znpt.domain.vo.InspectionReportCheckInfo; -import com.dite.znpt.domain.vo.InspectionReportReportInfo; -import com.dite.znpt.domain.vo.InspectionReportReq; -import com.dite.znpt.domain.vo.InspectionReportSchemeInfo; -import com.dite.znpt.domain.vo.InsuranceAttachResp; -import com.dite.znpt.domain.vo.InsuranceCompanyReq; -import com.dite.znpt.domain.vo.InsuranceCompanyResp; -import com.dite.znpt.domain.vo.InsuranceInfoReq; -import com.dite.znpt.domain.vo.InsuranceInfoResp; -import com.dite.znpt.domain.vo.InsuranceTypeReq; -import com.dite.znpt.domain.vo.InsuranceTypeResp; -import com.dite.znpt.domain.vo.MaintainSuggestionReq; -import com.dite.znpt.domain.vo.MaintainSuggestionResp; -import com.dite.znpt.domain.vo.MenuReq; -import com.dite.znpt.domain.vo.MenuResp; -import com.dite.znpt.domain.vo.OutWorkDefectReq; -import com.dite.znpt.domain.vo.PartReq; -import com.dite.znpt.domain.vo.PartResp; -import com.dite.znpt.domain.vo.PostReq; -import com.dite.znpt.domain.vo.PostResp; -import com.dite.znpt.domain.vo.ProjectReq; -import com.dite.znpt.domain.vo.ProjectResp; -import com.dite.znpt.domain.vo.RoleReq; -import com.dite.znpt.domain.vo.RoleResp; -import com.dite.znpt.domain.vo.TurbineReq; -import com.dite.znpt.domain.vo.TurbineResp; -import com.dite.znpt.domain.vo.UserListResp; -import com.dite.znpt.domain.vo.UserReq; -import com.dite.znpt.domain.vo.UserResp; -import com.dite.znpt.domain.vo.WorkShiftListResp; -import com.dite.znpt.domain.vo.WorkShiftReq; -import com.dite.znpt.domain.vo.WorkShiftResp; -import java.time.Duration; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import javax.annotation.processing.Generated; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeConstants; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.XMLGregorianCalendar; - -public class ConvertsImpl implements Converts { - - private final DatatypeFactory datatypeFactory; - - public ConvertsImpl() { - try { - datatypeFactory = DatatypeFactory.newInstance(); - } - catch ( DatatypeConfigurationException ex ) { - throw new RuntimeException( ex ); - } - } - - @Override - public List toImageEntity(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( ImageReq imageReq : list ) { - list1.add( imageReqToImageEntity( imageReq ) ); - } - - return list1; - } - - @Override - public List toImageSimpleReq(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( OutWorkDefectReq outWorkDefectReq : list ) { - list1.add( outWorkDefectReqToImageSimpleReq( outWorkDefectReq ) ); - } - - return list1; - } - - @Override - public ImageCollectEntity toImageCollectEntity(ImageCollectReq req) { - if ( req == null ) { - return null; - } - - ImageCollectEntity imageCollectEntity = new ImageCollectEntity(); - - imageCollectEntity.setShootingTimeBegin( req.getShootingTimeBegin() ); - imageCollectEntity.setShootingTimeEnd( req.getShootingTimeEnd() ); - imageCollectEntity.setWeather( req.getWeather() ); - imageCollectEntity.setHumidness( req.getHumidness() ); - imageCollectEntity.setTemperatureMin( req.getTemperatureMin() ); - imageCollectEntity.setTemperatureMax( req.getTemperatureMax() ); - imageCollectEntity.setWindLevel( req.getWindLevel() ); - imageCollectEntity.setShootingMethod( req.getShootingMethod() ); - imageCollectEntity.setShootingDistance( req.getShootingDistance() ); - imageCollectEntity.setCollectorId( req.getCollectorId() ); - imageCollectEntity.setCollectorName( req.getCollectorName() ); - imageCollectEntity.setImageSource( req.getImageSource() ); - - return imageCollectEntity; - } - - @Override - public DefectEntity toDefectEntity(DefectReq req) { - if ( req == null ) { - return null; - } - - DefectEntity defectEntity = new DefectEntity(); - - defectEntity.setDefectCode( req.getDefectCode() ); - defectEntity.setDefectName( req.getDefectName() ); - defectEntity.setDefectPosition( req.getDefectPosition() ); - defectEntity.setDefectType( req.getDefectType() ); - defectEntity.setDefectLevel( req.getDefectLevel() ); - defectEntity.setRepairStatus( req.getRepairStatus() ); - defectEntity.setSource( req.getSource() ); - if ( req.getChordwise() != null ) { - defectEntity.setChordwise( String.valueOf( req.getChordwise() ) ); - } - if ( req.getAxial() != null ) { - defectEntity.setAxial( String.valueOf( req.getAxial() ) ); - } - defectEntity.setLabelInfo( req.getLabelInfo() ); - defectEntity.setDescription( req.getDescription() ); - defectEntity.setRepairIdea( req.getRepairIdea() ); - - return defectEntity; - } - - @Override - public DefectResp toDefectResp(DefectEntity entity) { - if ( entity == null ) { - return null; - } - - DefectResp defectResp = new DefectResp(); - - defectResp.setDefectCode( entity.getDefectCode() ); - defectResp.setDefectName( entity.getDefectName() ); - defectResp.setDefectPosition( entity.getDefectPosition() ); - defectResp.setDefectType( entity.getDefectType() ); - defectResp.setDefectLevel( entity.getDefectLevel() ); - defectResp.setRepairStatus( entity.getRepairStatus() ); - defectResp.setSource( entity.getSource() ); - if ( entity.getChordwise() != null ) { - defectResp.setChordwise( Integer.parseInt( entity.getChordwise() ) ); - } - if ( entity.getAxial() != null ) { - defectResp.setAxial( Integer.parseInt( entity.getAxial() ) ); - } - defectResp.setLabelInfo( entity.getLabelInfo() ); - defectResp.setDescription( entity.getDescription() ); - defectResp.setRepairIdea( entity.getRepairIdea() ); - defectResp.setDefectId( entity.getDefectId() ); - defectResp.setImageId( entity.getImageId() ); - - return defectResp; - } - - @Override - public ProjectResp toProjectResp(ProjectEntity entity) { - if ( entity == null ) { - return null; - } - - ProjectResp projectResp = new ProjectResp(); - - projectResp.setProjectId( entity.getProjectId() ); - projectResp.setProjectName( entity.getProjectName() ); - projectResp.setCoverUrl( entity.getCoverUrl() ); - projectResp.setFarmName( entity.getFarmName() ); - projectResp.setFarmAddress( entity.getFarmAddress() ); - projectResp.setClient( entity.getClient() ); - projectResp.setClientContact( entity.getClientContact() ); - projectResp.setClientPhone( entity.getClientPhone() ); - projectResp.setInspectionUnit( entity.getInspectionUnit() ); - projectResp.setInspectionContact( entity.getInspectionContact() ); - projectResp.setInspectionPhone( entity.getInspectionPhone() ); - projectResp.setScale( entity.getScale() ); - projectResp.setDuration( entity.getDuration() ); - projectResp.setTurbineModel( entity.getTurbineModel() ); - projectResp.setConstructorIds( entity.getConstructorIds() ); - projectResp.setAuditorId( entity.getAuditorId() ); - projectResp.setQualityOfficerId( entity.getQualityOfficerId() ); - projectResp.setProjectManagerId( entity.getProjectManagerId() ); - projectResp.setProjectOrigin( entity.getProjectOrigin() ); - projectResp.setProjectBudget( entity.getProjectBudget() ); - - if ( entity.getStatus() != null ) { - projectResp.setStatus( entity.getStatus() ); - } - projectResp.setStartDate( entity.getStartDate() ); - projectResp.setEndDate( entity.getEndDate() ); - - return projectResp; - } - - @Override - public ProjectEntity toProjectEntity(ProjectReq req) { - if ( req == null ) { - return null; - } - - ProjectEntity projectEntity = new ProjectEntity(); - - projectEntity.setProjectId( req.getProjectId() ); - projectEntity.setProjectName( req.getProjectName() ); - projectEntity.setCoverUrl( req.getCoverUrl() ); - projectEntity.setFarmName( req.getFarmName() ); - projectEntity.setFarmAddress( req.getFarmAddress() ); - projectEntity.setClient( req.getClient() ); - projectEntity.setClientContact( req.getClientContact() ); - projectEntity.setClientPhone( req.getClientPhone() ); - projectEntity.setInspectionUnit( req.getInspectionUnit() ); - projectEntity.setInspectionContact( req.getInspectionContact() ); - projectEntity.setInspectionPhone( req.getInspectionPhone() ); - projectEntity.setScale( req.getScale() ); - projectEntity.setDuration( req.getDuration() ); - projectEntity.setTurbineModel( req.getTurbineModel() ); - projectEntity.setConstructorIds( req.getConstructorIds() ); - projectEntity.setAuditorId( req.getAuditorId() ); - projectEntity.setQualityOfficerId( req.getQualityOfficerId() ); - projectEntity.setProjectManagerId( req.getProjectManagerId() ); - projectEntity.setStatus( req.getStatus() ); - projectEntity.setStartDate( req.getStartDate() ); - projectEntity.setEndDate( req.getEndDate() ); - projectEntity.setProjectOrigin( req.getProjectOrigin() ); - projectEntity.setProjectBudget( req.getProjectBudget() ); - double budget = req.getLaborCost() - + req.getBonusProvision() - + req.getTransAccomMeals() - + req.getOthersCost() - + req.getEquipmentAmortization(); - projectEntity.setProjectBudget((int) budget); - return projectEntity; - } - - @Override - public TurbineEntity toTurbineEntity(TurbineReq req) { - if ( req == null ) { - return null; - } - - TurbineEntity turbineEntity = new TurbineEntity(); - - turbineEntity.setProjectId( req.getProjectId() ); - turbineEntity.setTurbineName( req.getTurbineName() ); - turbineEntity.setTurbineCode( req.getTurbineCode() ); - turbineEntity.setTurbineDesc( req.getTurbineDesc() ); - turbineEntity.setTurbineManufacturer( req.getTurbineManufacturer() ); - turbineEntity.setTurbineModel( req.getTurbineModel() ); - turbineEntity.setTurbineCoverUrl( req.getTurbineCoverUrl() ); - - return turbineEntity; - } - - @Override - public TurbineResp toTurbineResp(TurbineEntity entity) { - if ( entity == null ) { - return null; - } - - TurbineResp turbineResp = new TurbineResp(); - - turbineResp.setTurbineId( entity.getTurbineId() ); - turbineResp.setProjectId( entity.getProjectId() ); - turbineResp.setTurbineName( entity.getTurbineName() ); - turbineResp.setTurbineCode( entity.getTurbineCode() ); - turbineResp.setTurbineDesc( entity.getTurbineDesc() ); - turbineResp.setTurbineManufacturer( entity.getTurbineManufacturer() ); - turbineResp.setTurbineModel( entity.getTurbineModel() ); - turbineResp.setTurbineCoverUrl( entity.getTurbineCoverUrl() ); - - return turbineResp; - } - - @Override - public PartEntity toPartEntity(PartReq req) { - if ( req == null ) { - return null; - } - - PartEntity partEntity = new PartEntity(); - - partEntity.setTurbineId( req.getTurbineId() ); - partEntity.setPartName( req.getPartName() ); - partEntity.setPartCode( req.getPartCode() ); - partEntity.setPartType( req.getPartType() ); - partEntity.setPartDesc( req.getPartDesc() ); - partEntity.setPartManufacturer( req.getPartManufacturer() ); - partEntity.setPartModel( req.getPartModel() ); - - return partEntity; - } - - @Override - public PartResp toPartResp(PartEntity entity) { - if ( entity == null ) { - return null; - } - - PartResp partResp = new PartResp(); - - partResp.setPartId( entity.getPartId() ); - partResp.setTurbineId( entity.getTurbineId() ); - partResp.setPartName( entity.getPartName() ); - partResp.setPartCode( entity.getPartCode() ); - partResp.setPartType( entity.getPartType() ); - partResp.setPartDesc( entity.getPartDesc() ); - partResp.setPartManufacturer( entity.getPartManufacturer() ); - partResp.setPartModel( entity.getPartModel() ); - - return partResp; - } - - @Override - public UserResp toUserResp(UserEntity entity) { - if ( entity == null ) { - return null; - } - - UserResp userResp = new UserResp(); - - userResp.setAccount( entity.getAccount() ); - userResp.setAvatar( entity.getAvatar() ); - userResp.setStatus( entity.getStatus() ); - userResp.setName( entity.getName() ); - userResp.setUserType( entity.getUserType() ); - userResp.setUserStatus( entity.getUserStatus() ); - userResp.setDeptId( entity.getDeptId() ); - userResp.setIdentityCard( entity.getIdentityCard() ); - userResp.setGender( entity.getGender() ); - userResp.setMobile( entity.getMobile() ); - userResp.setEmail( entity.getEmail() ); - userResp.setHiredate( entity.getHiredate() ); - userResp.setBirthdate( entity.getBirthdate() ); - userResp.setEducation( entity.getEducation() ); - userResp.setMajorField( entity.getMajorField() ); - userResp.setWorkField( entity.getWorkField() ); - userResp.setUserId( entity.getUserId() ); - - return userResp; - } - - @Override - public UserListResp toUserListResp(UserEntity entity) { - if ( entity == null ) { - return null; - } - - UserListResp userListResp = new UserListResp(); - - userListResp.setUserId( entity.getUserId() ); - userListResp.setAccount( entity.getAccount() ); - userListResp.setStatus( entity.getStatus() ); - userListResp.setName( entity.getName() ); - userListResp.setUserCode( entity.getUserCode() ); - userListResp.setUserType( entity.getUserType() ); - userListResp.setUserStatus( entity.getUserStatus() ); - userListResp.setMobile( entity.getMobile() ); - userListResp.setCreateTime( entity.getCreateTime() ); - - return userListResp; - } - - @Override - public UserEntity toUserEntity(UserReq req) { - if ( req == null ) { - return null; - } - - UserEntity userEntity = new UserEntity(); - - userEntity.setAccount( req.getAccount() ); - userEntity.setAvatar( req.getAvatar() ); - userEntity.setStatus( req.getStatus() ); - userEntity.setName( req.getName() ); - userEntity.setUserType( req.getUserType() ); - userEntity.setUserStatus( req.getUserStatus() ); - userEntity.setDeptId( req.getDeptId() ); - userEntity.setIdentityCard( req.getIdentityCard() ); - userEntity.setGender( req.getGender() ); - userEntity.setMobile( req.getMobile() ); - userEntity.setEmail( req.getEmail() ); - userEntity.setHiredate( req.getHiredate() ); - userEntity.setBirthdate( req.getBirthdate() ); - userEntity.setEducation( req.getEducation() ); - userEntity.setMajorField( req.getMajorField() ); - userEntity.setWorkField( req.getWorkField() ); - - return userEntity; - } - - @Override - public DeptEntity toDeptEntity(DeptReq req) { - if ( req == null ) { - return null; - } - - DeptEntity deptEntity = new DeptEntity(); - - deptEntity.setParentId( req.getParentId() ); - deptEntity.setDeptName( req.getDeptName() ); - deptEntity.setOrderNum( req.getOrderNum() ); - deptEntity.setLeaderId( req.getLeaderId() ); - deptEntity.setStatus( req.getStatus() ); - - return deptEntity; - } - - @Override - public DeptResp toDeptResp(DeptEntity entity) { - if ( entity == null ) { - return null; - } - - DeptResp deptResp = new DeptResp(); - - deptResp.setDeptId( entity.getDeptId() ); - deptResp.setDeptName( entity.getDeptName() ); - deptResp.setParentId( entity.getParentId() ); - deptResp.setOrderNum( entity.getOrderNum() ); - deptResp.setLeaderId( entity.getLeaderId() ); - if ( entity.getStatus() != null ) { - deptResp.setStatus( String.valueOf( entity.getStatus() ) ); - } - - return deptResp; - } - - @Override - public PostEntity toPostEntity(PostReq req) { - if ( req == null ) { - return null; - } - - PostEntity postEntity = new PostEntity(); - - postEntity.setPostName( req.getPostName() ); - postEntity.setPostSort( req.getPostSort() ); - postEntity.setStatus( req.getStatus() ); - postEntity.setRemark( req.getRemark() ); - postEntity.setStatement( req.getStatement() ); - postEntity.setResponsibilitiesTask( req.getResponsibilitiesTask() ); - postEntity.setQualifications( req.getQualifications() ); - postEntity.setWorkingConditions( req.getWorkingConditions() ); - postEntity.setSalary( req.getSalary() ); - - return postEntity; - } - - @Override - public List toPostResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( PostEntity postEntity : list ) { - list1.add( toPostResp( postEntity ) ); - } - - return list1; - } - - @Override - public PostResp toPostResp(PostEntity entity) { - if ( entity == null ) { - return null; - } - - PostResp postResp = new PostResp(); - - postResp.setPostId( entity.getPostId() ); - postResp.setPostName( entity.getPostName() ); - postResp.setPostSort( entity.getPostSort() ); - postResp.setCreateTime( entity.getCreateTime() ); - postResp.setUpdateTime( entity.getUpdateTime() ); - postResp.setStatement( entity.getStatement() ); - postResp.setResponsibilitiesTask( entity.getResponsibilitiesTask() ); - postResp.setQualifications( entity.getQualifications() ); - postResp.setWorkingConditions( entity.getWorkingConditions() ); - postResp.setSalary( entity.getSalary() ); - - if ( entity.getStatus() != null ) { - postResp.setStatus( String.valueOf( entity.getStatus() ) ); - } - postResp.setRemark( entity.getRemark() ); - - return postResp; - } - - @Override - public RoleResp toRoleResp(RoleEntity entity) { - if ( entity == null ) { - return null; - } - - RoleResp roleResp = new RoleResp(); - - roleResp.setRoleId( entity.getRoleId() ); - roleResp.setRoleName( entity.getRoleName() ); - roleResp.setRoleCode( entity.getRoleCode() ); - roleResp.setRoleKey( entity.getRoleKey() ); - if ( entity.getStatus() != null ) { - roleResp.setStatus( String.valueOf( entity.getStatus() ) ); - } - roleResp.setRemark( entity.getRemark() ); - - return roleResp; - } - - @Override - public List toRoleResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( RoleEntity roleEntity : list ) { - list1.add( toRoleResp( roleEntity ) ); - } - - return list1; - } - - @Override - public List toUserResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( UserEntity userEntity : list ) { - list1.add( toUserResp( userEntity ) ); - } - - return list1; - } - - @Override - public RoleEntity toRoleEntity(RoleReq req) { - if ( req == null ) { - return null; - } - - RoleEntity roleEntity = new RoleEntity(); - - roleEntity.setRoleName( req.getRoleName() ); - roleEntity.setRoleCode( req.getRoleCode() ); - roleEntity.setRoleKey( req.getRoleKey() ); - roleEntity.setStatus( req.getStatus() ); - roleEntity.setRemark( req.getRemark() ); - - return roleEntity; - } - - @Override - public MenuEntity toMenuEntity(MenuReq req) { - if ( req == null ) { - return null; - } - - MenuEntity menuEntity = new MenuEntity(); - - menuEntity.setMenuName( req.getMenuName() ); - menuEntity.setParentId( req.getParentId() ); - menuEntity.setOrderNum( req.getOrderNum() ); - menuEntity.setComponent( req.getComponent() ); - menuEntity.setPath( req.getPath() ); - menuEntity.setMenuType( req.getMenuType() ); - menuEntity.setVisible( req.getVisible() ); - menuEntity.setPerms( req.getPerms() ); - menuEntity.setTerminalType( req.getTerminalType() ); - - return menuEntity; - } - - @Override - public MenuResp toMenuResp(MenuEntity entity) { - if ( entity == null ) { - return null; - } - - MenuResp menuResp = new MenuResp(); - - menuResp.setMenuId( entity.getMenuId() ); - menuResp.setMenuName( entity.getMenuName() ); - menuResp.setParentId( entity.getParentId() ); - if ( entity.getOrderNum() != null ) { - menuResp.setOrderNum( String.valueOf( entity.getOrderNum() ) ); - } - menuResp.setPath( entity.getPath() ); - menuResp.setComponent( entity.getComponent() ); - menuResp.setMenuType( entity.getMenuType() ); - menuResp.setVisible( entity.getVisible() ); - menuResp.setPerms( entity.getPerms() ); - - return menuResp; - } - - @Override - public CertificationEntity toCertificationEntity(CertificationReq req) { - if ( req == null ) { - return null; - } - - CertificationEntity certificationEntity = new CertificationEntity(); - - certificationEntity.setUserId( req.getUserId() ); - certificationEntity.setCertificationCode( req.getCertificationCode() ); - certificationEntity.setCertificationName( req.getCertificationName() ); - certificationEntity.setCertificationType( req.getCertificationType() ); - certificationEntity.setValidityDateBegin( req.getValidityDateBegin() ); - certificationEntity.setValidityDateEnd( req.getValidityDateEnd() ); - certificationEntity.setCertificationImage( req.getCertificationImage() ); - - return certificationEntity; - } - - @Override - public CertificationResp toCertificationResp(CertificationEntity entity) { - if ( entity == null ) { - return null; - } - - CertificationResp certificationResp = new CertificationResp(); - - certificationResp.setCertificationId( entity.getCertificationId() ); - certificationResp.setUserId( entity.getUserId() ); - certificationResp.setCertificationCode( entity.getCertificationCode() ); - certificationResp.setCertificationName( entity.getCertificationName() ); - certificationResp.setCertificationType( entity.getCertificationType() ); - certificationResp.setValidityDateBegin( entity.getValidityDateBegin() ); - certificationResp.setValidityDateEnd( entity.getValidityDateEnd() ); - certificationResp.setCertificationImage( entity.getCertificationImage() ); - - return certificationResp; - } - - @Override - public List toCertificationResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( CertificationEntity certificationEntity : list ) { - list1.add( toCertificationResp( certificationEntity ) ); - } - - return list1; - } - - @Override - public List toInsuranceTypeResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( InsuranceTypeEntity insuranceTypeEntity : list ) { - list1.add( toInsuranceTypeResp( insuranceTypeEntity ) ); - } - - return list1; - } - - @Override - public InsuranceTypeResp toInsuranceTypeResp(InsuranceTypeEntity entity) { - if ( entity == null ) { - return null; - } - - InsuranceTypeResp insuranceTypeResp = new InsuranceTypeResp(); - - insuranceTypeResp.setInsuranceTypeId( entity.getInsuranceTypeId() ); - insuranceTypeResp.setInsuranceTypeName( entity.getInsuranceTypeName() ); - insuranceTypeResp.setDescription( entity.getDescription() ); - - return insuranceTypeResp; - } - - @Override - public InsuranceTypeEntity toInsuranceTypeEntity(InsuranceTypeReq req) { - if ( req == null ) { - return null; - } - - InsuranceTypeEntity insuranceTypeEntity = new InsuranceTypeEntity(); - - insuranceTypeEntity.setInsuranceTypeName( req.getInsuranceTypeName() ); - insuranceTypeEntity.setDescription( req.getDescription() ); - - return insuranceTypeEntity; - } - - @Override - public List toInsuranceCompanyResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( InsuranceCompanyEntity insuranceCompanyEntity : list ) { - list1.add( toInsuranceCompanyResp( insuranceCompanyEntity ) ); - } - - return list1; - } - - @Override - public InsuranceCompanyResp toInsuranceCompanyResp(InsuranceCompanyEntity entity) { - if ( entity == null ) { - return null; - } - - InsuranceCompanyResp insuranceCompanyResp = new InsuranceCompanyResp(); - - insuranceCompanyResp.setInsuranceCompanyId( entity.getInsuranceCompanyId() ); - insuranceCompanyResp.setInsuranceCompanyName( entity.getInsuranceCompanyName() ); - insuranceCompanyResp.setContact( entity.getContact() ); - insuranceCompanyResp.setContactPhone( entity.getContactPhone() ); - insuranceCompanyResp.setStatus( entity.getStatus() ); - - return insuranceCompanyResp; - } - - @Override - public InsuranceCompanyEntity toInsuranceCompanyEntity(InsuranceCompanyReq req) { - if ( req == null ) { - return null; - } - - InsuranceCompanyEntity insuranceCompanyEntity = new InsuranceCompanyEntity(); - - insuranceCompanyEntity.setInsuranceCompanyName( req.getInsuranceCompanyName() ); - insuranceCompanyEntity.setContact( req.getContact() ); - insuranceCompanyEntity.setContactPhone( req.getContactPhone() ); - insuranceCompanyEntity.setStatus( req.getStatus() ); - - return insuranceCompanyEntity; - } - - @Override - public List toInsuranceInfoResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( InsuranceInfoEntity insuranceInfoEntity : list ) { - list1.add( toInsuranceInfoResp( insuranceInfoEntity ) ); - } - - return list1; - } - - @Override - public List toInsuranceAttachResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( InsuranceInfoEntity insuranceInfoEntity : list ) { - list1.add( insuranceInfoEntityToInsuranceAttachResp( insuranceInfoEntity ) ); - } - - return list1; - } - - @Override - public InsuranceInfoResp toInsuranceInfoResp(InsuranceInfoEntity entity) { - if ( entity == null ) { - return null; - } - - InsuranceInfoResp insuranceInfoResp = new InsuranceInfoResp(); - - insuranceInfoResp.setInsuranceInfoId( entity.getInsuranceInfoId() ); - insuranceInfoResp.setUserId( entity.getUserId() ); - insuranceInfoResp.setName( entity.getName() ); - insuranceInfoResp.setUserCode( entity.getUserCode() ); - insuranceInfoResp.setInsuranceTypeId( entity.getInsuranceTypeId() ); - insuranceInfoResp.setInsuranceTypeName( entity.getInsuranceTypeName() ); - insuranceInfoResp.setInsuranceCompanyId( entity.getInsuranceCompanyId() ); - insuranceInfoResp.setInsuranceCompanyName( entity.getInsuranceCompanyName() ); - insuranceInfoResp.setInsuranceBillCode( entity.getInsuranceBillCode() ); - insuranceInfoResp.setAttachInfoId( entity.getAttachInfoId() ); - insuranceInfoResp.setEffectiveDate( entity.getEffectiveDate() ); - insuranceInfoResp.setExpireDate( entity.getExpireDate() ); - insuranceInfoResp.setInsuranceAmount( entity.getInsuranceAmount() ); - insuranceInfoResp.setInsurancePremium( entity.getInsurancePremium() ); - - return insuranceInfoResp; - } - - @Override - public InsuranceInfoEntity toInsuranceInfoEntity(InsuranceInfoReq req) { - if ( req == null ) { - return null; - } - - InsuranceInfoEntity insuranceInfoEntity = new InsuranceInfoEntity(); - - insuranceInfoEntity.setUserId( req.getUserId() ); - insuranceInfoEntity.setInsuranceCompanyId( req.getInsuranceCompanyId() ); - insuranceInfoEntity.setInsuranceTypeId( req.getInsuranceTypeId() ); - insuranceInfoEntity.setInsuranceBillCode( req.getInsuranceBillCode() ); - insuranceInfoEntity.setAttachInfoId( req.getAttachInfoId() ); - insuranceInfoEntity.setEffectiveDate( req.getEffectiveDate() ); - insuranceInfoEntity.setExpireDate( req.getExpireDate() ); - insuranceInfoEntity.setInsurancePremium( req.getInsurancePremium() ); - insuranceInfoEntity.setInsuranceAmount( req.getInsuranceAmount() ); - insuranceInfoEntity.setRemark( req.getRemark() ); - - return insuranceInfoEntity; - } - - @Override - public AttachInfoResp toAttacheInfoResp(AttachInfoEntity entity) { - if ( entity == null ) { - return null; - } - - AttachInfoResp attachInfoResp = new AttachInfoResp(); - - attachInfoResp.setAttachId( entity.getAttachId() ); - attachInfoResp.setBusinessId( entity.getBusinessId() ); - attachInfoResp.setAttachPath( entity.getAttachPath() ); - attachInfoResp.setFileType( entity.getFileType() ); - attachInfoResp.setRemark( entity.getRemark() ); - attachInfoResp.setCreateTime( entity.getCreateTime() ); - - return attachInfoResp; - } - - @Override - public List toWorkShiftListResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( WorkShiftEntity workShiftEntity : list ) { - list1.add( workShiftEntityToWorkShiftListResp( workShiftEntity ) ); - } - - return list1; - } - - @Override - public WorkShiftResp toWorkShiftResp(WorkShiftEntity entity) { - if ( entity == null ) { - return null; - } - - WorkShiftResp workShiftResp = new WorkShiftResp(); - - workShiftResp.setWorkShiftId( entity.getWorkShiftId() ); - workShiftResp.setWorkShiftName( entity.getWorkShiftName() ); - workShiftResp.setWorkTimeStart( entity.getWorkTimeStart() ); - workShiftResp.setLateTimeOffset( entity.getLateTimeOffset() ); - workShiftResp.setLateTimeLimit( entity.getLateTimeLimit() ); - workShiftResp.setWorkTimeEnd( entity.getWorkTimeEnd() ); - workShiftResp.setEarlyTimeOffset( entity.getEarlyTimeOffset() ); - workShiftResp.setEarlyTimeLimit( entity.getEarlyTimeLimit() ); - workShiftResp.setRestTimeStart( entity.getRestTimeStart() ); - workShiftResp.setRestTimeEnd( entity.getRestTimeEnd() ); - workShiftResp.setWorkTime( entity.getWorkTime() ); - workShiftResp.setStatus( entity.getStatus() ); - - return workShiftResp; - } - - @Override - public WorkShiftEntity toWorkShiftEntity(WorkShiftReq req) { - if ( req == null ) { - return null; - } - - WorkShiftEntity workShiftEntity = new WorkShiftEntity(); - - workShiftEntity.setWorkShiftName( req.getWorkShiftName() ); - workShiftEntity.setWorkTimeStart( req.getWorkTimeStart() ); - workShiftEntity.setLateTimeOffset( req.getLateTimeOffset() ); - workShiftEntity.setLateTimeLimit( req.getLateTimeLimit() ); - workShiftEntity.setWorkTimeEnd( req.getWorkTimeEnd() ); - workShiftEntity.setEarlyTimeOffset( req.getEarlyTimeOffset() ); - workShiftEntity.setEarlyTimeLimit( req.getEarlyTimeLimit() ); - workShiftEntity.setRestTimeStart( req.getRestTimeStart() ); - workShiftEntity.setRestTimeEnd( req.getRestTimeEnd() ); - - return workShiftEntity; - } - - @Override - public List toMaintainSuggestionResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( MaintainSuggestionEntity maintainSuggestionEntity : list ) { - list1.add( toMaintainSuggestionResp( maintainSuggestionEntity ) ); - } - - return list1; - } - - @Override - public MaintainSuggestionResp toMaintainSuggestionResp(MaintainSuggestionEntity entity) { - if ( entity == null ) { - return null; - } - - MaintainSuggestionResp maintainSuggestionResp = new MaintainSuggestionResp(); - - maintainSuggestionResp.setSuggestionId( entity.getSuggestionId() ); - maintainSuggestionResp.setSuggestionContent( entity.getSuggestionContent() ); - maintainSuggestionResp.setDefectType( entity.getDefectType() ); - maintainSuggestionResp.setDefectLevel( entity.getDefectLevel() ); - - return maintainSuggestionResp; - } - - @Override - public MaintainSuggestionEntity toMaintainSuggestionEntity(MaintainSuggestionReq req) { - if ( req == null ) { - return null; - } - - MaintainSuggestionEntity maintainSuggestionEntity = new MaintainSuggestionEntity(); - - maintainSuggestionEntity.setSuggestionContent( req.getSuggestionContent() ); - maintainSuggestionEntity.setDefectLevel( req.getDefectLevel() ); - maintainSuggestionEntity.setDefectType( req.getDefectType() ); - - return maintainSuggestionEntity; - } - - @Override - public List toCheckSchemeResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( CheckSchemeEntity checkSchemeEntity : list ) { - list1.add( toCheckSchemeResp( checkSchemeEntity ) ); - } - - return list1; - } - - @Override - public CheckSchemeResp toCheckSchemeResp(CheckSchemeEntity entity) { - if ( entity == null ) { - return null; - } - - CheckSchemeResp checkSchemeResp = new CheckSchemeResp(); - - checkSchemeResp.setSchemeId( entity.getSchemeId() ); - checkSchemeResp.setWorkContent( entity.getWorkContent() ); - checkSchemeResp.setStaffConfig( entity.getStaffConfig() ); - checkSchemeResp.setDeviceConfig( entity.getDeviceConfig() ); - checkSchemeResp.setConstructionScheme( entity.getConstructionScheme() ); - checkSchemeResp.setCheckMethod( entity.getCheckMethod() ); - checkSchemeResp.setRemark( entity.getRemark() ); - - return checkSchemeResp; - } - - @Override - public CheckSchemeEntity toCheckSchemeEntity(CheckSchemeReq req) { - if ( req == null ) { - return null; - } - - CheckSchemeEntity checkSchemeEntity = new CheckSchemeEntity(); - - checkSchemeEntity.setWorkContent( req.getWorkContent() ); - checkSchemeEntity.setStaffConfig( req.getStaffConfig() ); - checkSchemeEntity.setDeviceConfig( req.getDeviceConfig() ); - checkSchemeEntity.setConstructionScheme( req.getConstructionScheme() ); - checkSchemeEntity.setCheckMethod( req.getCheckMethod() ); - checkSchemeEntity.setRemark( req.getRemark() ); - - return checkSchemeEntity; - } - - @Override - public InspectionReportEntity toInspectionReportEntity(InspectionReportReq req) { - if ( req == null ) { - return null; - } - - InspectionReportEntity inspectionReportEntity = new InspectionReportEntity(); - - inspectionReportEntity.setTitle( req.getTitle() ); - inspectionReportEntity.setSubTitle( req.getSubTitle() ); - inspectionReportEntity.setCoverImage( req.getCoverImage() ); - inspectionReportEntity.setProjectId( req.getProjectId() ); - inspectionReportEntity.setTurbineId( req.getTurbineId() ); - inspectionReportEntity.setCheckDate( req.getCheckDate() ); - inspectionReportEntity.setCheckContent( req.getCheckContent() ); - inspectionReportEntity.setCheckMethod( req.getCheckMethod() ); - inspectionReportEntity.setCheckUserId( req.getCheckUserId() ); - inspectionReportEntity.setReportWriter( req.getReportWriter() ); - inspectionReportEntity.setReportWriteTime( xmlGregorianCalendarToLocalDateTime( localDateToXmlGregorianCalendar( req.getReportWriteTime() ) ) ); - inspectionReportEntity.setReportReviewer( req.getReportReviewer() ); - inspectionReportEntity.setReportReviewTime( xmlGregorianCalendarToLocalDateTime( localDateToXmlGregorianCalendar( req.getReportReviewTime() ) ) ); - inspectionReportEntity.setReportAuditor( req.getReportAuditor() ); - inspectionReportEntity.setReportAuditTime( xmlGregorianCalendarToLocalDateTime( localDateToXmlGregorianCalendar( req.getReportAuditTime() ) ) ); - inspectionReportEntity.setReportStatus( req.getReportStatus() ); - - return inspectionReportEntity; - } - - @Override - public InspectionReportCheckInfo toInspectionReportCheckInfo(InspectionReportEntity entity) { - if ( entity == null ) { - return null; - } - - InspectionReportCheckInfo inspectionReportCheckInfo = new InspectionReportCheckInfo(); - - inspectionReportCheckInfo.setCheckDate( entity.getCheckDate() ); - inspectionReportCheckInfo.setCheckContent( entity.getCheckContent() ); - inspectionReportCheckInfo.setCheckMethod( entity.getCheckMethod() ); - inspectionReportCheckInfo.setCheckUserId( entity.getCheckUserId() ); - - return inspectionReportCheckInfo; - } - - @Override - public InspectionReportReportInfo toInspectionReportReportInfo(InspectionReportEntity entity) { - if ( entity == null ) { - return null; - } - - InspectionReportReportInfo inspectionReportReportInfo = new InspectionReportReportInfo(); - - inspectionReportReportInfo.setReportId( entity.getReportId() ); - inspectionReportReportInfo.setTitle( entity.getTitle() ); - inspectionReportReportInfo.setSubTitle( entity.getSubTitle() ); - inspectionReportReportInfo.setCoverImage( entity.getCoverImage() ); - inspectionReportReportInfo.setReportWriter( entity.getReportWriter() ); - inspectionReportReportInfo.setReportWriteTime( entity.getReportWriteTime() ); - inspectionReportReportInfo.setReportReviewer( entity.getReportReviewer() ); - inspectionReportReportInfo.setReportReviewTime( entity.getReportReviewTime() ); - inspectionReportReportInfo.setReportAuditor( entity.getReportAuditor() ); - inspectionReportReportInfo.setReportAuditTime( entity.getReportAuditTime() ); - - return inspectionReportReportInfo; - } - - @Override - public List toInspectionReportSchemeInfo(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( CheckSchemeEntity checkSchemeEntity : list ) { - list1.add( checkSchemeEntityToInspectionReportSchemeInfo( checkSchemeEntity ) ); - } - - return list1; - } - - @Override - public AttendanceRecordEntity toAttendanceRecordEntity(AttendanceRecordReq req) { - if ( req == null ) { - return null; - } - - AttendanceRecordEntity attendanceRecordEntity = new AttendanceRecordEntity(); - - attendanceRecordEntity.setRecordImage( req.getRecordImage() ); - attendanceRecordEntity.setRecordPosition( req.getRecordPosition() ); - attendanceRecordEntity.setRecordPositionLabel( req.getRecordPositionLabel() ); - - return attendanceRecordEntity; - } - - @Override - public List toAttendanceRecordResp(List list) { - if ( list == null ) { - return null; - } - - List list1 = new ArrayList( list.size() ); - for ( AttendanceRecordEntity attendanceRecordEntity : list ) { - list1.add( attendanceRecordEntityToAttendanceRecordResp( attendanceRecordEntity ) ); - } - - return list1; - } - - @Override - public EquipmentEntity toEquipmentUseRecordEntity(EquipmentReq req) { - if ( req == null ) { - return null; - } - - EquipmentEntity equipmentEntity = new EquipmentEntity(); - - equipmentEntity.setEquipmentName( req.getEquipmentName() ); - equipmentEntity.setEquipmentModel( req.getEquipmentModel() ); - equipmentEntity.setEquipmentType( req.getEquipmentType() ); - equipmentEntity.setEquipmentSn( req.getEquipmentSn() ); - - return equipmentEntity; - } - - @Override - public EquipmentUseRecordEntity toEquipmentUseRecordEntity(EquipmentUseRecordReq req) { - if ( req == null ) { - return null; - } - - EquipmentUseRecordEntity equipmentUseRecordEntity = new EquipmentUseRecordEntity(); - - equipmentUseRecordEntity.setUserId( req.getUserId() ); - equipmentUseRecordEntity.setProjectId( req.getProjectId() ); - equipmentUseRecordEntity.setRemark( req.getRemark() ); - - return equipmentUseRecordEntity; - } - - private static LocalDateTime xmlGregorianCalendarToLocalDateTime( XMLGregorianCalendar xcal ) { - if ( xcal == null ) { - return null; - } - - if ( xcal.getYear() != DatatypeConstants.FIELD_UNDEFINED - && xcal.getMonth() != DatatypeConstants.FIELD_UNDEFINED - && xcal.getDay() != DatatypeConstants.FIELD_UNDEFINED - && xcal.getHour() != DatatypeConstants.FIELD_UNDEFINED - && xcal.getMinute() != DatatypeConstants.FIELD_UNDEFINED - ) { - if ( xcal.getSecond() != DatatypeConstants.FIELD_UNDEFINED - && xcal.getMillisecond() != DatatypeConstants.FIELD_UNDEFINED ) { - return LocalDateTime.of( - xcal.getYear(), - xcal.getMonth(), - xcal.getDay(), - xcal.getHour(), - xcal.getMinute(), - xcal.getSecond(), - Duration.ofMillis( xcal.getMillisecond() ).getNano() - ); - } - else if ( xcal.getSecond() != DatatypeConstants.FIELD_UNDEFINED ) { - return LocalDateTime.of( - xcal.getYear(), - xcal.getMonth(), - xcal.getDay(), - xcal.getHour(), - xcal.getMinute(), - xcal.getSecond() - ); - } - else { - return LocalDateTime.of( - xcal.getYear(), - xcal.getMonth(), - xcal.getDay(), - xcal.getHour(), - xcal.getMinute() - ); - } - } - return null; - } - - private XMLGregorianCalendar localDateToXmlGregorianCalendar( LocalDate localDate ) { - if ( localDate == null ) { - return null; - } - - return datatypeFactory.newXMLGregorianCalendarDate( - localDate.getYear(), - localDate.getMonthValue(), - localDate.getDayOfMonth(), - DatatypeConstants.FIELD_UNDEFINED ); - } - - protected ImageEntity imageReqToImageEntity(ImageReq imageReq) { - if ( imageReq == null ) { - return null; - } - - ImageEntity imageEntity = new ImageEntity(); - - imageEntity.setImageId( imageReq.getImageId() ); - imageEntity.setImageName( imageReq.getImageName() ); - imageEntity.setImageSize( imageReq.getImageSize() ); - imageEntity.setImageWidth( imageReq.getImageWidth() ); - imageEntity.setImageHeight( imageReq.getImageHeight() ); - imageEntity.setImageResolution( imageReq.getImageResolution() ); - imageEntity.setXResolution( imageReq.getXResolution() ); - imageEntity.setYResolution( imageReq.getYResolution() ); - imageEntity.setResolutionUnits( imageReq.getResolutionUnits() ); - imageEntity.setFocalDistance( imageReq.getFocalDistance() ); - imageEntity.setFocalDistance35( imageReq.getFocalDistance35() ); - imageEntity.setShootingTime( imageReq.getShootingTime() ); - imageEntity.setCameraManufacturer( imageReq.getCameraManufacturer() ); - imageEntity.setCameraModel( imageReq.getCameraModel() ); - imageEntity.setLongitude( imageReq.getLongitude() ); - imageEntity.setLatitude( imageReq.getLatitude() ); - imageEntity.setAltitude( imageReq.getAltitude() ); - imageEntity.setGPS( imageReq.getGPS() ); - imageEntity.setImagePath( imageReq.getImagePath() ); - - return imageEntity; - } - - protected ImageSimpleReq outWorkDefectReqToImageSimpleReq(OutWorkDefectReq outWorkDefectReq) { - if ( outWorkDefectReq == null ) { - return null; - } - - ImageSimpleReq imageSimpleReq = new ImageSimpleReq(); - - imageSimpleReq.setPartId( outWorkDefectReq.getPartId() ); - imageSimpleReq.setImagePath( outWorkDefectReq.getImagePath() ); - - return imageSimpleReq; - } - - protected InsuranceAttachResp insuranceInfoEntityToInsuranceAttachResp(InsuranceInfoEntity insuranceInfoEntity) { - if ( insuranceInfoEntity == null ) { - return null; - } - - InsuranceAttachResp insuranceAttachResp = new InsuranceAttachResp(); - - insuranceAttachResp.setInsuranceInfoId( insuranceInfoEntity.getInsuranceInfoId() ); - insuranceAttachResp.setUserId( insuranceInfoEntity.getUserId() ); - insuranceAttachResp.setName( insuranceInfoEntity.getName() ); - insuranceAttachResp.setUserCode( insuranceInfoEntity.getUserCode() ); - insuranceAttachResp.setAttachInfoId( insuranceInfoEntity.getAttachInfoId() ); - insuranceAttachResp.setRemark( insuranceInfoEntity.getRemark() ); - insuranceAttachResp.setCreateTime( insuranceInfoEntity.getCreateTime() ); - - return insuranceAttachResp; - } - - protected WorkShiftListResp workShiftEntityToWorkShiftListResp(WorkShiftEntity workShiftEntity) { - if ( workShiftEntity == null ) { - return null; - } - - WorkShiftListResp workShiftListResp = new WorkShiftListResp(); - - workShiftListResp.setWorkShiftId( workShiftEntity.getWorkShiftId() ); - workShiftListResp.setWorkShiftName( workShiftEntity.getWorkShiftName() ); - workShiftListResp.setWorkTimeStart( workShiftEntity.getWorkTimeStart() ); - workShiftListResp.setWorkTimeEnd( workShiftEntity.getWorkTimeEnd() ); - workShiftListResp.setStatus( workShiftEntity.getStatus() ); - workShiftListResp.setCreateBy( workShiftEntity.getCreateBy() ); - workShiftListResp.setUpdateTime( workShiftEntity.getUpdateTime() ); - - return workShiftListResp; - } - - protected InspectionReportSchemeInfo checkSchemeEntityToInspectionReportSchemeInfo(CheckSchemeEntity checkSchemeEntity) { - if ( checkSchemeEntity == null ) { - return null; - } - - InspectionReportSchemeInfo inspectionReportSchemeInfo = new InspectionReportSchemeInfo(); - - inspectionReportSchemeInfo.setCheckMethod( checkSchemeEntity.getCheckMethod() ); - - return inspectionReportSchemeInfo; - } - - protected AttendanceRecordResp attendanceRecordEntityToAttendanceRecordResp(AttendanceRecordEntity attendanceRecordEntity) { - if ( attendanceRecordEntity == null ) { - return null; - } - - AttendanceRecordResp attendanceRecordResp = new AttendanceRecordResp(); - - attendanceRecordResp.setRecordId( attendanceRecordEntity.getRecordId() ); - attendanceRecordResp.setUserId( attendanceRecordEntity.getUserId() ); - attendanceRecordResp.setRecordType( attendanceRecordEntity.getRecordType() ); - attendanceRecordResp.setAttendanceDate( attendanceRecordEntity.getAttendanceDate() ); - attendanceRecordResp.setRecordTime( attendanceRecordEntity.getRecordTime() ); - attendanceRecordResp.setRecordImage( attendanceRecordEntity.getRecordImage() ); - attendanceRecordResp.setRecordPosition( attendanceRecordEntity.getRecordPosition() ); - attendanceRecordResp.setRecordPositionLabel( attendanceRecordEntity.getRecordPositionLabel() ); - - return attendanceRecordResp; - } -} - -- 2.34.1 From 386c7273ce7fa4dbe314bd387324cb9702bf3423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Fri, 8 Aug 2025 15:09:21 +0800 Subject: [PATCH 02/22] =?UTF-8?q?8-8=20=E6=9F=A5=E8=AF=A2=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E4=B8=8B=E7=9A=84=E8=AE=BE=E5=A4=87=E5=92=8C=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=AE=8C=E6=88=90=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/entity/EquipmentEntity.java | 3 +++ .../domain/vo/ProjectTasksDetailResp.java | 23 +++++++++++++++++++ .../dite/znpt/service/ProjectTaskService.java | 2 ++ .../impl/EquipmentUseRecordServiceImpl.java | 2 ++ .../service/impl/ProjectTaskServiceImpl.java | 22 ++++++++++++++++++ .../web/controller/ProjectController.java | 20 ++++++++++++---- .../web/controller/ProjectTaskController.java | 19 +++++++++++++++ 7 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/ProjectTasksDetailResp.java diff --git a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java index 4224af2..d4fe545 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java @@ -214,4 +214,7 @@ public class EquipmentEntity extends AuditableEntity implements Serializable { @ApiModelProperty("删除标志(0代表存在 1代表删除)") @TableLogic(value = "0", delval = "1") private String delFlag; + + @ApiModelProperty("项目id") + private String projectId; } diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectTasksDetailResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectTasksDetailResp.java new file mode 100644 index 0000000..4f2a8a7 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectTasksDetailResp.java @@ -0,0 +1,23 @@ +package com.dite.znpt.domain.vo; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel("项目任务详情响应实体") +public class ProjectTasksDetailResp { + private List list; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("项目任务总数") + private Integer total; + + @ApiModelProperty("已完成任务数") + private Integer finished; +} diff --git a/core/src/main/java/com/dite/znpt/service/ProjectTaskService.java b/core/src/main/java/com/dite/znpt/service/ProjectTaskService.java index a142201..8eb9fe5 100644 --- a/core/src/main/java/com/dite/znpt/service/ProjectTaskService.java +++ b/core/src/main/java/com/dite/znpt/service/ProjectTaskService.java @@ -89,5 +89,7 @@ public interface ProjectTaskService extends IService { * @date 2025/06/25 21:16 **/ void endTask(ProjectTaskStartReq taskStartReq); + + List getTaskByProjectId(String projectId); } diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java index 2db0c74..c13249d 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java @@ -90,6 +90,7 @@ public class EquipmentUseRecordServiceImpl extends ServiceImpl getTaskByProjectId(String projectId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_id", projectId); + List list = baseMapper.selectList(queryWrapper); + if (CollectionUtil.isEmpty(list)) { + return Collections.emptyList(); // 返回不可修改的空集合 + } + String projectName = projectService.getById(projectId).getProjectName(); + List respList = list.stream().map(item -> BeanUtil.copyProperties(item, ProjectTaskResp.class)).toList(); + return respList; + } } diff --git a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java index 88f58b4..4cbaf75 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java @@ -2,12 +2,12 @@ package com.dite.znpt.web.controller; import cn.dev33.satoken.stp.StpUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dite.znpt.constant.Constants; -import com.dite.znpt.domain.vo.ProjectListReq; -import com.dite.znpt.domain.vo.ProjectListResp; -import com.dite.znpt.domain.vo.ProjectReq; -import com.dite.znpt.domain.vo.ProjectResp; +import com.dite.znpt.domain.entity.EquipmentEntity; +import com.dite.znpt.domain.vo.*; import com.dite.znpt.domain.entity.ProjectEntity; +import com.dite.znpt.service.EquipmentService; import com.dite.znpt.service.ProjectService; import com.dite.znpt.domain.Result; import com.dite.znpt.domain.PageResult; @@ -35,6 +35,9 @@ public class ProjectController { @Resource private ProjectService projectService; + @Resource + private EquipmentService equipmentService; + @ApiOperation(value = "分页查询项目信息列表", httpMethod = "GET") @GetMapping("/page") public PageResult page(ProjectListReq req) { @@ -100,5 +103,14 @@ public class ProjectController { return Result.ok(projectService.list(req)); } + @ApiOperation(value = "查询项目下的设备列表", httpMethod = "GET") + @GetMapping("/{projectId}/equipments") + public Result> equipments(@PathVariable String projectId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("del_flag", Constants.DEL_FLAG_0); + queryWrapper.eq("use_status", "1"); + queryWrapper.eq("project_id", projectId); + return Result.ok(equipmentService.list(queryWrapper)); + } } diff --git a/web/src/main/java/com/dite/znpt/web/controller/ProjectTaskController.java b/web/src/main/java/com/dite/znpt/web/controller/ProjectTaskController.java index dd59781..7b16908 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/ProjectTaskController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/ProjectTaskController.java @@ -2,10 +2,14 @@ package com.dite.znpt.web.controller; import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dite.znpt.constant.Constants; import com.dite.znpt.domain.PageResult; import com.dite.znpt.domain.Result; +import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.domain.vo.*; +import com.dite.znpt.service.ProjectService; import com.dite.znpt.service.ProjectTaskService; import com.dite.znpt.util.PageUtil; import com.dite.znpt.util.ValidationGroup; @@ -19,6 +23,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -32,6 +37,9 @@ public class ProjectTaskController { @Resource private ProjectTaskService projectTaskService; + @Resource + private ProjectService projectService; + @ApiOperation(value = "获取项目任务信息列表", httpMethod = "GET") @GetMapping("/list") public PageResult list(ProjectTaskListReq projectTaskReq) { @@ -105,5 +113,16 @@ public class ProjectTaskController { req.setUserId(StpUtil.getLoginIdAsString()); return Result.ok(projectTaskService.selectList(req)); } + + @ApiOperation(value = "根据项目id查询任务列表", httpMethod = "GET") + @GetMapping("/{projectId}/tasks") + public Result getTaskByProjectId(@PathVariable String projectId) { + ProjectTasksDetailResp resp = new ProjectTasksDetailResp(); + resp.setProjectName(projectService.getById(projectId).getProjectName()); + resp.setList(projectTaskService.getTaskByProjectId(projectId)); + resp.setTotal(resp.getList().size()); + resp.setFinished((int) resp.getList().stream().filter(projectTaskResp -> projectTaskResp.getStatus() == 2).count()); + return Result.ok(resp); + } } -- 2.34.1 From de2439e65d786faadacd916afc4b79f29269c1ec Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Mon, 11 Aug 2025 11:19:38 +0800 Subject: [PATCH 03/22] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E4=BA=86=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=B8=AD=E5=BF=83=E6=98=BE=E7=A4=BA=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E6=B6=88=E6=81=AF=EF=BC=8C=E5=B9=B6=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E6=9F=A5=E7=9C=8B=E6=B6=88=E6=81=AF=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=B7=B3=E8=BD=AC=E5=88=B0=E5=85=B7=E4=BD=93?= =?UTF-8?q?=E7=9A=84=E5=AE=A1=E6=89=B9=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EquipmentApprovalServiceImpl.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java index 1fa86dd..f311a84 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java @@ -262,6 +262,15 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { // 保存到数据库 equipmentApprovalMapper.insert(entity); + // 更新设备采购状态 - 新增逻辑 + try { + updateEquipmentProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL"); + log.info("设备采购状态更新成功,设备ID: {}", req.getEquipmentId()); + } catch (Exception e) { + log.error("设备采购状态更新失败,设备ID: {}", req.getEquipmentId(), e); + // 不抛出异常,避免影响审批流程 + } + // 发送通知 - 使用日志记录,后续可以扩展为WebSocket通知 log.info("采购申请提交成功,设备名称: {}, 申请人: {}", req.getEquipmentName(), getCurrentUserName()); @@ -279,6 +288,33 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { log.info("采购申请提交成功,审批ID: {}", entity.getApprovalId()); } + + /** + * 更新设备采购状态 + */ + private void updateEquipmentProcurementStatus(String equipmentId, String status) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过状态更新"); + return; + } + + try { + log.info("准备更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status); + + // 这里可以添加具体的更新逻辑 + // 例如:equipmentMapper.updateProcurementStatus(equipmentId, status); + // 由于循环依赖问题,建议通过事件机制或异步处理来避免循环依赖 + + // 暂时记录日志,后续可以通过以下方式实现: + // 1. 使用Spring事件机制 + // 2. 使用异步处理 + // 3. 重构服务架构避免循环依赖 + + } catch (Exception e) { + log.error("更新设备采购状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } @Override public IPage getMyProcurementApplications(EquipmentApprovalListReq req) { -- 2.34.1 From 7496486a5ebadc123b8a79696647f6636894b3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Mon, 11 Aug 2025 14:23:52 +0800 Subject: [PATCH 04/22] =?UTF-8?q?8-11=20=E9=A1=B9=E7=9B=AE=E7=AB=8B?= =?UTF-8?q?=E9=A1=B9=E6=97=B6=E5=8F=AF=E5=88=9D=E5=A7=8B=E5=8C=96=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=88=97=E8=A1=A8=E4=B8=80=E6=AC=A1=E6=80=A7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=A4=9A=E4=B8=AA=E5=B1=9E=E4=BA=8E=E8=AF=A5=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E4=BB=BB=E5=8A=A1=EF=BC=88=E9=9C=80=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E4=BB=BB=E5=8A=A1=E5=90=8D=E7=A7=B0=E3=80=81=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E7=BC=96=E5=8F=B7=E3=80=81=E8=AE=A1=E5=88=92=E5=BC=80?= =?UTF-8?q?=E5=A7=8B/=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4=E3=80=81?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=BB=84id=E3=80=81=E8=B4=9F=E8=B4=A3?= =?UTF-8?q?=E4=BA=BAid=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/vo/ProjectInitTaskReq.java | 41 +++++++++++++++++++ .../com/dite/znpt/domain/vo/ProjectReq.java | 6 ++- .../znpt/service/impl/ProjectServiceImpl.java | 12 ++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java new file mode 100644 index 0000000..e1ef86f --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java @@ -0,0 +1,41 @@ +package com.dite.znpt.domain.vo; + +import com.dite.znpt.util.ValidationGroup; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.time.LocalDate; + +@Data +@ApiModel("项目初始化任务请求参数") +public class ProjectInitTaskReq { + @ApiModelProperty("任务名称") + private String taskName; + + @NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "项目任务编号不能为空") + @Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "项目任务编号长度不能超过100字符") + @ApiModelProperty("项目任务编号") + private String taskCode; + + @NotNull(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "计划开始时间不能为空") + @ApiModelProperty("计划开始时间") + private LocalDate planStartDate; + + @NotNull(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "计划结束时间不能为空") + @ApiModelProperty("计划结束时间") + private LocalDate planEndDate; + + @NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "任务组id不能为空") + @Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 32, message = "任务组id长度不能超过32字符") + @ApiModelProperty("任务组id") + private String taskGroupId; + + @NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "任务负责人id不能为空") + @Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "任务负责人id长度不能超过100字符") + @ApiModelProperty("任务负责人id") + private String mainUserId; +} diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java index 5fdcc16..881ecb6 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java @@ -1,5 +1,6 @@ package com.dite.znpt.domain.vo; +import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.util.ValidationGroup; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -10,6 +11,7 @@ import javax.validation.constraints.Size; import java.io.Serial; import java.io.Serializable; import java.time.LocalDate; +import java.util.List; /** * @Author: gaoxiong @@ -31,7 +33,6 @@ public class ProjectReq implements Serializable { @ApiModelProperty("项目来源") private String projectOrigin; - @NotBlank(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, message = "项目预算不能为空") @ApiModelProperty("项目预算") private Integer projectBudget; @@ -127,4 +128,7 @@ public class ProjectReq implements Serializable { @ApiModelProperty("其他杂费") private Double othersCost; + + @ApiModelProperty("项目初始任务") + private List tasks; } diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java index c7b3038..de2a7e4 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java @@ -1,12 +1,15 @@ package com.dite.znpt.service.impl; +import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dite.znpt.constant.Message; import com.dite.znpt.converts.Converts; import com.dite.znpt.domain.entity.ProjectEntity; +import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.domain.entity.UserEntity; +import com.dite.znpt.domain.vo.ProjectInitTaskReq; import com.dite.znpt.domain.vo.ProjectListReq; import com.dite.znpt.domain.vo.ProjectListResp; import com.dite.znpt.domain.vo.ProjectReq; @@ -16,6 +19,7 @@ import com.dite.znpt.exception.ServiceException; import com.dite.znpt.mapper.ProjectMapper; import com.dite.znpt.service.ProjectService; import com.dite.znpt.service.UserService; +import com.dite.znpt.service.ProjectTaskService; import com.dite.znpt.util.PageUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -40,6 +44,9 @@ public class ProjectServiceImpl extends ServiceImpl Date: Mon, 11 Aug 2025 15:23:39 +0800 Subject: [PATCH 05/22] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E6=A8=A1=E5=9D=97crud=E6=96=B9=E6=B3=95=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/vo/ProjectKanbanDataResp.java | 9 + .../domain/vo/ProjectKanbanStatsResp.java | 9 + .../znpt/domain/vo/TeamMemberUpdateReq.java | 60 ++++++ .../dite/znpt/enums/ProjectStatusEnum.java | 11 +- .../znpt/service/ProjectMemberService.java | 5 + .../impl/ProjectMemberServiceImpl.java | 186 ++++++++++++++++-- .../controller/ProjectMemberController.java | 2 +- 7 files changed, 265 insertions(+), 17 deletions(-) create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/TeamMemberUpdateReq.java diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java index 2e7e598..86eae78 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java @@ -32,6 +32,15 @@ public class ProjectKanbanDataResp { @ApiModelProperty("已验收项目列表") private List acceptedProjects; + @ApiModelProperty("验收中项目列表") + private List acceptanceProjects; + + @ApiModelProperty("回款中项目列表") + private List collectionProjects; + + @ApiModelProperty("已结算项目列表") + private List settledProjects; + @Data @ApiModel(value="ProjectKanbanItem对象", description="项目看板项目项") public static class ProjectKanbanItem { diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java index fe2f6f0..264e340 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java @@ -31,6 +31,15 @@ public class ProjectKanbanStatsResp { @ApiModelProperty("已验收项目数") private Long acceptedProjectCount; + @ApiModelProperty("验收中项目数") + private Long acceptanceProjectCount; + + @ApiModelProperty("回款中项目数") + private Long collectionProjectCount; + + @ApiModelProperty("已结算项目数") + private Long settledProjectCount; + @ApiModelProperty("总机组数") private Long totalTurbineCount; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/TeamMemberUpdateReq.java b/core/src/main/java/com/dite/znpt/domain/vo/TeamMemberUpdateReq.java new file mode 100644 index 0000000..f375d8c --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/TeamMemberUpdateReq.java @@ -0,0 +1,60 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDate; + +/** + * @author wangna + * @date 2025/08/05 + * @Description: 团队成员更新请求类(用于更新操作,移除必填验证) + */ +@Data +@ApiModel(value="TeamMemberUpdateReq对象", description="团队成员更新请求类") +public class TeamMemberUpdateReq implements Serializable { + + @ApiModelProperty("项目ID") + private String projectId; + + @ApiModelProperty("机组ID(可选)") + private String turbineId; + + @ApiModelProperty("任务组ID(可选)") + private String taskGroupId; + + @ApiModelProperty("任务ID(可选)") + private String taskId; + + @ApiModelProperty("用户ID") + private String userId; + + @ApiModelProperty("项目角色类型:PROJECT_MANAGER-项目经理,SAFETY_OFFICER-安全员,QUALITY_OFFICER-质量员,CONSTRUCTOR-施工人员,TEAM_LEADER-施工组长") + private String roleType; + + @ApiModelProperty("具体岗位代码(如:GROUND_SERVICE-地勤,DRIVER-司机,ASCENDING-登高等)") + private String jobCode; + + @ApiModelProperty("岗位描述") + private String jobDesc; + + @ApiModelProperty("加入时间") + private LocalDate joinDate; + + @ApiModelProperty("离开时间") + private LocalDate leaveDate; + + @ApiModelProperty("状态:ACTIVE-在职,INACTIVE-离职,PENDING-待入职") + private String status = "ACTIVE"; + + @ApiModelProperty("备注") + private String remark; + + @ApiModelProperty("用户电话") + private String phone; + + @ApiModelProperty("用户邮箱") + private String email; +} diff --git a/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java b/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java index 7836468..eadf498 100644 --- a/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java +++ b/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java @@ -15,11 +15,14 @@ import java.util.List; @Getter @AllArgsConstructor public enum ProjectStatusEnum { - PENDING(0, "待施工"), - IN_PROGRESS(1, "施工中"), - COMPLETED(2, "已完工"), + PENDING(0, "未开工"), + IN_PREPARATION(1, "筹备中"), + IN_PROGRESS(2, "开工中"), AUDITED(3, "已审核"), - ACCEPTED(4, "已验收"); + COMPLETED(4, "已完工"), + ACCEPTED(5, "已验收"), + IN_COLLECTION(6, "回款中"), + SETTLED(7, "已结算"); private final int code; private final String desc; diff --git a/core/src/main/java/com/dite/znpt/service/ProjectMemberService.java b/core/src/main/java/com/dite/znpt/service/ProjectMemberService.java index 939ff8a..c622b9e 100644 --- a/core/src/main/java/com/dite/znpt/service/ProjectMemberService.java +++ b/core/src/main/java/com/dite/znpt/service/ProjectMemberService.java @@ -27,6 +27,11 @@ public interface ProjectMemberService extends IService { */ ProjectMemberResp updateTeamMember(String memberId, TeamMemberReq req); + /** + * 更新团队成员信息(使用更新专用请求类) + */ + ProjectMemberResp updateTeamMember(String memberId, TeamMemberUpdateReq req); + /** * 删除团队成员(支持单个或批量删除) */ diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java index 1c03097..d832fb9 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java @@ -1,5 +1,6 @@ package com.dite.znpt.service.impl; +import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; @@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -188,6 +190,14 @@ public class ProjectMemberServiceImpl extends ServiceImpl list = this.baseMapper.queryTeamMembers(query); - return list.stream() - .filter(member -> member.getMemberId().equals(memberId)) + ProjectMemberResp member = list.stream() + .filter(m -> m.getMemberId().equals(memberId)) .findFirst() .orElse(null); + + if (member != null) { + // 丰富成员信息 + enrichMemberInfo(CollUtil.toList(member)); + } + + return member; } // ========================== 项目看板相关方法实现 ========================== @@ -300,11 +454,15 @@ public class ProjectMemberServiceImpl extends ServiceImpl updateTeamMember( @PathVariable String memberId, - @Valid @RequestBody TeamMemberReq req) { + @RequestBody TeamMemberUpdateReq req) { return Result.ok(projectMemberService.updateTeamMember(memberId, req)); } -- 2.34.1 From 1277b4070523eb810b059736fb8ea58eabb410e4 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Mon, 11 Aug 2025 17:12:09 +0800 Subject: [PATCH 06/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=8A=B6=E6=80=81=E5=9B=BE=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=A1=BA=E5=88=A9=E4=BE=9D=E6=8D=AE=E6=B5=81=E7=A8=8B=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/entity/EquipmentEntity.java | 3 + .../dite/znpt/domain/vo/EquipmentResp.java | 3 + .../service/EquipmentStatusUpdateService.java | 51 ++++ .../impl/EquipmentApprovalServiceImpl.java | 140 ++++++++++- .../service/impl/EquipmentServiceImpl.java | 8 + .../EquipmentStatusUpdateServiceImpl.java | 232 ++++++++++++++++++ 6 files changed, 435 insertions(+), 2 deletions(-) create mode 100644 core/src/main/java/com/dite/znpt/service/EquipmentStatusUpdateService.java create mode 100644 core/src/main/java/com/dite/znpt/service/impl/EquipmentStatusUpdateServiceImpl.java diff --git a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java index e6d836b..642ee6e 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java @@ -177,6 +177,9 @@ public class EquipmentEntity extends AuditableEntity implements Serializable { @ApiModelProperty("发票状态") private String invoiceStatus; + @ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成") + private String procurementStatus; + @ApiModelProperty("附件") private String attachments; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java index d936b01..04642f2 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java @@ -154,6 +154,9 @@ public class EquipmentResp implements Serializable { @ApiModelProperty("总价") private BigDecimal totalPrice; + @ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成") + private String procurementStatus; + // 移除备用状态字段,使用现有的 location_status 字段 // @ApiModelProperty("备用状态") // private String spareStatus; diff --git a/core/src/main/java/com/dite/znpt/service/EquipmentStatusUpdateService.java b/core/src/main/java/com/dite/znpt/service/EquipmentStatusUpdateService.java new file mode 100644 index 0000000..2963dde --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/EquipmentStatusUpdateService.java @@ -0,0 +1,51 @@ +package com.dite.znpt.service; + +/** + * 设备状态更新服务接口 + * 用于处理设备审批后的状态更新,避免循环依赖 + * + * @author Bear.G + * @date 2025/1/8/周三 17:50 + */ +public interface EquipmentStatusUpdateService { + + /** + * 更新设备采购状态 + * + * @param equipmentId 设备ID + * @param status 新状态 + */ + void updateProcurementStatus(String equipmentId, String status); + + /** + * 更新设备借用状态 + * + * @param equipmentId 设备ID + * @param status 新状态 + */ + void updateBorrowStatus(String equipmentId, String status); + + /** + * 更新设备归还状态 + * + * @param equipmentId 设备ID + * @param status 新状态 + */ + void updateReturnStatus(String equipmentId, String status); + + /** + * 更新设备位置状态 + * + * @param equipmentId 设备ID + * @param locationStatus 新位置状态 + */ + void updateLocationStatus(String equipmentId, String locationStatus); + + /** + * 更新设备使用状态 + * + * @param equipmentId 设备ID + * @param useStatus 新使用状态 + */ + void updateUseStatus(String equipmentId, String useStatus); +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java index f311a84..480734d 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java @@ -10,6 +10,7 @@ import com.dite.znpt.domain.vo.EquipmentApprovalReq; import com.dite.znpt.domain.vo.EquipmentApprovalResp; import com.dite.znpt.domain.vo.EquipmentProcurementApplyReq; import com.dite.znpt.service.EquipmentApprovalService; +import com.dite.znpt.service.EquipmentStatusUpdateService; import com.dite.znpt.websocket.SimpleWebSocketHandler; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; @@ -34,6 +35,9 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { @Resource private EquipmentApprovalMapper equipmentApprovalMapper; + + @Resource + private EquipmentStatusUpdateService equipmentStatusUpdateService; @Override public IPage getPendingApprovals(EquipmentApprovalListReq req) { @@ -85,6 +89,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { entity.setApprovalComment(req.getApprovalComment()); equipmentApprovalMapper.updateById(entity); + + // 审批通过后,更新设备状态 + try { + if ("PROCUREMENT".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "APPROVED"); + } else if ("BORROW".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "APPROVED"); + } else if ("RETURN".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "APPROVED"); + } + log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId); + } catch (Exception e) { + log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e); + // 不抛出异常,避免影响审批流程 + } } @Override @@ -101,6 +120,21 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { entity.setApprovalComment(req.getApprovalComment()); equipmentApprovalMapper.updateById(entity); + + // 审批拒绝后,更新设备状态 + try { + if ("PROCUREMENT".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateProcurementStatus(entity.getEquipmentId(), "REJECTED"); + } else if ("BORROW".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateBorrowStatus(entity.getEquipmentId(), "REJECTED"); + } else if ("RETURN".equals(entity.getBusinessType())) { + equipmentStatusUpdateService.updateReturnStatus(entity.getEquipmentId(), "REJECTED"); + } + log.info("设备状态更新成功,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId); + } catch (Exception e) { + log.error("设备状态更新失败,设备ID: {}, 审批ID: {}", entity.getEquipmentId(), approvalId, e); + // 不抛出异常,避免影响审批流程 + } } @Override @@ -264,7 +298,7 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { // 更新设备采购状态 - 新增逻辑 try { - updateEquipmentProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL"); + equipmentStatusUpdateService.updateProcurementStatus(req.getEquipmentId(), "PENDING_APPROVAL"); log.info("设备采购状态更新成功,设备ID: {}", req.getEquipmentId()); } catch (Exception e) { log.error("设备采购状态更新失败,设备ID: {}", req.getEquipmentId(), e); @@ -297,7 +331,7 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { log.warn("设备ID为空,跳过状态更新"); return; } - + try { log.info("准备更新设备采购状态,设备ID: {}, 新状态: {}", equipmentId, status); @@ -316,6 +350,108 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { } } + + + /** + * 审批通过后更新设备状态 + */ + private void updateEquipmentStatusAfterApproval(EquipmentApprovalEntity entity) { + if (entity == null || entity.getEquipmentId() == null) { + log.warn("审批实体或设备ID为空,跳过状态更新"); + return; + } + + try { + log.info("审批通过后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType()); + + // 根据业务类型更新不同的设备状态 + if ("PROCUREMENT".equals(entity.getBusinessType())) { + // 采购审批通过,更新设备状态为已采购 + updateEquipmentProcurementStatus(entity.getEquipmentId(), "APPROVED"); + } else if ("BORROW".equals(entity.getBusinessType())) { + // 借用审批通过,更新设备状态为已借用 + updateEquipmentBorrowStatus(entity.getEquipmentId(), "APPROVED"); + } else if ("RETURN".equals(entity.getBusinessType())) { + // 归还审批通过,更新设备状态为已归还 + updateEquipmentReturnStatus(entity.getEquipmentId(), "APPROVED"); + } + + log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId()); + } catch (Exception e) { + log.error("审批通过后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e); + throw e; + } + } + + /** + * 审批拒绝后更新设备状态 + */ + private void updateEquipmentStatusAfterRejection(EquipmentApprovalEntity entity) { + if (entity == null || entity.getEquipmentId() == null) { + log.warn("审批实体或设备ID为空,跳过状态更新"); + return; + } + + try { + log.info("审批拒绝后更新设备状态,设备ID: {}, 业务类型: {}", entity.getEquipmentId(), entity.getBusinessType()); + + // 根据业务类型更新不同的设备状态 + if ("PROCUREMENT".equals(entity.getBusinessType())) { + // 采购审批拒绝,更新设备状态为审批拒绝 + updateEquipmentProcurementStatus(entity.getEquipmentId(), "REJECTED"); + } else if ("BORROW".equals(entity.getBusinessType())) { + // 借用审批拒绝,更新设备状态为借用拒绝 + updateEquipmentBorrowStatus(entity.getEquipmentId(), "REJECTED"); + } else if ("RETURN".equals(entity.getBusinessType())) { + // 归还审批拒绝,更新设备状态为归还拒绝 + updateEquipmentReturnStatus(entity.getEquipmentId(), "REJECTED"); + } + + log.info("设备状态更新成功,设备ID: {}", entity.getEquipmentId()); + } catch (Exception e) { + log.error("审批拒绝后更新设备状态失败,设备ID: {}", entity.getEquipmentId(), e); + throw e; + } + } + + /** + * 更新设备借用状态 + */ + private void updateEquipmentBorrowStatus(String equipmentId, String status) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过借用状态更新"); + return; + } + + try { + log.info("准备更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status); + // 这里可以添加具体的更新逻辑 + // 例如:equipmentMapper.updateBorrowStatus(equipmentId, status); + } catch (Exception e) { + log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } + + /** + * 更新设备归还状态 + */ + private void updateEquipmentReturnStatus(String equipmentId, String status) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过归还状态更新"); + return; + } + + try { + log.info("准备更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status); + // 这里可以添加具体的更新逻辑 + // 例如:equipmentMapper.updateReturnStatus(equipmentId, status); + } catch (Exception e) { + log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } + @Override public IPage getMyProcurementApplications(EquipmentApprovalListReq req) { log.info("开始获取我的采购申请,请求参数: {}", req); diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index 8f15c6e..ebaac5c 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -562,6 +562,9 @@ public class EquipmentServiceImpl extends ServiceImpl updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId); + + // 根据状态设置相应的字段 + if ("APPROVED".equals(status)) { + // 审批通过:设置采购状态为已通过,位置状态为库存中,使用状态为空闲中 + updateWrapper.set(EquipmentEntity::getProcurementStatus, "APPROVED"); + updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock"); + updateWrapper.set(EquipmentEntity::getUseStatus, "0"); + updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now()); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备采购审批通过,设置状态为已通过"); + } else if ("REJECTED".equals(status)) { + // 审批拒绝:设置采购状态为已拒绝,位置状态为未入库,使用状态为空闲中 + updateWrapper.set(EquipmentEntity::getProcurementStatus, "REJECTED"); + updateWrapper.set(EquipmentEntity::getLocationStatus, "not_in_stock"); + updateWrapper.set(EquipmentEntity::getUseStatus, "0"); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备采购审批拒绝,设置状态为已拒绝"); + } else if ("PENDING_APPROVAL".equals(status) || "PENDING".equals(status)) { + // 待审批:设置采购状态为待审批,位置状态为待审批,使用状态为空闲中 + updateWrapper.set(EquipmentEntity::getProcurementStatus, "PENDING_APPROVAL"); + updateWrapper.set(EquipmentEntity::getLocationStatus, "pending_approval"); + updateWrapper.set(EquipmentEntity::getUseStatus, "0"); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备采购申请提交,设置状态为待审批"); + } else if ("COMPLETED".equals(status)) { + // 采购完成:设置采购状态为已完成,位置状态为库存中,使用状态为空闲中 + updateWrapper.set(EquipmentEntity::getProcurementStatus, "COMPLETED"); + updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock"); + updateWrapper.set(EquipmentEntity::getUseStatus, "0"); + updateWrapper.set(EquipmentEntity::getInStockTime, LocalDateTime.now()); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备采购完成,设置状态为已完成"); + } + + // 执行更新 + int updateCount = equipmentMapper.update(null, updateWrapper); + if (updateCount > 0) { + log.info("设备采购状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount); + } else { + log.warn("设备采购状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status); + } + + } catch (Exception e) { + log.error("更新设备采购状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateBorrowStatus(String equipmentId, String status) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过借用状态更新"); + return; + } + + try { + log.info("开始更新设备借用状态,设备ID: {}, 新状态: {}", equipmentId, status); + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId); + + if ("APPROVED".equals(status)) { + // 借用审批通过:设置位置状态为外借中,使用状态为使用中 + updateWrapper.set(EquipmentEntity::getLocationStatus, "borrowed"); + updateWrapper.set(EquipmentEntity::getUseStatus, "1"); + updateWrapper.set(EquipmentEntity::getBorrowingTime, LocalDateTime.now()); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备借用审批通过,设置状态为外借中"); + } else if ("REJECTED".equals(status)) { + // 借用审批拒绝:保持原有状态 + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备借用审批拒绝,保持原有状态"); + } + + // 执行更新 + int updateCount = equipmentMapper.update(null, updateWrapper); + if (updateCount > 0) { + log.info("设备借用状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount); + } else { + log.warn("设备借用状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status); + } + + } catch (Exception e) { + log.error("更新设备借用状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateReturnStatus(String equipmentId, String status) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过归还状态更新"); + return; + } + + try { + log.info("开始更新设备归还状态,设备ID: {}, 新状态: {}", equipmentId, status); + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId); + + if ("APPROVED".equals(status)) { + // 归还审批通过:设置位置状态为库存中,使用状态为空闲中 + updateWrapper.set(EquipmentEntity::getLocationStatus, "in_stock"); + updateWrapper.set(EquipmentEntity::getUseStatus, "0"); + updateWrapper.set(EquipmentEntity::getReturnTime, LocalDateTime.now()); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备归还审批通过,设置状态为库存中"); + } else if ("REJECTED".equals(status)) { + // 归还审批拒绝:保持原有状态 + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + log.info("设备归还审批拒绝,保持原有状态"); + } + + // 执行更新 + int updateCount = equipmentMapper.update(null, updateWrapper); + if (updateCount > 0) { + log.info("设备归还状态更新成功,设备ID: {}, 新状态: {}, 影响行数: {}", equipmentId, status, updateCount); + } else { + log.warn("设备归还状态更新失败,设备ID: {}, 新状态: {}, 可能设备不存在", equipmentId, status); + } + + } catch (Exception e) { + log.error("更新设备归还状态失败,设备ID: {}, 状态: {}", equipmentId, status, e); + throw e; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateLocationStatus(String equipmentId, String locationStatus) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过位置状态更新"); + return; + } + + try { + log.info("开始更新设备位置状态,设备ID: {}, 新位置状态: {}", equipmentId, locationStatus); + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId); + updateWrapper.set(EquipmentEntity::getLocationStatus, locationStatus); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + + // 执行更新 + int updateCount = equipmentMapper.update(null, updateWrapper); + if (updateCount > 0) { + log.info("设备位置状态更新成功,设备ID: {}, 新位置状态: {}, 影响行数: {}", equipmentId, locationStatus, updateCount); + } else { + log.warn("设备位置状态更新失败,设备ID: {}, 新位置状态: {}, 可能设备不存在", equipmentId, locationStatus); + } + + } catch (Exception e) { + log.error("更新设备位置状态失败,设备ID: {}, 位置状态: {}", equipmentId, locationStatus, e); + throw e; + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateUseStatus(String equipmentId, String useStatus) { + if (equipmentId == null || equipmentId.trim().isEmpty()) { + log.warn("设备ID为空,跳过使用状态更新"); + return; + } + + try { + log.info("开始更新设备使用状态,设备ID: {}, 新使用状态: {}", equipmentId, useStatus); + + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(EquipmentEntity::getEquipmentId, equipmentId); + updateWrapper.set(EquipmentEntity::getUseStatus, useStatus); + updateWrapper.set(EquipmentEntity::getStatusChangeTime, LocalDateTime.now()); + + // 执行更新 + int updateCount = equipmentMapper.update(null, updateWrapper); + if (updateCount > 0) { + log.info("设备使用状态更新成功,设备ID: {}, 新使用状态: {}, 影响行数: {}", equipmentId, useStatus, updateCount); + } else { + log.warn("设备使用状态更新失败,设备ID: {}, 新使用状态: {}, 可能设备不存在", equipmentId, useStatus); + } + + } catch (Exception e) { + log.error("更新设备使用状态失败,设备ID: {}, 使用状态: {}", equipmentId, useStatus, e); + throw e; + } + } +} -- 2.34.1 From ba2f7ecbea9dfd192e34741079460788f2268854 Mon Sep 17 00:00:00 2001 From: wangna0328 <3402195679@qq.com> Date: Mon, 11 Aug 2025 17:58:50 +0800 Subject: [PATCH 07/22] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=9C=8B=E6=9D=BF?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9=E8=81=94?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/vo/ProjectKanbanDataResp.java | 16 +++++++------- .../domain/vo/ProjectKanbanStatsResp.java | 14 ++++++------ .../dite/znpt/enums/ProjectStatusEnum.java | 6 ++--- .../impl/ProjectMemberServiceImpl.java | 22 +++++++++---------- .../znpt/service/impl/TurbineServiceImpl.java | 14 ++++++------ .../znpt/web/controller/UserController.java | 8 +++++++ 6 files changed, 43 insertions(+), 37 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java index 86eae78..ed1748d 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanDataResp.java @@ -17,21 +17,21 @@ import java.util.List; @ApiModel(value="ProjectKanbanDataResp对象", description="项目看板数据响应") public class ProjectKanbanDataResp { - @ApiModelProperty("待施工项目列表") + @ApiModelProperty("未开工项目列表") private List pendingProjects; - @ApiModelProperty("施工中项目列表") + @ApiModelProperty("筹备中项目列表") + private List preparingProjects; + + @ApiModelProperty("开工中项目列表") private List inProgressProjects; + @ApiModelProperty("暂停中项目列表") + private List suspendedProjects; + @ApiModelProperty("已完工项目列表") private List completedProjects; - @ApiModelProperty("已审核项目列表") - private List auditedProjects; - - @ApiModelProperty("已验收项目列表") - private List acceptedProjects; - @ApiModelProperty("验收中项目列表") private List acceptanceProjects; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java index 264e340..d15296a 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectKanbanStatsResp.java @@ -19,18 +19,18 @@ public class ProjectKanbanStatsResp { @ApiModelProperty("待施工项目数") private Long pendingProjectCount; - @ApiModelProperty("施工中项目数") + @ApiModelProperty("筹备中项目数") + private Long preparingProjectCount; + + @ApiModelProperty("开工中项目数") private Long inProgressProjectCount; + @ApiModelProperty("暂停中项目数") + private Long suspendedProjectCount; + @ApiModelProperty("已完工项目数") private Long completedProjectCount; - @ApiModelProperty("已审核项目数") - private Long auditedProjectCount; - - @ApiModelProperty("已验收项目数") - private Long acceptedProjectCount; - @ApiModelProperty("验收中项目数") private Long acceptanceProjectCount; diff --git a/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java b/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java index eadf498..7fbbeff 100644 --- a/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java +++ b/core/src/main/java/com/dite/znpt/enums/ProjectStatusEnum.java @@ -16,11 +16,11 @@ import java.util.List; @AllArgsConstructor public enum ProjectStatusEnum { PENDING(0, "未开工"), - IN_PREPARATION(1, "筹备中"), + PREPARING(1, "筹备中"), IN_PROGRESS(2, "开工中"), - AUDITED(3, "已审核"), + SUSPENDED(3, "暂停中"), COMPLETED(4, "已完工"), - ACCEPTED(5, "已验收"), + IN_ACCEPTANCE(5, "验收中"), IN_COLLECTION(6, "回款中"), SETTLED(7, "已结算"); diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java index d832fb9..c5fbc62 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectMemberServiceImpl.java @@ -455,12 +455,11 @@ public class ProjectMemberServiceImpl extends ServiceImpl turbineStatusList = jobService.calCrewStatus(ListUtil.of(turbineId)); @@ -234,7 +234,7 @@ public class TurbineServiceImpl extends ServiceImpl searchByName(@RequestParam String name) { + UserListReq req = new UserListReq(); + req.setName(name); + return PageResult.ok(userService.list(req)); + } } -- 2.34.1 From 181cbfec8041fedec3b1507863b78ef486aee91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Tue, 12 Aug 2025 11:33:58 +0800 Subject: [PATCH 08/22] =?UTF-8?q?8-12=20=E6=96=BD=E5=B7=A5=E8=A7=84?= =?UTF-8?q?=E6=A8=A1(=E9=A3=8E=E6=9C=BA=E6=95=B0=E9=87=8F)=E4=B8=8B?= =?UTF-8?q?=E6=94=BE=E8=87=B3=E4=BB=BB=E5=8A=A1=E4=B8=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E8=AE=A1=E7=AE=97=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=BF=9B=E5=BA=A6=EF=BC=8C=E9=A1=B9=E7=9B=AE=E6=80=BB=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dite/znpt/domain/entity/ProjectEntity.java | 2 +- .../com/dite/znpt/domain/entity/ProjectTaskEntity.java | 8 ++++++++ .../java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java | 3 +++ .../com/dite/znpt/service/impl/ProjectServiceImpl.java | 4 ++++ .../dite/znpt/web/controller/ProjectTaskController.java | 8 ++++++-- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/domain/entity/ProjectEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/ProjectEntity.java index 943620b..875b6c3 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/ProjectEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/ProjectEntity.java @@ -89,7 +89,7 @@ public class ProjectEntity extends AuditableEntity implements Serializable { @ExcelProperty("项目规模") @ApiModelProperty("项目规模") @TableField("scale") - private String scale; + private Integer scale; @ExcelProperty("总工期,单位天") @ApiModelProperty("总工期,单位天") diff --git a/core/src/main/java/com/dite/znpt/domain/entity/ProjectTaskEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/ProjectTaskEntity.java index e2a25e8..2776261 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/ProjectTaskEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/ProjectTaskEntity.java @@ -85,5 +85,13 @@ public class ProjectTaskEntity extends AuditableEntity implements Serializable { @ApiModelProperty("项目id") @TableField("project_id") private String projectId; + + @ApiModelProperty("任务规模") + @TableField("scales") + private Integer scales; + + @ApiModelProperty("已完成数") + @TableField("finished") + private Integer finished; } diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java index e1ef86f..7ec32f1 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectInitTaskReq.java @@ -38,4 +38,7 @@ public class ProjectInitTaskReq { @Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 100, message = "任务负责人id长度不能超过100字符") @ApiModelProperty("任务负责人id") private String mainUserId; + + @ApiModelProperty("任务规模") + private Integer scales; } diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java index de2a7e4..38d8b40 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java @@ -137,7 +137,11 @@ public class ProjectServiceImpl extends ServiceImpl getTaskByProjectId(@PathVariable String projectId) { ProjectTasksDetailResp resp = new ProjectTasksDetailResp(); + resp.setTotal(0); + resp.setFinished(0); resp.setProjectName(projectService.getById(projectId).getProjectName()); resp.setList(projectTaskService.getTaskByProjectId(projectId)); - resp.setTotal(resp.getList().size()); - resp.setFinished((int) resp.getList().stream().filter(projectTaskResp -> projectTaskResp.getStatus() == 2).count()); + for (ProjectTaskResp projectTaskResp : resp.getList()) { + resp.setTotal(resp.getTotal() + projectTaskResp.getScales()); + resp.setFinished(resp.getFinished() + projectTaskResp.getFinished()); + } return Result.ok(resp); } } \ No newline at end of file -- 2.34.1 From 28b763fb2d64fdf174ae7ee1b19b1a53caf4d803 Mon Sep 17 00:00:00 2001 From: ybb <2532447764@qq.com> Date: Tue, 12 Aug 2025 11:34:45 +0800 Subject: [PATCH 09/22] =?UTF-8?q?8=E6=9C=8812=EF=BC=8C=E5=AE=9E=E7=8E=B0?= =?UTF-8?q?=E4=BA=86=E8=83=BD=E5=A4=9F=E6=8C=89=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?=E6=8B=BC=E9=9F=B3=E6=8E=92=E5=BA=8F=EF=BC=8C=E5=92=8C=E6=9B=B4?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F=E7=AD=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/mapper/BusinessDataFileMapper.java | 16 +++++-- .../znpt/service/BusinessDataFileService.java | 4 +- .../impl/BusinessDataFileServiceImpl.java | 41 +++++++++++----- .../mapper/BusinessDataFileMapper.xml | 48 +++++++++++++++++++ .../BusinessDataFileController.java | 29 +++++++---- 5 files changed, 113 insertions(+), 25 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java b/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java index 02d682b..0fa1dd8 100644 --- a/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java +++ b/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java @@ -17,13 +17,23 @@ public interface BusinessDataFileMapper { // 新增文件预览方法 - public List List(@Param("folderId") Long folderId, @Param("fileName") String fileName); - void delete(@Param("fileId") Long fileId,@Param("folderId") Long folderId); +// public List List(@Param("folderId") Long folderId, @Param("fileName") String fileName); + + public List List( + @Param("folderId") Long folderId, + @Param("fileName") String fileName, + @Param("sortField") String sortField, + @Param("sortOrder") String sortOrder); + void delete(@Param("fileId") Long fileId, + @Param("folderId") Long folderId); void add(BusinessDataFileEntity businessDataFileEntity); String getPath(Long fileId); // 在接口中添加重命名方法 - void reName(@Param("fileId") Long fileId, @Param("newFileName") String newFileName, @Param("newFilePath") String newFilePath); + void reName(@Param("fileId") Long fileId, + @Param("newFileName") String newFileName, + @Param("newFilePath") String newFilePath); + } diff --git a/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java b/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java index 9eafc83..b4af5dc 100644 --- a/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java +++ b/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java @@ -14,8 +14,10 @@ import javax.servlet.http.HttpServletResponse; @Service public interface BusinessDataFileService { +// @ApiOperation("分页查询文件") +// PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName); @ApiOperation("分页查询文件") - PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName); + PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder); @ApiOperation("删除文件") Result delete(@RequestParam(value = "fileId", required = false) Long fileId,@RequestParam(value = "foldelId", required = false) Long folderId); diff --git a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java index 660f034..6cfe2f6 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java @@ -52,15 +52,33 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { private BusinessDataService businessDataService; - @ApiOperation("分页查询文件") - @Override - public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) { - PageHelper.startPage(page, pageSize); - List list = businessDataFileMapper.List(folderId, fileName); - Page p = (Page) list; - PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); - return pageBean; - } +// @ApiOperation("分页查询文件") +// @Override +// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName) { +// PageHelper.startPage(page, pageSize); +// List list = businessDataFileMapper.List(folderId, fileName); +// Page p = (Page) list; +// PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); +// return pageBean; +// } +// @ApiOperation("分页查询文件") +// @Override +// public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) { +// PageHelper.startPage(page, pageSize); +// List list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder); +// Page p = (Page) list; +// PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); +// return pageBean; +// } + @ApiOperation("分页查询文件") + @Override + public PageBean pageSelect(Integer page, Integer pageSize, Long folderId, String fileName, String sortField, String sortOrder) { + PageHelper.startPage(page, pageSize); + List list = businessDataFileMapper.List(folderId, fileName, sortField, sortOrder); + Page p = (Page) list; + PageBean pageBean = new PageBean(p.getTotal(), p.getResult()); + return pageBean; + } @ApiOperation("删除文件") public Result delete(Long fileId, Long folderId) { //删除数据库数据 @@ -228,7 +246,7 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { byte[] bytes = file.getBytes(); String uploadDir = businessDataService.getPath(folderId); - File uploadedFile = new File(uploadDir + "\\" + file.getOriginalFilename()); + File uploadedFile = new File(uploadDir + "/" + file.getOriginalFilename()); if (uploadedFile.exists()) { return Result.error("文件已存在"); } @@ -238,12 +256,11 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { BusinessDataFileEntity fileEntity = new BusinessDataFileEntity(); fileEntity.setFolderId(folderId); fileEntity.setFileName(file.getOriginalFilename()); - fileEntity.setFilePath(uploadDir + "\\" + file.getOriginalFilename()); + fileEntity.setFilePath(uploadDir + "/" + file.getOriginalFilename()); fileEntity.setFileType(file.getContentType()); fileEntity.setFileSize(file.getSize()/1024); fileEntity.setUploadTime(new Date()); fileEntity.setUploaderId(loginIdAsLong); - System.out.println(uploadDir + "\\" + file.getOriginalFilename()); add(fileEntity); return Result.okM("上传成功"); diff --git a/core/src/main/resources/mapper/BusinessDataFileMapper.xml b/core/src/main/resources/mapper/BusinessDataFileMapper.xml index 3a129f4..c8216b4 100644 --- a/core/src/main/resources/mapper/BusinessDataFileMapper.xml +++ b/core/src/main/resources/mapper/BusinessDataFileMapper.xml @@ -1,6 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from business_data_part_file diff --git a/web/src/main/java/com/dite/znpt/web/controller/BusinessDataFileController.java b/web/src/main/java/com/dite/znpt/web/controller/BusinessDataFileController.java index f838342..a8b3451 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/BusinessDataFileController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/BusinessDataFileController.java @@ -43,15 +43,26 @@ public class BusinessDataFileController { @Resource private BusinessDataFileMapper businessDataFileMapper; - @ApiOperation(value = "分页查询文件", httpMethod = "GET") - @GetMapping("/list") - public Result pageSelect(@RequestParam(defaultValue = "1") Integer page, - @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(defaultValue = "0") Long folderId, - @RequestParam(required = false) String fileName) { - PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName); - return Result.ok(pageBean); - } +// @ApiOperation(value = "分页查询文件", httpMethod = "GET") +// @GetMapping("/list") +// public Result pageSelect(@RequestParam(defaultValue = "1") Integer page, +// @RequestParam(defaultValue = "10") Integer pageSize, +// @RequestParam(defaultValue = "0") Long folderId, +// @RequestParam(required = false) String fileName) { +// PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName); +// return Result.ok(pageBean); +// } + @ApiOperation(value = "分页查询文件", httpMethod = "GET") + @GetMapping("/list") + public Result pageSelect(@RequestParam(defaultValue = "1") Integer page, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(defaultValue = "0") Long folderId, + @RequestParam(required = false) String fileName, + @RequestParam(required = false) String sortField, + @RequestParam(required = false) String sortOrder) { + PageBean pageBean = businessDataFileService.pageSelect(page, pageSize, folderId, fileName, sortField, sortOrder); + return Result.ok(pageBean); + } @ApiOperation(value = "增加文件") @PostMapping("/add") -- 2.34.1 From 2708a02588504263281a3295e7ad3c31ade029e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=BE=B7=E8=B6=85?= <13143889+he-dechao@user.noreply.gitee.com> Date: Tue, 12 Aug 2025 17:20:09 +0800 Subject: [PATCH 10/22] =?UTF-8?q?=E5=87=80=E7=A9=BA=E5=BD=A2=E5=8F=98?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9B=91=E6=B5=8B=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dite/znpt/config/TaskConfig.java | 24 +++ .../domain/entity/VideoMonitorEntity.java | 170 ++++++++++++++++ .../com/dite/znpt/domain/vo/VideoReq.java | 29 +++ .../com/dite/znpt/enums/VideoMonitorEnum.java | 45 +++++ .../znpt/mapper/VideoMonitorEntityMapper.java | 12 ++ .../znpt/service/VideoMonitorService.java | 60 ++++++ .../dite/znpt/service/impl/ClearanceTask.java | 51 +++++ .../service/impl/VideoMonitorServiceImpl.java | 181 ++++++++++++++++++ .../java/com/dite/znpt/util/PythonUtil.java | 49 +++++ .../resources/mapper/VideoMonitorMapper.xml | 53 +++++ .../controller/VideoMonitorController.java | 77 ++++++++ 11 files changed, 751 insertions(+) create mode 100644 core/src/main/java/com/dite/znpt/config/TaskConfig.java create mode 100644 core/src/main/java/com/dite/znpt/domain/entity/VideoMonitorEntity.java create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/VideoReq.java create mode 100644 core/src/main/java/com/dite/znpt/enums/VideoMonitorEnum.java create mode 100644 core/src/main/java/com/dite/znpt/mapper/VideoMonitorEntityMapper.java create mode 100644 core/src/main/java/com/dite/znpt/service/VideoMonitorService.java create mode 100644 core/src/main/java/com/dite/znpt/service/impl/ClearanceTask.java create mode 100644 core/src/main/java/com/dite/znpt/service/impl/VideoMonitorServiceImpl.java create mode 100644 core/src/main/java/com/dite/znpt/util/PythonUtil.java create mode 100644 core/src/main/resources/mapper/VideoMonitorMapper.xml create mode 100644 web/src/main/java/com/dite/znpt/web/controller/VideoMonitorController.java diff --git a/core/src/main/java/com/dite/znpt/config/TaskConfig.java b/core/src/main/java/com/dite/znpt/config/TaskConfig.java new file mode 100644 index 0000000..2726c63 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/config/TaskConfig.java @@ -0,0 +1,24 @@ +package com.dite.znpt.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +/** + * @author hedechao + * @date 2025/8/11 11:02 + * @Description: 形变配置线程 + */ +@Configuration +public class TaskConfig { + @Bean("clearanceExecutor") // 方法返回的对象会被注册成 Bean,名字叫 clearanceExecutor + public ThreadPoolTaskExecutor clearanceExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(2); // 核心线程数 + executor.setMaxPoolSize(4); // 最大线程数 + executor.setQueueCapacity(100); // 队列容量 + executor.setThreadNamePrefix("clearance-"); // 线程名前缀 + executor.initialize(); // 初始化 + return executor; + } +} diff --git a/core/src/main/java/com/dite/znpt/domain/entity/VideoMonitorEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/VideoMonitorEntity.java new file mode 100644 index 0000000..d289d9a --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/entity/VideoMonitorEntity.java @@ -0,0 +1,170 @@ +package com.dite.znpt.domain.entity; + +import cn.hutool.json.JSONObject; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * 视频监测信息 + */ +@ApiModel(description="视频监测信息") +@Schema(description="视频监测信息") +@Data +@TableName(value = "video_monitor") +public class VideoMonitorEntity implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 视频id + */ + @TableId(value = "video_id", type = IdType.ASSIGN_UUID) + @ApiModelProperty(value="视频id") + @Schema(description="视频id") + private String videoId; + + /** + * 项目id + */ + @TableField(value = "project_id") + @ApiModelProperty(value="项目id") + @Schema(description="项目id") + private String projectId; + + /** + * 机组id + */ + @TableField(value = "turbine_id") + @ApiModelProperty(value="机组id") + @Schema(description="机组id") + private String turbineId; + + /** + * 视频名称 + */ + @TableField(value = "video_name") + @ApiModelProperty(value="视频名称") + @Schema(description="视频名称") + private String videoName; + + /** + * 视频路径 + */ + @TableField(value = "video_path") + @ApiModelProperty(value="视频路径") + @Schema(description="视频路径") + private String videoPath; + + /** + * 0 正常 1 已删除 + */ + @TableField(value = "is_deleted") + @ApiModelProperty(value="0 正常 1 已删除") + @Schema(description="0 正常 1 已删除") + private Boolean isDeleted; + + /** + * 0 待审核 1 已上线 2 下线 + */ + @TableField(value = "`status`") + @ApiModelProperty(value="0 待审核 1 已上线 2 下线") + @Schema(description="0 待审核 1 已上线 2 下线") + private Byte status; + + /** + * 预处理后的视频路径 + */ + @TableField(value = "pre_image_path") + @ApiModelProperty(value="预处理后的视频路径") + @Schema(description="预处理后的视频路径") + private String preImagePath; + + /** + * 是否处理,默认0 + */ + @TableField(value = "pre_treatment") + @ApiModelProperty(value="是否处理,默认0") + @Schema(description="是否处理,默认0") + private Boolean preTreatment; + + /** + * 修改人 + */ + @TableField(value = "update_by") + @ApiModelProperty(value="修改人") + @Schema(description="修改人") + private String updateBy; + + /** + * 创建时间 + */ + @TableField(value = "create_time",fill = FieldFill.INSERT) + @ApiModelProperty(value="创建时间") + @Schema(description="创建时间") + private Date createTime; + + /** + * 创建人 + */ + @TableField(value = "create_by") + @ApiModelProperty(value="创建人") + @Schema(description="创建人") + private String createBy; + + /** + * 修改时间 + */ + @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE) + @ApiModelProperty(value="修改时间") + @Schema(description="修改时间") + private Date updateTime; + + /** + * 风速 + */ + @TableField(value = "wind_speed") + @ApiModelProperty(value="风速") + @Schema(description="风速") + private String windSpeed; + + /** + * 转速 + */ + @TableField(value = "rpm") + @ApiModelProperty(value="转速") + @Schema(description="转速") + private String rpm; + + /** + * 检测类型 + */ + @TableField(value = "`type`") + @ApiModelProperty(value="检测类型") + @Schema(description="检测类型") + private String type; + + /** + * 业务扩展字段 + */ + @TableField(value = "extra",typeHandler = JacksonTypeHandler.class) + @ApiModelProperty(value="业务扩展字段") + @Schema(description="业务扩展字段") + private JSONObject extra; + + /** + * 上传时间 + */ + @TableField(value = "upload_time") + @ApiModelProperty(value="上传时间") + @Schema(description="上传时间") + private Date uploadTime; +} \ No newline at end of file diff --git a/core/src/main/java/com/dite/znpt/domain/vo/VideoReq.java b/core/src/main/java/com/dite/znpt/domain/vo/VideoReq.java new file mode 100644 index 0000000..1b146e2 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/VideoReq.java @@ -0,0 +1,29 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author hedechao + * @date 2025/8/8 09:10 + * @Description: + */ +@Data +@ApiModel("视频列表查询实体") +public class VideoReq implements Serializable { + @Serial + private static final long serialVersionUID = 771014582625089979L; + @ApiModelProperty("项目id") + private String projectId; + @ApiModelProperty("视频类型") + private String[] type; + @ApiModelProperty("机组id") + private String turbineId; + @ApiModelProperty("是否已审核,0未审核,1已审核") + private Boolean State; +} + diff --git a/core/src/main/java/com/dite/znpt/enums/VideoMonitorEnum.java b/core/src/main/java/com/dite/znpt/enums/VideoMonitorEnum.java new file mode 100644 index 0000000..4149417 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/enums/VideoMonitorEnum.java @@ -0,0 +1,45 @@ +package com.dite.znpt.enums; + +import cn.hutool.json.JSONObject; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.List; + +@Getter +public enum VideoMonitorEnum { + CLEARANCE("clearance","净空监测"), + DEFORMATION("deformation","形变监测"); + + private final String code; + private final String desc; + + VideoMonitorEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static VideoMonitorEnum getByCode(String code) { + for (VideoMonitorEnum e : VideoMonitorEnum.values()) { + if (e.code.equals(code)) { + return e; + } + } + return null; + } + + public static String getDescByCode(String code) { + VideoMonitorEnum e = getByCode(code); + return null == e ? null : e.desc; + } + + public static List listAll() { + List list = new ArrayList<>(UserStatusEnum.values().length); + for (VideoMonitorEnum e : VideoMonitorEnum.values()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set(e.code, e.desc); + list.add(jsonObject); + } + return list; + } +} diff --git a/core/src/main/java/com/dite/znpt/mapper/VideoMonitorEntityMapper.java b/core/src/main/java/com/dite/znpt/mapper/VideoMonitorEntityMapper.java new file mode 100644 index 0000000..831e9a3 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/mapper/VideoMonitorEntityMapper.java @@ -0,0 +1,12 @@ +package com.dite.znpt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dite.znpt.domain.entity.VideoMonitorEntity; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface VideoMonitorEntityMapper extends BaseMapper { + List selectAllByProjectIdAndPartId(@Param("projectId") String projectId, @Param("partId") String partId); + + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/core/src/main/java/com/dite/znpt/service/VideoMonitorService.java b/core/src/main/java/com/dite/znpt/service/VideoMonitorService.java new file mode 100644 index 0000000..6ef70bb --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/VideoMonitorService.java @@ -0,0 +1,60 @@ +package com.dite.znpt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.dite.znpt.domain.PageResult; +import com.dite.znpt.domain.entity.VideoMonitorEntity; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + *

+ * 视频信息 服务类 + *

+ * + * @author hdc + * @since 2025-08-07 + */ +public interface VideoMonitorService extends IService { + /** + * 批量上传视频 + */ + List uploadBatch(String projectId, + String partId, + String type, + MultipartFile[] files) throws IOException; + + /** + * 单文件上传 + */ + VideoMonitorEntity upload(String projectId, + String partId, + String type, + MultipartFile file) throws IOException; + + /** + * 分页列表 + */ + PageResult page(Integer pageNo, + Integer pageSize, + String projectId, + String partId); + + /** + * 列表 + */ + List list(String projectId, String partId); + + /** + * 删除 + */ + void delete(String videoId); + + /** + * 下载/播放 + */ + void download(String videoId, HttpServletResponse response) throws IOException; + +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/ClearanceTask.java b/core/src/main/java/com/dite/znpt/service/impl/ClearanceTask.java new file mode 100644 index 0000000..1990405 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/impl/ClearanceTask.java @@ -0,0 +1,51 @@ +package com.dite.znpt.service.impl; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.dite.znpt.domain.entity.VideoMonitorEntity; +import com.dite.znpt.enums.FilePathEnum; +import com.dite.znpt.util.PythonUtil; +import lombok.RequiredArgsConstructor; + +import java.io.File; +import java.nio.charset.StandardCharsets; + +@RequiredArgsConstructor +public class ClearanceTask implements Runnable { + + private final String videoAbsolutePath; // 上传后的完整磁盘路径 + private final String outputDir; // 结果目录 + private final String videoId; // 数据库主键,用于更新状态 + private final VideoMonitorServiceImpl service; + + @Override + public void run() { + try { + // 1. 调用 Python(阻塞,但跑在子线程) + PythonUtil.runClearance(videoAbsolutePath,outputDir); + // 2. 更新数据库:status = 已完成 / 预处理成功 + VideoMonitorEntity update = new VideoMonitorEntity(); + update.setVideoId(videoId); + update.setPreTreatment(true); // 或自定义状态字段 + update.setPreImagePath(FilePathEnum.VIDEO.getFileDownPath(outputDir)); + File resultFile = new File(outputDir, "results.json"); + if (!resultFile.exists()) { + throw new IllegalStateException("results.json 不存在"); + } + String jsonStr = FileUtil.readString(resultFile, StandardCharsets.UTF_8); + + // 3. 转成 hutool 的 JSONObject(对应 MySQL 的 JSON 字段) + JSONObject jsonObj = JSONUtil.parseObj(jsonStr); + update.setExtra(jsonObj); + service.updateById(update); + + } catch (Exception e) { + // 失败时可将 status 置为失败 + VideoMonitorEntity update = new VideoMonitorEntity(); + update.setVideoId(videoId); + update.setStatus((byte) -1); // 自定义失败码 + service.updateById(update); + } + } +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/VideoMonitorServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/VideoMonitorServiceImpl.java new file mode 100644 index 0000000..f5aca30 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/impl/VideoMonitorServiceImpl.java @@ -0,0 +1,181 @@ +package com.dite.znpt.service.impl; + +import cn.dev33.satoken.stp.StpUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dite.znpt.constant.Message; +import com.dite.znpt.domain.PageResult; +import com.dite.znpt.domain.entity.VideoMonitorEntity; +import com.dite.znpt.enums.FilePathEnum; +import com.dite.znpt.enums.VideoMonitorEnum; +import com.dite.znpt.exception.ServiceException; +import com.dite.znpt.mapper.VideoMonitorEntityMapper; +import com.dite.znpt.service.ProjectService; +import com.dite.znpt.service.TurbineService; +import com.dite.znpt.service.VideoMonitorService; +import com.google.common.collect.Lists; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.rmi.ServerException; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +/** + *

+ * 视频信息 服务实现类 + *

+ * + * @author hdc + * @since 2025-08-07 + */ +@Service +public class VideoMonitorServiceImpl extends ServiceImpl implements VideoMonitorService { + @Resource + private TurbineService turbineService; + @Autowired + private ProjectService projectService; + @Resource(name = "clearanceExecutor") + private ThreadPoolTaskExecutor clearanceExecutor; + @Override + @Transactional(rollbackFor = Exception.class) + public List uploadBatch(String projectId, + String turbineId, + String type, + MultipartFile[] files) throws IOException { + if (files == null || files.length == 0) { + throw new ServiceException("上传文件为空"); + } + if (Objects.isNull(projectService.detail(projectId))) { + throw new ServiceException(Message.PROJECT_ID_IS_NOT_EXIST); + } + if (StrUtil.isNotBlank(turbineId) && turbineService.getById(turbineId) == null) { + throw new ServiceException(Message.PART_ID_IS_NOT_EXIST); + } + String userId = StpUtil.getLoginIdAsString(); + String dateStr = DateUtil.today(); + String storeDir = FilePathEnum.VIDEO.getFileAbsolutePathPrefix() + + projectId; + if (!turbineId.isEmpty() ) + storeDir+=File.separator+turbineId+ File.separator + dateStr; + else + storeDir+=File.separator + dateStr; + + FileUtil.mkdir(storeDir); + + List list = Lists.newArrayList(); + + for (MultipartFile file : files) { + String original = file.getOriginalFilename(); + String suffix = FileUtil.extName(original); + if (suffix != null && !suffix.equals("mp4")) throw new ServerException("非视频文件"); + String uuid = IdUtil.simpleUUID(); + String fileName = uuid + StrUtil.DOT + suffix; + String absolutePath = storeDir + File.separator + fileName; + + File dest = new File(absolutePath); + file.transferTo(dest); + + VideoMonitorEntity entity = new VideoMonitorEntity(); + entity.setVideoId(uuid); + entity.setProjectId(projectId); + entity.setTurbineId(turbineId); + entity.setVideoName(original); + entity.setVideoPath(FilePathEnum.VIDEO.getFileDownPath(absolutePath)); + entity.setType(type); + entity.setStatus((byte) 0); // 待审核 + entity.setPreTreatment(false); + entity.setIsDeleted(false); + entity.setCreateTime(new Date()); + entity.setUploadTime(new Date()); + entity.setUpdateBy(userId); + entity.setCreateBy(userId); + list.add(entity); + if (type.equals(VideoMonitorEnum.CLEARANCE.getCode())) + clearanceExecutor.execute( + new ClearanceTask(absolutePath, storeDir+File.separator+ type+File.separator+uuid, uuid, this) + ); + else if (type.equals(VideoMonitorEnum.DEFORMATION.getCode())) { + //TODO + } + } + + saveBatch(list); + return list; + } + + @Override + public VideoMonitorEntity upload(String projectId, + String partId, + String type, + MultipartFile file) throws IOException { + return uploadBatch(projectId, partId, type, new MultipartFile[]{file}).get(0); + } + + @Override + public PageResult page(Integer pageNo, + Integer pageSize, + String projectId, + String partId) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.eq(StrUtil.isNotBlank(projectId),VideoMonitorEntity::getProjectId, projectId) + .eq(StrUtil.isNotBlank(partId), VideoMonitorEntity::getTurbineId, partId) + .orderByDesc(VideoMonitorEntity::getCreateTime); + Page page = page(Page.of(pageNo, pageSize), wrapper); + return PageResult.ok(page.getRecords(), page.getTotal()); + } + + @Override + public List list(String projectId, String partId) { + return lambdaQuery() + .eq(StrUtil.isNotBlank(projectId),VideoMonitorEntity::getProjectId, projectId) + .eq(StrUtil.isNotBlank(partId), VideoMonitorEntity::getTurbineId, partId) + .list(); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String videoId) { + VideoMonitorEntity entity = getById(videoId); + if (Objects.isNull(entity)) { + throw new ServiceException("视频不存在"); + } + entity.setIsDeleted(true); + entity.setUpdateBy(StpUtil.getLoginIdAsString()); + updateById(entity); + // 物理删除文件 + FileUtil.del(FilePathEnum.VIDEO.getFileAbsolutePath(entity.getVideoPath())); + } + + @Override + public void download(String videoId, HttpServletResponse response) throws IOException { + VideoMonitorEntity entity = getById(videoId); + if (entity == null || Boolean.TRUE.equals(entity.getIsDeleted())) { + throw new ServiceException("视频不存在或已删除"); + } + File file = new File(FilePathEnum.VIDEO.getFileAbsolutePath(entity.getVideoPath())); + if (!file.exists()) { + throw new ServiceException("视频文件不存在"); + } + response.setContentType("video/mp4"); + response.setHeader("Content-Disposition", + "inline; filename=" + URLEncoder.encode(entity.getVideoName(), StandardCharsets.UTF_8)); + FileUtil.writeToStream(file, response.getOutputStream()); + } +} diff --git a/core/src/main/java/com/dite/znpt/util/PythonUtil.java b/core/src/main/java/com/dite/znpt/util/PythonUtil.java new file mode 100644 index 0000000..a4329ea --- /dev/null +++ b/core/src/main/java/com/dite/znpt/util/PythonUtil.java @@ -0,0 +1,49 @@ +package com.dite.znpt.util; + +import cn.hutool.extra.spring.SpringUtil; +import org.springframework.core.env.Environment; + +import java.io.IOException; + +/** + * @author hedechao + * @Date 2025/8/11 09:04 + * @Description: 形变python脚本执行工具 + */ +public class PythonUtil { + /** + * 调用叶片净空计算脚本 + * + * @param videoPath 待检测视频路径 + * @throws IOException 如果启动进程失败 + * @throws InterruptedException 如果等待进程完成被中断 + */ + public static void runClearance( + String videoPath, + String outputPath + ) throws IOException, InterruptedException { + String pyScriptPath=SpringUtil.getBean(Environment.class).getProperty("pyScript.clearance"); + String modelPath=SpringUtil.getBean(Environment.class).getProperty("model.tip-hub"); + // 1. 构造命令 + ProcessBuilder pb = new ProcessBuilder( + "python", // 也可以是 python3 / 绝对路径 + pyScriptPath, + "--video_path=" + videoPath, + "--model_path=" + modelPath, + "--output_dir=" + outputPath + ); + + // 2. 把子进程的标准输出 / 错误流重定向到 Java 控制台(可选) + pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); + pb.redirectError(ProcessBuilder.Redirect.INHERIT); + + // 3. 启动进程并等待完成 + Process process = pb.start(); + int exitCode = process.waitFor(); + if (exitCode != 0) { + throw new RuntimeException("脚本返回非 0 状态码: " + exitCode); + } + + System.out.println("净空计算完成,结果已保存到: " + outputPath); + } +} diff --git a/core/src/main/resources/mapper/VideoMonitorMapper.xml b/core/src/main/resources/mapper/VideoMonitorMapper.xml new file mode 100644 index 0000000..9f6741e --- /dev/null +++ b/core/src/main/resources/mapper/VideoMonitorMapper.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + video_id, project_id, part_id, video_name, video_path, is_deleted, `status`, pre_image_path, + pre_treatment, update_by, create_time, create_by, update_time, wind_speed, rpm, `type`, + extra, upload_time + + + + + insert into video_monitor + (project_id, part_id, video_name, video_path, is_deleted, `status`, pre_image_path, + pre_treatment, update_by, create_time, create_by, update_time, wind_speed, rpm, + `type`, extra, upload_time) + values + + (#{item.projectId}, #{item.partId}, #{item.videoName}, #{item.videoPath}, #{item.isDeleted}, + #{item.status}, #{item.preImagePath}, #{item.preTreatment}, #{item.updateBy}, #{item.createTime}, + #{item.createBy}, #{item.updateTime}, #{item.windSpeed}, #{item.rpm}, #{item.type}, + #{item.extra}, #{item.uploadTime}) + + + \ No newline at end of file diff --git a/web/src/main/java/com/dite/znpt/web/controller/VideoMonitorController.java b/web/src/main/java/com/dite/znpt/web/controller/VideoMonitorController.java new file mode 100644 index 0000000..845fb61 --- /dev/null +++ b/web/src/main/java/com/dite/znpt/web/controller/VideoMonitorController.java @@ -0,0 +1,77 @@ +package com.dite.znpt.web.controller; + +import com.dite.znpt.domain.PageResult; +import com.dite.znpt.domain.Result; +import com.dite.znpt.domain.entity.VideoMonitorEntity; +import com.dite.znpt.service.VideoMonitorService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; + +/** + * @author hedechao + * @date 2025/8/8 17:15 + * @Description: + */ +@Api(tags = "视频监测") +@RestController +@RequestMapping("/video-monitor") +@RequiredArgsConstructor +public class VideoMonitorController { +@Resource + VideoMonitorService videoService; + + @ApiOperation("分页查询") + @GetMapping("/page") + public PageResult page(@RequestParam(defaultValue = "1") Integer pageNo, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam String projectId, + @RequestParam(required = false) String turbineId) { + return videoService.page(pageNo, pageSize, projectId, turbineId); + } + + @ApiOperation("列表查询") + @GetMapping("/list") + public Result> list(@RequestParam(required = false) String projectId, + @RequestParam(required = false) String turbineId) { + return Result.ok(videoService.list(projectId, turbineId)); + } + + @ApiOperation("批量上传") + @PostMapping("/{projectId}/upload-batch") + public Result> uploadBatch(@PathVariable String projectId, + @RequestParam(required = false) String turbineId, + @RequestParam String type, + @RequestParam("files") MultipartFile[] files) throws IOException { + return Result.ok(videoService.uploadBatch(projectId, turbineId, type, files)); + } + + @ApiOperation("单文件上传") + @PostMapping("/{projectId}/upload") + public Result upload(@PathVariable String projectId, + @RequestParam(required = false) String turbineId, + @RequestParam String type, + @RequestParam("file") MultipartFile file) throws IOException { + return Result.ok(videoService.upload(projectId, turbineId, type, file)); + } + + @ApiOperation("删除") + @DeleteMapping("/{videoId}") + public Result delete(@PathVariable String videoId) { + videoService.delete(videoId); + return Result.ok(); + } + + @ApiOperation("下载/播放") + @GetMapping("/download/{videoId}") + public void download(@PathVariable String videoId, HttpServletResponse response) throws IOException { + videoService.download(videoId, response); + } +} -- 2.34.1 From 19e9bb7978255689e2f16abaaabf86f03196ac35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=BE=B7=E8=B6=85?= <13143889+he-dechao@user.noreply.gitee.com> Date: Tue, 12 Aug 2025 17:21:49 +0800 Subject: [PATCH 11/22] =?UTF-8?q?=E5=87=80=E7=A9=BA=E5=BD=A2=E5=8F=98?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=9B=91=E6=B5=8B=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/src/main/resources/mapper/VideoMonitorMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/mapper/VideoMonitorMapper.xml b/core/src/main/resources/mapper/VideoMonitorMapper.xml index 9f6741e..37a7f78 100644 --- a/core/src/main/resources/mapper/VideoMonitorMapper.xml +++ b/core/src/main/resources/mapper/VideoMonitorMapper.xml @@ -44,7 +44,7 @@ `type`, extra, upload_time) values - (#{item.projectId}, #{item.partId}, #{item.videoName}, #{item.videoPath}, #{item.isDeleted}, + (#{item.projectId}, #{item.turbineId}, #{item.videoName}, #{item.videoPath}, #{item.isDeleted}, #{item.status}, #{item.preImagePath}, #{item.preTreatment}, #{item.updateBy}, #{item.createTime}, #{item.createBy}, #{item.updateTime}, #{item.windSpeed}, #{item.rpm}, #{item.type}, #{item.extra}, #{item.uploadTime}) -- 2.34.1 From 53aa75d37bdcab8fb706f8abe8337cba44a947a1 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Tue, 12 Aug 2025 17:43:12 +0800 Subject: [PATCH 12/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E6=97=A0=E6=B3=95=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=92=8C=E6=AD=A3=E7=A1=AE=E8=8E=B7=E5=8F=96=E6=80=BB=E9=A1=B5?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EquipmentApprovalServiceImpl.java | 52 +++- .../service/impl/EquipmentServiceImpl.java | 225 +++++------------- .../impl/EquipmentUseRecordServiceImpl.java | 7 +- 3 files changed, 108 insertions(+), 176 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java index 480734d..3ef83e0 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java @@ -11,7 +11,9 @@ import com.dite.znpt.domain.vo.EquipmentApprovalResp; import com.dite.znpt.domain.vo.EquipmentProcurementApplyReq; import com.dite.znpt.service.EquipmentApprovalService; import com.dite.znpt.service.EquipmentStatusUpdateService; +import com.dite.znpt.util.PageUtil; import com.dite.znpt.websocket.SimpleWebSocketHandler; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -41,10 +43,10 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { @Override public IPage getPendingApprovals(EquipmentApprovalListReq req) { - // 创建分页对象,处理null值 - Integer pageNum = req.getPage() != null ? req.getPage() : 1; - Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; - Page page = new Page<>(pageNum, pageSize); + log.info("开始执行待审批设备分页查询,请求参数: {}", req); + + // 使用分页插件 + PageUtil.startPage(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(EquipmentApprovalEntity::getApprovalStatus, "PENDING"); @@ -52,17 +54,30 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { // 添加查询条件 addQueryConditions(wrapper, req); - IPage result = equipmentApprovalMapper.selectPage(page, wrapper); + // 执行查询 + List approvalList = equipmentApprovalMapper.selectList(wrapper); - return convertToRespPage(result); + // 转换为响应对象 + List respList = approvalList.stream() + .map(this::convertToResp) + .collect(Collectors.toList()); + + // 获取分页信息 + PageInfo pageInfo = new PageInfo<>(respList); + + // 创建响应分页对象 + Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + result.setRecords(respList); + + return result; } @Override public IPage getApprovedApprovals(EquipmentApprovalListReq req) { - // 创建分页对象,处理null值 - Integer pageNum = req.getPage() != null ? req.getPage() : 1; - Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; - Page page = new Page<>(pageNum, pageSize); + log.info("开始执行已审批设备分页查询,请求参数: {}", req); + + // 使用分页插件 + PageUtil.startPage(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.in(EquipmentApprovalEntity::getApprovalStatus, "APPROVED", "REJECTED"); @@ -70,9 +85,22 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { // 添加查询条件 addQueryConditions(wrapper, req); - IPage result = equipmentApprovalMapper.selectPage(page, wrapper); + // 执行查询 + List approvalList = equipmentApprovalMapper.selectList(wrapper); - return convertToRespPage(result); + // 转换为响应对象 + List respList = approvalList.stream() + .map(this::convertToResp) + .collect(Collectors.toList()); + + // 获取分页信息 + PageInfo pageInfo = new PageInfo<>(respList); + + // 创建响应分页对象 + Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + result.setRecords(respList); + + return result; } @Override diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index ebaac5c..b30a5d4 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -16,6 +16,8 @@ import com.dite.znpt.enums.LocationStatusEnum; import com.dite.znpt.exception.ServiceException; import com.dite.znpt.mapper.EquipmentMapper; import com.dite.znpt.service.EquipmentService; +import com.dite.znpt.util.PageUtil; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -38,10 +40,8 @@ public class EquipmentServiceImpl extends ServiceImpl page(EquipmentListReq req) { log.info("开始执行设备分页查询,请求参数: {}", req); - // 创建分页对象,处理null值 - Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1); - Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; - Page page = new Page<>(pageNum, pageSize); + // 使用分页插件 + PageUtil.startPage(); // 构建查询条件 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -117,9 +117,14 @@ public class EquipmentServiceImpl extends ServiceImpl equipmentPage = this.page(page, queryWrapper); + // 执行查询 + List equipmentList = this.list(queryWrapper); - log.info("查询完成,总记录数: {}, 当前页记录数: {}", equipmentPage.getTotal(), equipmentPage.getRecords().size()); + log.info("查询完成,当前页记录数: {}", equipmentList.size()); // 转换为响应对象 - List equipmentRespList = equipmentPage.getRecords().stream() + List equipmentRespList = equipmentList.stream() .map(this::convertToResp) .collect(Collectors.toList()); + // 获取分页信息 + PageInfo pageInfo = new PageInfo<>(equipmentRespList); + // 创建响应分页对象 - Page respPage = new Page<>(equipmentPage.getCurrent(), equipmentPage.getSize(), equipmentPage.getTotal()); + Page respPage = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); respPage.setRecords(equipmentRespList); return respPage; @@ -597,10 +498,8 @@ public class EquipmentServiceImpl extends ServiceImpl procurementPage(EquipmentListReq req) { log.info("开始执行设备采购记录分页查询,请求参数: {}", req); - // 创建分页对象,处理null值 - Integer pageNum = req.getPage() != null ? req.getPage() : (req.getPageNum() != null ? req.getPageNum() : 1); - Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; - Page page = new Page<>(pageNum, pageSize); + // 使用分页插件 + PageUtil.startPage(); // 构建查询条件,参考设备分页查询的逻辑 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); @@ -624,14 +523,9 @@ public class EquipmentServiceImpl extends ServiceImpl result = this.page(page, queryWrapper); + List equipmentList = this.list(queryWrapper); // 转换为响应对象 - List records = result.getRecords().stream() + List records = equipmentList.stream() .map(this::convertToResp) .collect(Collectors.toList()); - // 创建新的分页结果 - Page respPage = new Page<>(result.getCurrent(), result.getSize(), result.getTotal()); - respPage.setRecords(records); + // 获取分页信息 + PageInfo pageInfo = new PageInfo<>(records); - log.info("设备采购记录分页查询完成,总记录数: {}", result.getTotal()); - return respPage; + // 创建响应分页对象 + Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + result.setRecords(records); + + return result; } @Transactional(rollbackFor = Exception.class) diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java index 33e7555..4df621a 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentUseRecordServiceImpl.java @@ -50,8 +50,13 @@ public class EquipmentUseRecordServiceImpl extends ServiceImpl page(EquipmentUseRecordListReq req) { + // 使用分页插件 PageUtil.startPage(); - return this.list(req); + + // 执行查询 + List result = this.list(req); + + return result; } @Override -- 2.34.1 From 86ce3a6a2f89d66e8449bdcab828ed85382ef921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Tue, 12 Aug 2025 17:57:54 +0800 Subject: [PATCH 13/22] =?UTF-8?q?8-12=20=E6=9F=A5=E8=AF=A2=E6=89=80?= =?UTF-8?q?=E6=9C=89=E6=9C=AA=E7=AB=8B=E9=A1=B9=E5=90=88=E5=90=8C=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=A1=B9=E7=9B=AE=E6=97=B6=E5=8F=AF=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E9=80=89=E6=8B=A9=E5=AF=B9=E5=BA=94=E5=90=88=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/web/controller/ProjectController.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java index 4136c4b..c7e1806 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java @@ -4,9 +4,11 @@ package com.dite.znpt.web.controller; import cn.dev33.satoken.stp.StpUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dite.znpt.constant.Constants; +import com.dite.znpt.domain.entity.ContractEntity; import com.dite.znpt.domain.entity.EquipmentEntity; import com.dite.znpt.domain.vo.*; import com.dite.znpt.domain.entity.ProjectEntity; +import com.dite.znpt.service.ContractService; import com.dite.znpt.service.EquipmentService; import com.dite.znpt.service.ProjectService; import com.dite.znpt.domain.Result; @@ -38,6 +40,9 @@ public class ProjectController { @Resource private EquipmentService equipmentService; + @Resource + private ContractService contractService; + @ApiOperation(value = "分页查询项目信息列表", httpMethod = "GET") @GetMapping("/page") public PageResult page(ProjectListReq req) { @@ -112,4 +117,13 @@ public class ProjectController { queryWrapper.eq("project_id", projectId); return Result.ok(equipmentService.list(queryWrapper)); } + + @ApiOperation(value = "查询未立项的合同列表", httpMethod = "GET") + @GetMapping("/contracts") + public Result> contracts() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.isNull("project_id"); + return Result.ok(contractService.list(queryWrapper)); + } + } \ No newline at end of file -- 2.34.1 From e19d8490459ba62a93dcc159fc14c56f7945d301 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Wed, 13 Aug 2025 09:28:41 +0800 Subject: [PATCH 14/22] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E8=A1=A8=E6=A0=BC=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E9=A1=BA=E5=88=A9=E4=B8=8B=E6=8B=89=E5=92=8C=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=9D=A1=E4=B8=8D=E5=9B=BA=E5=AE=9A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/vo/EquipmentApprovalListReq.java | 3 ++ .../impl/EquipmentApprovalServiceImpl.java | 32 +++++++++++++--- .../service/impl/EquipmentServiceImpl.java | 38 +++++++++++++------ 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentApprovalListReq.java b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentApprovalListReq.java index 39b5833..55cae55 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentApprovalListReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentApprovalListReq.java @@ -43,6 +43,9 @@ public class EquipmentApprovalListReq implements Serializable { @ApiModelProperty("当前页码") private Integer page; + @ApiModelProperty("当前页码 - 与前端保持一致") + private Integer pageNum; + @ApiModelProperty("每页大小") private Integer pageSize; diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java index 3ef83e0..99636dd 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentApprovalServiceImpl.java @@ -45,6 +45,12 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { public IPage getPendingApprovals(EquipmentApprovalListReq req) { log.info("开始执行待审批设备分页查询,请求参数: {}", req); + // 获取分页参数 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; + Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; + + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + // 使用分页插件 PageUtil.startPage(); @@ -63,10 +69,12 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { .collect(Collectors.toList()); // 获取分页信息 - PageInfo pageInfo = new PageInfo<>(respList); + PageInfo pageInfo = new PageInfo<>(approvalList); + + log.info("待审批设备分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages()); // 创建响应分页对象 - Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + Page result = new Page<>(pageNum, pageSize, pageInfo.getTotal()); result.setRecords(respList); return result; @@ -76,6 +84,12 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { public IPage getApprovedApprovals(EquipmentApprovalListReq req) { log.info("开始执行已审批设备分页查询,请求参数: {}", req); + // 获取分页参数 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; + Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; + + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + // 使用分页插件 PageUtil.startPage(); @@ -94,10 +108,12 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { .collect(Collectors.toList()); // 获取分页信息 - PageInfo pageInfo = new PageInfo<>(respList); + PageInfo pageInfo = new PageInfo<>(approvalList); + + log.info("已审批设备分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages()); // 创建响应分页对象 - Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + Page result = new Page<>(pageNum, pageSize, pageInfo.getTotal()); result.setRecords(respList); return result; @@ -484,11 +500,13 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { public IPage getMyProcurementApplications(EquipmentApprovalListReq req) { log.info("开始获取我的采购申请,请求参数: {}", req); - // 创建分页对象 - Integer pageNum = req.getPage() != null ? req.getPage() : 1; + // 创建分页对象 - 使用pageNum保持一致性 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; Page page = new Page<>(pageNum, pageSize); + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); // 只查询当前用户的申请 @@ -500,6 +518,8 @@ public class EquipmentApprovalServiceImpl implements EquipmentApprovalService { IPage result = equipmentApprovalMapper.selectPage(page, wrapper); + log.info("我的采购申请分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", result.getTotal(), result.getCurrent(), result.getPages()); + return convertToRespPage(result); } diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index b30a5d4..f7d6185 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -40,6 +40,12 @@ public class EquipmentServiceImpl extends ServiceImpl page(EquipmentListReq req) { log.info("开始执行设备分页查询,请求参数: {}", req); + // 获取分页参数 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; + Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; + + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + // 使用分页插件 PageUtil.startPage(); @@ -261,18 +267,20 @@ public class EquipmentServiceImpl extends ServiceImpl equipmentList = this.list(queryWrapper); - log.info("查询完成,当前页记录数: {}", equipmentList.size()); - + log.info("查询完成,当前页记录数: {}, 总记录数: {}", + equipmentList.size()); + // 转换为响应对象 List equipmentRespList = equipmentList.stream() .map(this::convertToResp) .collect(Collectors.toList()); - // 获取分页信息 - PageInfo pageInfo = new PageInfo<>(equipmentRespList); - - // 创建响应分页对象 - Page respPage = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + // 获取分页信息 - 使用正确的实体类型 + PageInfo pageInfo = new PageInfo<>(equipmentList); + + log.info("获取总数: {}", pageInfo.getTotal()); + // 创建响应分页对象 - 使用正确的分页参数 + Page respPage = new Page<>(pageNum, pageSize, pageInfo.getTotal()); respPage.setRecords(equipmentRespList); return respPage; @@ -498,6 +506,12 @@ public class EquipmentServiceImpl extends ServiceImpl procurementPage(EquipmentListReq req) { log.info("开始执行设备采购记录分页查询,请求参数: {}", req); + // 获取分页参数 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; + Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; + + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + // 使用分页插件 PageUtil.startPage(); @@ -617,11 +631,13 @@ public class EquipmentServiceImpl extends ServiceImpl pageInfo = new PageInfo<>(records); + // 获取分页信息 - 使用正确的实体类型 + PageInfo pageInfo = new PageInfo<>(equipmentList); - // 创建响应分页对象 - Page result = new Page<>(pageInfo.getPageNum(), pageInfo.getPageSize(), pageInfo.getTotal()); + log.info("设备采购分页查询完成,共查询 {} 条记录,当前页码: {}, 总页码: {}", pageInfo.getTotal(), pageInfo.getPageNum(), pageInfo.getPages()); + + // 创建响应分页对象 - 使用正确的分页参数 + Page result = new Page<>(pageNum, pageSize, pageInfo.getTotal()); result.setRecords(records); return result; -- 2.34.1 From f500082ea6adfc0ae6c4bc6ae23fbf9a2f2b746a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 10:08:35 +0800 Subject: [PATCH 15/22] =?UTF-8?q?8-13=20=E9=A1=B9=E7=9B=AE=E7=AB=8B?= =?UTF-8?q?=E9=A1=B9=E6=97=B6=E4=BD=BF=E5=90=88=E5=90=8C=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=85=B3=E8=81=94=E8=AF=A5=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dite/znpt/service/impl/ProjectServiceImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java index 38d8b40..198ec2e 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java @@ -3,9 +3,11 @@ package com.dite.znpt.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dite.znpt.constant.Message; import com.dite.znpt.converts.Converts; +import com.dite.znpt.domain.entity.ContractEntity; import com.dite.znpt.domain.entity.ProjectEntity; import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.domain.entity.UserEntity; @@ -16,12 +18,14 @@ import com.dite.znpt.domain.vo.ProjectReq; import com.dite.znpt.domain.vo.ProjectResp; import com.dite.znpt.enums.ProjectStatusEnum; import com.dite.znpt.exception.ServiceException; +import com.dite.znpt.mapper.ContractMapper; import com.dite.znpt.mapper.ProjectMapper; import com.dite.znpt.service.ProjectService; import com.dite.znpt.service.UserService; import com.dite.znpt.service.ProjectTaskService; import com.dite.znpt.util.PageUtil; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -47,6 +51,9 @@ public class ProjectServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("contract_code", req.getProjectOrigin()); + ContractEntity contractEntity = contractMapper.selectOne(queryWrapper); + contractEntity.setProjectId(entity.getProjectId()); + contractMapper.updateById(contractEntity); for (ProjectInitTaskReq taskReq : req.getTasks()) { ProjectTaskEntity taskEntity = BeanUtil.copyProperties(taskReq, ProjectTaskEntity.class); if (taskEntity.getScales() == null) { -- 2.34.1 From 36720e7a3880a47d6b3fe69245d5c98cf9d49711 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Wed, 13 Aug 2025 10:19:30 +0800 Subject: [PATCH 16/22] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=9B=98=E5=BA=93=E7=9A=84=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dite/znpt/service/EquipmentService.java | 15 +++ .../service/impl/EquipmentServiceImpl.java | 117 +++++++++++++++++- .../web/controller/EquipmentController.java | 31 +++++ 3 files changed, 158 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/service/EquipmentService.java b/core/src/main/java/com/dite/znpt/service/EquipmentService.java index 0f7a604..0697362 100644 --- a/core/src/main/java/com/dite/znpt/service/EquipmentService.java +++ b/core/src/main/java/com/dite/znpt/service/EquipmentService.java @@ -72,4 +72,19 @@ public interface EquipmentService extends IService { * 修改设备采购记录 */ void updateProcurement(String equipmentId, EquipmentReq req); + + /** + * 分页查询设备盘库记录 + */ + IPage inventoryPage(EquipmentListReq req); + + /** + * 执行设备盘库 + */ + void executeInventory(String equipmentId, String inventoryResult, String remark); + + /** + * 批量执行设备盘库 + */ + void batchExecuteInventory(List equipmentIds, String inventoryResult, String remark); } diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index f7d6185..bcee3bb 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -673,11 +673,12 @@ public class EquipmentServiceImpl extends ServiceImpl inventoryPage(EquipmentListReq req) { + log.info("开始执行设备盘库分页查询,请求参数: {}", req); + + // 获取分页参数 + Integer pageNum = req.getPageNum() != null ? req.getPageNum() : 1; + Integer pageSize = req.getPageSize() != null ? req.getPageSize() : 10; + + log.info("分页参数 - pageNum: {}, pageSize: {}", pageNum, pageSize); + + // 使用分页插件 + PageUtil.startPage(); + + // 构建查询条件 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + // 添加搜索条件 + if (StringUtils.hasText(req.getEquipmentName())) { + queryWrapper.like(EquipmentEntity::getEquipmentName, req.getEquipmentName()); + } + if (StringUtils.hasText(req.getEquipmentType())) { + queryWrapper.eq(EquipmentEntity::getEquipmentType, req.getEquipmentType()); + } + if (StringUtils.hasText(req.getAssetCode())) { + queryWrapper.like(EquipmentEntity::getAssetCode, req.getAssetCode()); + } + if (StringUtils.hasText(req.getBrand())) { + queryWrapper.like(EquipmentEntity::getBrand, req.getBrand()); + } + if (StringUtils.hasText(req.getLocationStatus())) { + queryWrapper.eq(EquipmentEntity::getLocationStatus, req.getLocationStatus()); + } + if (StringUtils.hasText(req.getResponsiblePerson())) { + queryWrapper.like(EquipmentEntity::getResponsiblePerson, req.getResponsiblePerson()); + } + if (StringUtils.hasText(req.getInventoryBarcode())) { + queryWrapper.like(EquipmentEntity::getInventoryBarcode, req.getInventoryBarcode()); + } + + // 按创建时间倒序排列 + queryWrapper.orderByDesc(EquipmentEntity::getCreateTime); + + // 执行查询 + IPage page = this.page(new Page<>(pageNum, pageSize), queryWrapper); + + // 转换为响应对象 + IPage result = page.convert(this::convertToResp); + + log.info("设备盘库分页查询完成,总记录数: {}, 当前页记录数: {}", result.getTotal(), result.getRecords().size()); + + return result; + } + + @Override + public void executeInventory(String equipmentId, String inventoryResult, String remark) { + log.info("执行设备盘库,设备ID: {}, 盘点结果: {}, 备注: {}", equipmentId, inventoryResult, remark); + + // 验证设备是否存在 + EquipmentEntity equipment = this.getById(equipmentId); + if (equipment == null) { + throw new ServiceException("设备不存在"); + } + + // 更新盘点状态 + EquipmentEntity updateEquipment = new EquipmentEntity(); + updateEquipment.setEquipmentId(equipmentId); + updateEquipment.setInventoryTimeStatus1(LocalDateTime.now().toString() + "_" + inventoryResult); + updateEquipment.setDynamicRecord(remark); + + // 保存更新 + boolean success = this.updateById(updateEquipment); + if (!success) { + throw new ServiceException("执行设备盘库失败"); + } + + log.info("设备盘库执行成功,设备ID: {}", equipmentId); + } + + @Override + public void batchExecuteInventory(List equipmentIds, String inventoryResult, String remark) { + log.info("批量执行设备盘库,设备ID列表: {}, 盘点结果: {}, 备注: {}", equipmentIds, inventoryResult, remark); + + if (equipmentIds == null || equipmentIds.isEmpty()) { + throw new ServiceException("设备ID列表不能为空"); + } + + // 批量更新盘点状态 + List updateList = equipmentIds.stream() + .map(equipmentId -> { + EquipmentEntity equipment = new EquipmentEntity(); + equipment.setEquipmentId(equipmentId); + equipment.setInventoryTimeStatus1(LocalDateTime.now().toString() + "_" + inventoryResult); + equipment.setDynamicRecord(remark); + return equipment; + }) + .collect(Collectors.toList()); + + // 批量更新 + boolean success = this.updateBatchById(updateList); + if (!success) { + throw new ServiceException("批量执行设备盘库失败"); + } + + log.info("批量设备盘库执行成功,处理设备数量: {}", equipmentIds.size()); + } } diff --git a/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java b/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java index bbfdccb..8da84ae 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java @@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * @author Bear.G @@ -103,6 +104,36 @@ public class EquipmentController { return Result.ok(); } + @ApiOperation(value = "分页查询设备盘库记录", httpMethod = "GET") + @GetMapping("/inventory/page") + public PageResult inventoryPage(EquipmentListReq req) { + log.info("=== 设备盘库记录查询接口被调用 ==="); + log.info("接收到的请求参数: {}", req); + + IPage page = equipmentService.inventoryPage(req); + return PageResult.ok(page.getRecords(), page.getTotal()); + } + + @ApiOperation(value = "执行设备盘库", httpMethod = "POST") + @PostMapping("/inventory/{equipmentId}") + public Result executeInventory( + @PathVariable String equipmentId, + @RequestParam String inventoryResult, + @RequestParam(required = false) String remark) { + equipmentService.executeInventory(equipmentId, inventoryResult, remark); + return Result.ok(); + } + + @ApiOperation(value = "批量执行设备盘库", httpMethod = "POST") + @PostMapping("/inventory/batch") + public Result batchExecuteInventory( + @RequestParam List equipmentIds, + @RequestParam String inventoryResult, + @RequestParam(required = false) String remark) { + equipmentService.batchExecuteInventory(equipmentIds, inventoryResult, remark); + return Result.ok(); + } + @ApiOperation(value = "获取采购统计信息", httpMethod = "GET") @GetMapping("/procurement/stats") public Result getProcurementStats(){ -- 2.34.1 From 9585f6dd3995b3502e2f1169eba13d1863e9e767 Mon Sep 17 00:00:00 2001 From: wangna0328 <3402195679@qq.com> Date: Wed, 13 Aug 2025 14:39:15 +0800 Subject: [PATCH 17/22] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=94=98=E7=89=B9?= =?UTF-8?q?=E5=9B=BE=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E8=AE=BE=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dite/znpt/domain/vo/GanttChartReq.java | 45 ++ .../dite/znpt/domain/vo/GanttChartResp.java | 91 ++++ .../dite/znpt/mapper/ProjectTaskMapper.java | 2 + .../dite/znpt/service/GanttChartService.java | 55 ++ .../service/impl/GanttChartServiceImpl.java | 486 ++++++++++++++++++ .../web/controller/GanttChartController.java | 61 +++ 6 files changed, 740 insertions(+) create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/GanttChartReq.java create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/GanttChartResp.java create mode 100644 core/src/main/java/com/dite/znpt/service/GanttChartService.java create mode 100644 core/src/main/java/com/dite/znpt/service/impl/GanttChartServiceImpl.java create mode 100644 web/src/main/java/com/dite/znpt/web/controller/GanttChartController.java diff --git a/core/src/main/java/com/dite/znpt/domain/vo/GanttChartReq.java b/core/src/main/java/com/dite/znpt/domain/vo/GanttChartReq.java new file mode 100644 index 0000000..7e96367 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/GanttChartReq.java @@ -0,0 +1,45 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; + +/** + * 甘特图查询请求类 + */ +@Data +@ApiModel(value = "GanttChartReq", description = "甘特图查询请求") +public class GanttChartReq { + + @ApiModelProperty("项目ID") + private String projectId; + + @ApiModelProperty("任务组ID") + private String taskGroupId; + + @ApiModelProperty("任务状态") + private Integer status; + + @ApiModelProperty("负责人ID") + private String mainUserId; + + @ApiModelProperty("开始时间范围-开始") + private LocalDate startDateFrom; + + @ApiModelProperty("开始时间范围-结束") + private LocalDate startDateTo; + + @ApiModelProperty("结束时间范围-开始") + private LocalDate endDateFrom; + + @ApiModelProperty("结束时间范围-结束") + private LocalDate endDateTo; + + @ApiModelProperty("是否包含已完成任务") + private Boolean includeCompleted = true; + + @ApiModelProperty("是否只显示逾期任务") + private Boolean overdueOnly = false; +} diff --git a/core/src/main/java/com/dite/znpt/domain/vo/GanttChartResp.java b/core/src/main/java/com/dite/znpt/domain/vo/GanttChartResp.java new file mode 100644 index 0000000..69e38a0 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/GanttChartResp.java @@ -0,0 +1,91 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDate; +import java.util.List; + +/** + * 甘特图数据响应类 + */ +@Data +@ApiModel(value = "GanttChartResp", description = "甘特图数据响应") +public class GanttChartResp { + + @ApiModelProperty("任务ID") + private String taskId; + + @ApiModelProperty("任务名称") + private String taskName; + + @ApiModelProperty("任务编号") + private String taskCode; + + @ApiModelProperty("上级任务ID") + private String parentTaskId; + + @ApiModelProperty("任务组ID") + private String taskGroupId; + + @ApiModelProperty("任务组名称") + private String taskGroupName; + + @ApiModelProperty("计划开始时间") + private LocalDate planStartDate; + + @ApiModelProperty("计划结束时间") + private LocalDate planEndDate; + + @ApiModelProperty("实际开始时间") + private LocalDate actualStartDate; + + @ApiModelProperty("实际结束时间") + private LocalDate actualEndDate; + + @ApiModelProperty("任务状态:0未开始,1进行中,2已结束") + private Integer status; + + @ApiModelProperty("任务状态描述") + private String statusDesc; + + @ApiModelProperty("是否逾期:0未逾期,1已逾期") + private Integer overdueStatus; + + @ApiModelProperty("任务负责人ID") + private String mainUserId; + + @ApiModelProperty("任务负责人姓名") + private String mainUserName; + + @ApiModelProperty("任务参与人") + private String userIds; + + @ApiModelProperty("任务参与人姓名列表") + private List participantNames; + + @ApiModelProperty("进度百分比") + private Integer progress; + + @ApiModelProperty("任务层级") + private Integer level; + + @ApiModelProperty("任务在时间轴上的位置(天数)") + private Integer position; + + @ApiModelProperty("任务持续时间(天数)") + private Integer duration; + + @ApiModelProperty("子任务列表") + private List children; + + @ApiModelProperty("任务备注") + private String remark; + + @ApiModelProperty("项目ID") + private String projectId; + + @ApiModelProperty("项目名称") + private String projectName; +} diff --git a/core/src/main/java/com/dite/znpt/mapper/ProjectTaskMapper.java b/core/src/main/java/com/dite/znpt/mapper/ProjectTaskMapper.java index afb1d09..4101f84 100644 --- a/core/src/main/java/com/dite/znpt/mapper/ProjectTaskMapper.java +++ b/core/src/main/java/com/dite/znpt/mapper/ProjectTaskMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.domain.vo.ProjectTaskListReq; import com.dite.znpt.domain.vo.ProjectTaskResp; +import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -13,6 +14,7 @@ import java.util.List; * @date 2025/06/24 16:44 * @Description: 项目任务信息表数据库访问层 */ +@Mapper public interface ProjectTaskMapper extends BaseMapper { List queryBySelective(ProjectTaskListReq projectTaskReq); diff --git a/core/src/main/java/com/dite/znpt/service/GanttChartService.java b/core/src/main/java/com/dite/znpt/service/GanttChartService.java new file mode 100644 index 0000000..d3e1c26 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/GanttChartService.java @@ -0,0 +1,55 @@ +package com.dite.znpt.service; + +import com.dite.znpt.domain.vo.GanttChartReq; +import com.dite.znpt.domain.vo.GanttChartResp; + +import java.util.List; + +/** + * 甘特图服务接口 + */ +public interface GanttChartService { + + /** + * 获取项目甘特图数据 + * + * @param req 查询条件 + * @return 甘特图数据列表 + */ + List getGanttChartData(GanttChartReq req); + + /** + * 获取项目甘特图统计信息 + * + * @param projectId 项目ID + * @return 统计信息 + */ + Object getGanttChartStatistics(String projectId); + + /** + * 获取项目甘特图时间轴信息 + * + * @param projectId 项目ID + * @return 时间轴信息 + */ + Object getGanttChartTimeline(String projectId); + + /** + * 更新任务进度 + * + * @param taskId 任务ID + * @param progress 进度百分比 + * @return 是否成功 + */ + boolean updateTaskProgress(String taskId, Integer progress); + + /** + * 拖拽更新任务时间 + * + * @param taskId 任务ID + * @param startDate 开始时间 + * @param endDate 结束时间 + * @return 是否成功 + */ + boolean updateTaskTime(String taskId, String startDate, String endDate); +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/GanttChartServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/GanttChartServiceImpl.java new file mode 100644 index 0000000..e1f8f44 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/impl/GanttChartServiceImpl.java @@ -0,0 +1,486 @@ +package com.dite.znpt.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.dite.znpt.domain.entity.ProjectTaskEntity; +import com.dite.znpt.domain.entity.UserEntity; +import com.dite.znpt.domain.vo.GanttChartReq; +import com.dite.znpt.domain.vo.GanttChartResp; +import com.dite.znpt.mapper.ProjectTaskMapper; +import com.dite.znpt.service.GanttChartService; +import com.dite.znpt.service.UserService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.time.temporal.ChronoUnit; +import java.util.*; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.stream.Collectors; + +/** + * 甘特图服务实现类 + */ +@Service +@RequiredArgsConstructor +public class GanttChartServiceImpl implements GanttChartService { + + private final ProjectTaskMapper projectTaskMapper; + private final UserService userService; + + @Override + public List getGanttChartData(GanttChartReq req) { + // 查询所有任务 + QueryWrapper queryWrapper = new QueryWrapper<>(); + + if (StrUtil.isNotBlank(req.getProjectId())) { + queryWrapper.eq("project_id", req.getProjectId()); + } + if (StrUtil.isNotBlank(req.getTaskGroupId())) { + queryWrapper.eq("task_group_id", req.getTaskGroupId()); + } + if (req.getStatus() != null) { + queryWrapper.eq("status", req.getStatus()); + } + if (StrUtil.isNotBlank(req.getMainUserId())) { + queryWrapper.eq("main_user_id", req.getMainUserId()); + } + if (req.getStartDateFrom() != null) { + queryWrapper.ge("plan_start_date", req.getStartDateFrom()); + } + if (req.getStartDateTo() != null) { + queryWrapper.le("plan_start_date", req.getStartDateTo()); + } + if (req.getEndDateFrom() != null) { + queryWrapper.ge("plan_end_date", req.getEndDateFrom()); + } + if (req.getEndDateTo() != null) { + queryWrapper.le("plan_end_date", req.getEndDateTo()); + } + if (req.getOverdueOnly() != null && req.getOverdueOnly()) { + queryWrapper.eq("overdue_status", 1); + } + if (req.getIncludeCompleted() != null && !req.getIncludeCompleted()) { + queryWrapper.ne("status", 2); + } + + queryWrapper.orderByAsc("plan_start_date"); + + List taskList = projectTaskMapper.selectList(queryWrapper); + + // 获取用户信息 + final Set userIds = new HashSet<>(); + taskList.forEach(task -> { + if (StrUtil.isNotBlank(task.getMainUserId())) { + userIds.add(task.getMainUserId()); + } + if (StrUtil.isNotBlank(task.getUserIds())) { + userIds.addAll(Arrays.asList(task.getUserIds().split(","))); + } + }); + + final Map userMap = new HashMap<>(); + if (CollUtil.isNotEmpty(userIds)) { + List users = userService.listByIds(userIds); + userMap.putAll(users.stream().collect(Collectors.toMap(UserEntity::getUserId, user -> user))); + } + + // 批量获取项目时间范围,避免重复查询 + final Map projectStartDates = new HashMap<>(); + if (StrUtil.isNotBlank(req.getProjectId())) { + // 如果指定了项目ID,直接获取该项目的时间范围 + LocalDate projectStart = getProjectStartDate(req.getProjectId()); + projectStartDates.put(req.getProjectId(), projectStart); + } else { + // 如果没有指定项目ID,获取所有相关项目的时间范围 + Set projectIds = taskList.stream() + .map(ProjectTaskEntity::getProjectId) + .filter(StrUtil::isNotBlank) + .collect(Collectors.toSet()); + + for (String projectId : projectIds) { + LocalDate projectStart = getProjectStartDate(projectId); + projectStartDates.put(projectId, projectStart); + } + } + + // 转换为甘特图数据 + List ganttData = taskList.stream().map(task -> { + GanttChartResp resp = BeanUtil.copyProperties(task, GanttChartResp.class); + + // 设置状态描述 + switch (task.getStatus()) { + case 0: + resp.setStatusDesc("未开始"); + break; + case 1: + resp.setStatusDesc("进行中"); + break; + case 2: + resp.setStatusDesc("已结束"); + break; + default: + resp.setStatusDesc("未知"); + } + + // 设置负责人姓名 + if (StrUtil.isNotBlank(task.getMainUserId()) && userMap.containsKey(task.getMainUserId())) { + resp.setMainUserName(userMap.get(task.getMainUserId()).getName()); + } + + // 设置参与人姓名列表 + if (StrUtil.isNotBlank(task.getUserIds())) { + List participantNames = Arrays.stream(task.getUserIds().split(",")) + .filter(userId -> userMap.containsKey(userId)) + .map(userId -> userMap.get(userId).getName()) + .collect(Collectors.toList()); + resp.setParticipantNames(participantNames); + } + + // 计算进度(这里可以根据实际业务逻辑调整) + if (task.getStatus() == 2) { + resp.setProgress(100); + } else if (task.getStatus() == 1) { + resp.setProgress(50); // 默认进度,实际应该从数据库字段获取 + } else { + resp.setProgress(0); + } + + // 计算任务在时间轴上的位置和持续时间 + LocalDate projectStart = projectStartDates.get(task.getProjectId()); + if (projectStart != null && task.getPlanStartDate() != null) { + int position = (int) ChronoUnit.DAYS.between(projectStart, task.getPlanStartDate()); + resp.setPosition(position); + } + + // 计算任务持续时间 + if (task.getPlanStartDate() != null && task.getPlanEndDate() != null) { + int duration = (int) ChronoUnit.DAYS.between(task.getPlanStartDate(), task.getPlanEndDate()) + 1; + resp.setDuration(duration); + } else { + resp.setDuration(1); // 默认持续1天 + } + + return resp; + }).collect(Collectors.toList()); + + // 构建树形结构 + return buildTreeStructure(ganttData); + } + + @Override + public Object getGanttChartStatistics(String projectId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_id", projectId); + + List taskList = projectTaskMapper.selectList(queryWrapper); + + Map statistics = new HashMap<>(); + statistics.put("totalTasks", taskList.size()); + statistics.put("notStarted", (int) taskList.stream().filter(task -> task.getStatus() == 0).count()); + statistics.put("inProgress", (int) taskList.stream().filter(task -> task.getStatus() == 1).count()); + statistics.put("completed", (int) taskList.stream().filter(task -> task.getStatus() == 2).count()); + statistics.put("overdue", (int) taskList.stream().filter(task -> task.getOverdueStatus() == 1).count()); + + // 计算总体进度 + if (taskList.size() > 0) { + final double avgProgress = taskList.stream() + .mapToInt(task -> { + if (task.getStatus() == 2) return 100; + else if (task.getStatus() == 1) return 50; + else return 0; + }) + .average() + .orElse(0.0); + statistics.put("overallProgress", Math.round(avgProgress)); + } else { + statistics.put("overallProgress", 0); + } + + return statistics; + } + + @Override + public Object getGanttChartTimeline(String projectId) { + if (StrUtil.isBlank(projectId)) { + return null; + } + + LocalDate projectStartDate = getProjectStartDate(projectId); + LocalDate projectEndDate = getProjectEndDate(projectId); + + Map timeline = new HashMap<>(); + timeline.put("projectId", projectId); + timeline.put("startDate", projectStartDate); + timeline.put("endDate", projectEndDate); + timeline.put("totalDays", ChronoUnit.DAYS.between(projectStartDate, projectEndDate) + 1); + + // 计算时间轴上的关键时间点(比如每周、每月) + List> timePoints = new ArrayList<>(); + LocalDate currentDate = projectStartDate; + + while (!currentDate.isAfter(projectEndDate)) { + Map timePoint = new HashMap<>(); + timePoint.put("date", currentDate); + timePoint.put("dayOfWeek", currentDate.getDayOfWeek().getDisplayName(java.time.format.TextStyle.SHORT, java.util.Locale.CHINESE)); + timePoint.put("isWeekend", currentDate.getDayOfWeek().getValue() >= 6); + timePoints.add(timePoint); + + currentDate = currentDate.plusDays(1); + } + + timeline.put("timePoints", timePoints); + + return timeline; + } + + @Override + public boolean updateTaskProgress(String taskId, Integer progress) { + ProjectTaskEntity task = projectTaskMapper.selectById(taskId); + if (task == null) { + return false; + } + + // 更新进度 + // 这里需要根据实际业务逻辑添加进度字段 + // task.setProgress(progress); + + // 根据进度更新状态 + if (progress >= 100) { + task.setStatus(2); // 已完成 + task.setActualEndDate(LocalDate.now()); + } else if (progress > 0) { + task.setStatus(1); // 进行中 + if (task.getActualStartDate() == null) { + task.setActualStartDate(LocalDate.now()); + } + } + + return projectTaskMapper.updateById(task) > 0; + } + + @Override + public boolean updateTaskTime(String taskId, String startDate, String endDate) { + ProjectTaskEntity task = projectTaskMapper.selectById(taskId); + if (task == null) { + return false; + } + + final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate newStartDate = null; + LocalDate newEndDate = null; + + try { + if (StrUtil.isNotBlank(startDate)) { + newStartDate = LocalDate.parse(startDate, formatter); + } + if (StrUtil.isNotBlank(endDate)) { + newEndDate = LocalDate.parse(endDate, formatter); + } + } catch (DateTimeParseException e) { + return false; // 日期格式错误 + } + + // 验证时间约束 + if (!validateTaskTimeConstraints(task, newStartDate, newEndDate)) { + return false; + } + + // 更新任务时间 + if (newStartDate != null) { + task.setPlanStartDate(newStartDate); + } + if (newEndDate != null) { + task.setPlanEndDate(newEndDate); + } + + // 更新逾期状态 + updateOverdueStatus(task); + + return projectTaskMapper.updateById(task) > 0; + } + + /** + * 构建树形结构 + */ + private List buildTreeStructure(List allTasks) { + final Map taskMap = allTasks.stream() + .collect(Collectors.toMap(GanttChartResp::getTaskId, task -> task)); + + final List rootTasks = new ArrayList<>(); + + for (GanttChartResp task : allTasks) { + if (StrUtil.isBlank(task.getParentTaskId())) { + // 根任务 + task.setLevel(0); + rootTasks.add(task); + } else { + // 子任务 + GanttChartResp parentTask = taskMap.get(task.getParentTaskId()); + if (parentTask != null) { + task.setLevel(parentTask.getLevel() + 1); + if (parentTask.getChildren() == null) { + parentTask.setChildren(new ArrayList<>()); + } + parentTask.getChildren().add(task); + } + } + } + + return rootTasks; + } + + /** + * 获取项目开始时间 + * 从项目任务中计算最早的计划开始时间作为项目开始时间 + */ + private LocalDate getProjectStartDate(String projectId) { + if (StrUtil.isBlank(projectId)) { + return LocalDate.now().minusDays(30); // 默认值 + } + + // 查询项目中所有任务的计划开始时间,取最早的时间 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_id", projectId) + .isNotNull("plan_start_date") + .orderByAsc("plan_start_date") + .last("LIMIT 1"); + + ProjectTaskEntity earliestTask = projectTaskMapper.selectOne(queryWrapper); + + if (earliestTask != null && earliestTask.getPlanStartDate() != null) { + return earliestTask.getPlanStartDate(); + } + + // 如果没有找到有效的开始时间,返回当前时间减去30天作为默认值 + return LocalDate.now().minusDays(30); + } + + /** + * 获取项目结束时间 + * 从项目任务中计算最晚的计划结束时间作为项目结束时间 + */ + private LocalDate getProjectEndDate(String projectId) { + if (StrUtil.isBlank(projectId)) { + return LocalDate.now().plusDays(30); // 默认值 + } + + // 查询项目中所有任务的计划结束时间,取最晚的时间 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("project_id", projectId) + .isNotNull("plan_end_date") + .orderByDesc("plan_end_date") + .last("LIMIT 1"); + + ProjectTaskEntity latestTask = projectTaskMapper.selectOne(queryWrapper); + + if (latestTask != null && latestTask.getPlanEndDate() != null) { + return latestTask.getPlanEndDate(); + } + + // 如果没有找到有效的结束时间,返回当前时间加上30天作为默认值 + return LocalDate.now().plusDays(30); + } + + /** + * 获取项目时间范围 + * 返回项目的开始时间和结束时间 + */ + private Map getProjectTimeRange(String projectId) { + Map timeRange = new HashMap<>(); + timeRange.put("startDate", getProjectStartDate(projectId)); + timeRange.put("endDate", getProjectEndDate(projectId)); + return timeRange; + } + + /** + * 批量获取项目时间范围 + * 通过一次查询获取多个项目的时间范围,提高性能 + */ + private Map> getBatchProjectTimeRanges(Set projectIds) { + Map> timeRanges = new HashMap<>(); + + for (String projectId : projectIds) { + Map timeRange = getProjectTimeRange(projectId); + timeRanges.put(projectId, timeRange); + } + + return timeRanges; + } + + /** + * 计算任务进度 + */ + private Integer calculateProgress(ProjectTaskEntity task) { + if (task.getStatus() == 2) return 100; // 已完成 + else if (task.getStatus() == 1) return 50; // 进行中 + else return 0; // 未开始 + } + + /** + * 计算任务持续时间 + */ + private Integer calculateDuration(ProjectTaskEntity task) { + if (task.getPlanStartDate() != null && task.getPlanEndDate() != null) { + return (int) ChronoUnit.DAYS.between(task.getPlanStartDate(), task.getPlanEndDate()) + 1; + } + return 1; + } + + /** + * 计算任务在时间轴上的位置 + */ + private Integer calculatePosition(ProjectTaskEntity task) { + LocalDate projectStart = getProjectStartDate(task.getProjectId()); + if (task.getPlanStartDate() != null && projectStart != null) { + return (int) ChronoUnit.DAYS.between(projectStart, task.getPlanStartDate()); + } + return 0; + } + + /** + * 验证任务时间约束 + */ + private boolean validateTaskTimeConstraints(ProjectTaskEntity task, + LocalDate newStartDate, + LocalDate newEndDate) { + // 验证子任务不能早于父任务开始 + if (StrUtil.isNotBlank(task.getParentTaskId())) { + ProjectTaskEntity parentTask = projectTaskMapper.selectById(task.getParentTaskId()); + if (parentTask != null && newStartDate != null) { + if (newStartDate.isBefore(parentTask.getPlanStartDate())) { + return false; + } + } + } + + // 验证结束时间不能早于开始时间 + if (newStartDate != null && newEndDate != null) { + if (newEndDate.isBefore(newStartDate)) { + return false; + } + } + + return true; + } + + /** + * 更新逾期状态 + */ + private void updateOverdueStatus(ProjectTaskEntity task) { + if (task.getPlanEndDate() != null && + task.getPlanEndDate().isBefore(LocalDate.now()) && + task.getStatus() != 2) { + task.setOverdueStatus(1); // 标记为逾期 + } else { + task.setOverdueStatus(0); + } + } +} diff --git a/web/src/main/java/com/dite/znpt/web/controller/GanttChartController.java b/web/src/main/java/com/dite/znpt/web/controller/GanttChartController.java new file mode 100644 index 0000000..6da8f57 --- /dev/null +++ b/web/src/main/java/com/dite/znpt/web/controller/GanttChartController.java @@ -0,0 +1,61 @@ +package com.dite.znpt.web.controller; + +import com.dite.znpt.domain.Result; +import com.dite.znpt.domain.vo.GanttChartReq; +import com.dite.znpt.domain.vo.GanttChartResp; +import com.dite.znpt.service.GanttChartService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 甘特图控制器 + */ +@Api(tags = "甘特图管理") +@RestController +@RequestMapping("/gantt-chart") +public class GanttChartController { + + @Resource + private GanttChartService ganttChartService; + + @ApiOperation(value = "获取项目甘特图数据", httpMethod = "GET") + @GetMapping("/data") + public Result> getGanttChartData(GanttChartReq req) { + List data = ganttChartService.getGanttChartData(req); + return Result.ok(data); + } + + @ApiOperation(value = "获取项目甘特图统计信息", httpMethod = "GET") + @GetMapping("/statistics/{projectId}") + public Result getGanttChartStatistics(@PathVariable String projectId) { + Object statistics = ganttChartService.getGanttChartStatistics(projectId); + return Result.ok(statistics); + } + + @ApiOperation(value = "获取项目甘特图时间轴信息", httpMethod = "GET") + @GetMapping("/timeline/{projectId}") + public Result getGanttChartTimeline(@PathVariable String projectId) { + Object timeline = ganttChartService.getGanttChartTimeline(projectId); + return Result.ok(timeline); + } + + @ApiOperation(value = "更新任务进度", httpMethod = "PUT") + @PutMapping("/progress/{taskId}") + public Result updateTaskProgress(@PathVariable String taskId, @RequestParam Integer progress) { + boolean success = ganttChartService.updateTaskProgress(taskId, progress); + return Result.ok(success); + } + + @ApiOperation(value = "拖拽更新任务时间", httpMethod = "PUT") + @PutMapping("/time/{taskId}") + public Result updateTaskTime(@PathVariable String taskId, + @RequestParam(required = false) String startDate, + @RequestParam(required = false) String endDate) { + boolean success = ganttChartService.updateTaskTime(taskId, startDate, endDate); + return Result.ok(success); + } +} -- 2.34.1 From 5ed374f06f473f77cbeaa2d5ac4684a5555fad05 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Wed, 13 Aug 2025 16:46:42 +0800 Subject: [PATCH 18/22] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=94=B6=E8=B4=A7=E5=90=8E=E7=9B=B4=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dite/znpt/domain/vo/ReceiptRequest.java | 160 ++++++++++++++++++ .../dite/znpt/service/EquipmentService.java | 6 + .../service/impl/EquipmentServiceImpl.java | 69 ++++++++ .../znpt/service/impl/ProjectServiceImpl.java | 1 - .../web/controller/EquipmentController.java | 12 ++ 5 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java b/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java new file mode 100644 index 0000000..d1776ef --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java @@ -0,0 +1,160 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * 收货请求参数(扩展版,包含完整设备信息) + * + * @author system + * @date 2025-01-08 + */ +@Data +@ApiModel(value = "收货请求参数", description = "收货请求参数,包含收货信息和设备信息") +public class ReceiptRequest { + + // 收货特有信息 + @NotBlank(message = "收货时间不能为空") + @ApiModelProperty("收货时间") + private String receiptTime; + + @NotBlank(message = "收货人不能为空") + @ApiModelProperty("收货人") + private String receiptPerson; + + @NotNull(message = "收货数量不能为空") + @ApiModelProperty("收货数量") + private Integer receiptQuantity; + + @ApiModelProperty("收货备注") + private String receiptRemark; + + @NotBlank(message = "外观检查结果不能为空") + @ApiModelProperty("外观检查结果") + private String appearanceCheck; + + @NotBlank(message = "功能测试结果不能为空") + @ApiModelProperty("功能测试结果") + private String functionTest; + + @NotBlank(message = "包装完整性不能为空") + @ApiModelProperty("包装完整性") + private String packageIntegrity; + + @NotBlank(message = "配件完整性不能为空") + @ApiModelProperty("配件完整性") + private String accessoryIntegrity; + + @NotBlank(message = "检查结果不能为空") + @ApiModelProperty("检查结果") + private String checkResult; + + @ApiModelProperty("检查备注") + private String checkRemark; + + @NotBlank(message = "入库位置不能为空") + @ApiModelProperty("入库位置") + private String storageLocation; + + @NotBlank(message = "库管员不能为空") + @ApiModelProperty("库管员") + private String storageManager; + + // 设备基本信息(从采购数据继承) + @ApiModelProperty("设备名称") + private String equipmentName; + + @ApiModelProperty("设备型号") + private String equipmentModel; + + @ApiModelProperty("设备类型") + private String equipmentType; + + @ApiModelProperty("设备序列号") + private String equipmentSn; + + @ApiModelProperty("品牌") + private String brand; + + @ApiModelProperty("配置规格/参数") + private String specification; + + @ApiModelProperty("资产编号") + private String assetCode; + + // 采购信息(从采购数据继承) + @ApiModelProperty("采购订单号") + private String purchaseOrder; + + @ApiModelProperty("供应商名称") + private String supplierName; + + @ApiModelProperty("采购价格") + private BigDecimal purchasePrice; + + @ApiModelProperty("采购时间") + private String purchaseTime; + + @ApiModelProperty("数量") + private Integer quantity; + + @ApiModelProperty("单价") + private BigDecimal unitPrice; + + @ApiModelProperty("总价") + private BigDecimal totalPrice; + + // 入库信息 + @ApiModelProperty("入库时间") + private String inStockTime; + + @ApiModelProperty("物理位置") + private String physicalLocation; + + @ApiModelProperty("位置状态") + private String locationStatus; + + @ApiModelProperty("负责人") + private String responsiblePerson; + + @ApiModelProperty("库存条码") + private String inventoryBarcode; + + // 状态信息 + @ApiModelProperty("设备状态") + private String equipmentStatus; + + @ApiModelProperty("使用状态") + private String useStatus; + + @ApiModelProperty("健康状态") + private String healthStatus; + + @ApiModelProperty("收货状态") + private String receiptStatus; + + // 其他管理信息 + @ApiModelProperty("折旧方法") + private String depreciationMethod; + + @ApiModelProperty("折旧年限") + private Integer depreciationYears; + + @ApiModelProperty("残值") + private BigDecimal salvageValue; + + @ApiModelProperty("当前净值") + private BigDecimal currentNetValue; + + // 系统字段 + @ApiModelProperty("创建时间") + private String createTime; + + @ApiModelProperty("更新时间") + private String updateTime; +} diff --git a/core/src/main/java/com/dite/znpt/service/EquipmentService.java b/core/src/main/java/com/dite/znpt/service/EquipmentService.java index 0697362..dbded87 100644 --- a/core/src/main/java/com/dite/znpt/service/EquipmentService.java +++ b/core/src/main/java/com/dite/znpt/service/EquipmentService.java @@ -6,6 +6,7 @@ import com.dite.znpt.domain.entity.EquipmentEntity; import com.dite.znpt.domain.vo.EquipmentListReq; import com.dite.znpt.domain.vo.EquipmentReq; import com.dite.znpt.domain.vo.EquipmentResp; +import com.dite.znpt.domain.vo.ReceiptRequest; import java.util.List; import java.util.Map; @@ -53,6 +54,11 @@ public interface EquipmentService extends IService { */ Object getProcurementStats(); + /** + * 确认收货并自动入库 + */ + void receiveGoodsAndStockIn(String equipmentId, ReceiptRequest req); + /** * 导出采购记录 */ diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index bcee3bb..9d6beec 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -23,9 +23,13 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; +import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; +import com.dite.znpt.domain.vo.ReceiptRequest; +import cn.dev33.satoken.stp.StpUtil; +import org.springframework.beans.BeanUtils; /** * @author Bear.G @@ -840,4 +844,69 @@ public class EquipmentServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq("contract_code", req.getProjectOrigin()); ContractEntity contractEntity = contractMapper.selectOne(queryWrapper); - contractEntity.setProjectId(entity.getProjectId()); contractMapper.updateById(contractEntity); for (ProjectInitTaskReq taskReq : req.getTasks()) { ProjectTaskEntity taskEntity = BeanUtil.copyProperties(taskReq, ProjectTaskEntity.class); diff --git a/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java b/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java index 8da84ae..1b8280c 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/EquipmentController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import com.dite.znpt.domain.vo.ReceiptRequest; /** * @author Bear.G @@ -139,4 +140,15 @@ public class EquipmentController { public Result getProcurementStats(){ return Result.ok(equipmentService.getProcurementStats()); } + + @ApiOperation(value = "确认收货并自动入库", httpMethod = "POST") + @PostMapping("/procurement/receipt/{equipmentId}") + public Result receiveGoods(@PathVariable String equipmentId, @Validated @RequestBody ReceiptRequest req) { + log.info("=== 设备收货接口被调用 ==="); + log.info("设备ID: {}", equipmentId); + log.info("收货数据: {}", req); + + equipmentService.receiveGoodsAndStockIn(equipmentId, req); + return Result.ok("收货成功,设备已自动入库"); + } } -- 2.34.1 From 1083efd2bd44b4f0c61ee3f3489a7b84c648d83e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=9D=E5=BD=AC?= <14779346+xswl_123@user.noreply.gitee.com> Date: Wed, 13 Aug 2025 17:46:28 +0800 Subject: [PATCH 19/22] =?UTF-8?q?8-13=20=E9=A1=B9=E7=9B=AE=E8=AF=A6?= =?UTF-8?q?=E7=BB=86=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA=E6=89=80=E6=9C=89?= =?UTF-8?q?=E5=AD=90=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/dite/znpt/domain/vo/ProjectReq.java | 3 +-- .../com/dite/znpt/domain/vo/ProjectResp.java | 4 ++++ .../znpt/service/impl/ProjectServiceImpl.java | 17 ++++++++++------- .../znpt/web/controller/ProjectController.java | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java index 881ecb6..b590940 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectReq.java @@ -78,9 +78,8 @@ public class ProjectReq implements Serializable { @ApiModelProperty("检查单位联系电话") private String inspectionPhone; - @Size(groups = {ValidationGroup.Insert.class, ValidationGroup.Update.class}, max = 20, message = "项目规模长度不能超过20字符") @ApiModelProperty("项目规模") - private String scale; + private Integer scale; @ApiModelProperty("总工期,单位天") private Integer duration; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ProjectResp.java b/core/src/main/java/com/dite/znpt/domain/vo/ProjectResp.java index 16eb289..47c02b8 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ProjectResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ProjectResp.java @@ -6,6 +6,7 @@ import lombok.Data; import java.io.Serial; import java.io.Serializable; +import java.util.List; /** * @author huise23 @@ -45,5 +46,8 @@ public class ProjectResp extends ProjectReq implements Serializable { @ApiModelProperty("状态:0待施工,1施工中,2已完工,3已审核,4已验收") private String statusLabel; + + @ApiModelProperty("任务列表") + private List taskList; } diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java index 198ec2e..b76759a 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java @@ -11,11 +11,7 @@ import com.dite.znpt.domain.entity.ContractEntity; import com.dite.znpt.domain.entity.ProjectEntity; import com.dite.znpt.domain.entity.ProjectTaskEntity; import com.dite.znpt.domain.entity.UserEntity; -import com.dite.znpt.domain.vo.ProjectInitTaskReq; -import com.dite.znpt.domain.vo.ProjectListReq; -import com.dite.znpt.domain.vo.ProjectListResp; -import com.dite.znpt.domain.vo.ProjectReq; -import com.dite.znpt.domain.vo.ProjectResp; +import com.dite.znpt.domain.vo.*; import com.dite.znpt.enums.ProjectStatusEnum; import com.dite.znpt.exception.ServiceException; import com.dite.znpt.mapper.ContractMapper; @@ -127,6 +123,13 @@ public class ProjectServiceImpl extends ServiceImpl tmp = projectTaskService.list(new QueryWrapper().eq("project_id", projectId)); + List list1 = new ArrayList<>(); + for (ProjectTaskEntity item : tmp) { + ProjectTaskResp taskResp = BeanUtil.copyProperties(item, ProjectTaskResp.class); + list1.add(taskResp); + } + resp.setTaskList(list1); return resp; } @@ -143,9 +146,9 @@ public class ProjectServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("contract_code", req.getProjectOrigin()); + queryWrapper.eq("code", req.getProjectOrigin()); ContractEntity contractEntity = contractMapper.selectOne(queryWrapper); - contractEntity.setProjectId(entity.getProjectId()); + contractEntity.setContractStatus("施工中"); contractMapper.updateById(contractEntity); for (ProjectInitTaskReq taskReq : req.getTasks()) { ProjectTaskEntity taskEntity = BeanUtil.copyProperties(taskReq, ProjectTaskEntity.class); diff --git a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java index c7e1806..fd95eb1 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/ProjectController.java @@ -122,7 +122,7 @@ public class ProjectController { @GetMapping("/contracts") public Result> contracts() { QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.isNull("project_id"); + queryWrapper.eq("contract_status", "未立项"); return Result.ok(contractService.list(queryWrapper)); } -- 2.34.1 From 2a72604dde17190488d5a3f1d0dae82dd4cb7bdc Mon Sep 17 00:00:00 2001 From: ybb <2532447764@qq.com> Date: Wed, 13 Aug 2025 19:48:38 +0800 Subject: [PATCH 20/22] =?UTF-8?q?8=E6=9C=8813(=E5=8C=85=E6=8B=AC=E5=8A=A0?= =?UTF-8?q?=E7=8F=AD)=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86=E9=87=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8Dbug.=E8=BF=98=E5=AF=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=EF=BC=8C=E5=AF=B9=E4=BA=8E=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E5=81=9A=E4=BA=86=E9=80=82=E9=85=8D=EF=BC=8C?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E6=9B=B4=E5=A5=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/mapper/BusinessDataFileMapper.java | 11 +++++ .../dite/znpt/mapper/BusinessDataMapper.java | 8 +++ .../znpt/service/BusinessDataFileService.java | 8 +++ .../znpt/service/BusinessDataService.java | 2 + .../impl/BusinessDataFileServiceImpl.java | 27 ++++++++-- .../service/impl/BusinessDataServiceImpl.java | 49 +++++++++++++++---- .../mapper/BusinessDataFileMapper.xml | 15 ++++++ .../resources/mapper/BusinessDataMapper.xml | 9 ++++ 8 files changed, 116 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java b/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java index 0fa1dd8..930d70d 100644 --- a/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java +++ b/core/src/main/java/com/dite/znpt/mapper/BusinessDataFileMapper.java @@ -36,4 +36,15 @@ public interface BusinessDataFileMapper { @Param("newFileName") String newFileName, @Param("newFilePath") String newFilePath); +// // 批量更新文件路径 +// void updateFilePathByFolderId( +// @Param("folderId") Long folderId, +// @Param("newFolderPath") String newFolderPath, +// @Param("separator") String separator); + + // 批量更新子文件夹下文件的路径 + void updateSubFilePaths(@Param("oldParentPath1") String oldParentPath1, + @Param("newParentPath1") String newParentPath1, + @Param("oldParentPath2") String oldParentPath2 + ); } diff --git a/core/src/main/java/com/dite/znpt/mapper/BusinessDataMapper.java b/core/src/main/java/com/dite/znpt/mapper/BusinessDataMapper.java index b7e4bae..f8d2d80 100644 --- a/core/src/main/java/com/dite/znpt/mapper/BusinessDataMapper.java +++ b/core/src/main/java/com/dite/znpt/mapper/BusinessDataMapper.java @@ -29,4 +29,12 @@ public interface BusinessDataMapper { void reName(BusinessDataEntity businessDataEntity); public List ListWithCondition(@Param("folderName") String folderName); + + // 批量更新子文件夹路径 + void updateSubFolderPaths(@Param("oldParentPath1") String oldParentPath, + @Param("newParentPath1") String newParentPath, + @Param("processedOldParentPath") String processedOldParentPath, + @Param("processedNewParentPath") String processedNewParentPath, + @Param("folderId") Long folderId + ); } diff --git a/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java b/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java index b4af5dc..d82cb53 100644 --- a/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java +++ b/core/src/main/java/com/dite/znpt/service/BusinessDataFileService.java @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.File; @ApiOperation("商务资料文件service") @Service @@ -40,4 +41,11 @@ public interface BusinessDataFileService { @ApiOperation("预览文件") void preview(Long fileId, HttpServletResponse response); + +// @ApiOperation("批量更新文件路径") +// public void updateFilePathByFolderId(Long folderId, String newFolderPath); + + @ApiOperation("批量更新子文件夹下文件的路径") + void updateSubFilePaths(String oldParentPath, String newParentPath); + } diff --git a/core/src/main/java/com/dite/znpt/service/BusinessDataService.java b/core/src/main/java/com/dite/znpt/service/BusinessDataService.java index f4a826c..90fabda 100644 --- a/core/src/main/java/com/dite/znpt/service/BusinessDataService.java +++ b/core/src/main/java/com/dite/znpt/service/BusinessDataService.java @@ -15,4 +15,6 @@ public interface BusinessDataService { Result delete(Long folderId); Result reName(Long folderId, String newName); + void updateSubFolderPaths(String oldParentPath1, String newParentPath1, Long folderId); + } diff --git a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java index 6cfe2f6..0c6e2a9 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataFileServiceImpl.java @@ -81,7 +81,8 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { } @ApiOperation("删除文件") public Result delete(Long fileId, Long folderId) { - //删除数据库数据 + //删除文件夹时候,调用这个方法,才会删除所有文件的数据库数据, + // 至于具体文件,不用在这个方法删除 if (folderId != null){ businessDataFileMapper.delete(null,folderId); return Result.okM("删除成功"); @@ -155,8 +156,11 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { } // 构建新文件路径 + // 获取父目录 String parentPath = oldFile.getParent(); + // 获取文件扩展名 String fileExtension = ""; + // 获取文件名(不包含扩展名) String fileNameWithoutExt = newFileName; // 获取原文件扩展名 @@ -246,7 +250,7 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { byte[] bytes = file.getBytes(); String uploadDir = businessDataService.getPath(folderId); - File uploadedFile = new File(uploadDir + "/" + file.getOriginalFilename()); + File uploadedFile = new File(uploadDir + File.separator + file.getOriginalFilename()); if (uploadedFile.exists()) { return Result.error("文件已存在"); } @@ -256,7 +260,7 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { BusinessDataFileEntity fileEntity = new BusinessDataFileEntity(); fileEntity.setFolderId(folderId); fileEntity.setFileName(file.getOriginalFilename()); - fileEntity.setFilePath(uploadDir + "/" + file.getOriginalFilename()); + fileEntity.setFilePath(uploadDir + File.separator + file.getOriginalFilename()); fileEntity.setFileType(file.getContentType()); fileEntity.setFileSize(file.getSize()/1024); fileEntity.setUploadTime(new Date()); @@ -544,4 +548,21 @@ public class BusinessDataFileServiceImpl implements BusinessDataFileService { } } +// @ApiOperation("批量更新文件路径") +// @Override +// public void updateFilePathByFolderId(Long folderId, String newFolderPath) { +// businessDataFileMapper.updateFilePathByFolderId(folderId, newFolderPath, File.separator); +// } + + @ApiOperation("批量更新子文件夹下文件的路径") + @Override + public void updateSubFilePaths(String oldParentPath1, String newParentPath1) { + // 处理路径中的分隔符,如果是反斜杠则替换为双反斜杠 + String oldParentPath2 = oldParentPath1; + if ("\\".equals(File.separator)) { + oldParentPath2 = oldParentPath1.replace("\\", "\\\\"); + } + businessDataFileMapper.updateSubFilePaths(oldParentPath1, newParentPath1, oldParentPath2); + } + } diff --git a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataServiceImpl.java index 2f17a2b..f4360cf 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/BusinessDataServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/BusinessDataServiceImpl.java @@ -70,7 +70,7 @@ public class BusinessDataServiceImpl implements BusinessDataService { } // 文件夹名称前置一个/ - String folderName1 = "/" + folderName; + String folderName1 = File.separator + folderName; // 目标文件夹 File targetDir = Paths.get(businessDataPath, folderName1).toFile(); if (parentId != 0L) { @@ -147,23 +147,37 @@ public class BusinessDataServiceImpl implements BusinessDataService { } } + @ApiOperation("批量更新子文件夹路径") + @Override + public void updateSubFolderPaths(String oldParentPath1, String newParentPath1,Long folderId) { + // 处理路径中的分隔符,如果是反斜杠则替换为双反斜杠 + String processedOldParentPath = oldParentPath1; + String processedNewParentPath = newParentPath1; + if ("\\".equals(File.separator)) { + processedOldParentPath = oldParentPath1.replace("\\", "\\\\"); + processedNewParentPath = newParentPath1.replace("\\", "\\\\"); + } + + businessDataMapper.updateSubFolderPaths(oldParentPath1,newParentPath1,processedOldParentPath, processedNewParentPath, folderId); + } @ApiOperation("重命名文件夹") @Override public Result reName(Long folderId, String newName) { // 获取文件夹路径 String folderPath = businessDataMapper.getPath(folderId); - String newPath = folderPath.substring(0, folderPath.lastIndexOf('\\')) + "\\" + newName; - // - // //想命名的原文件的路径 - // File file = new File("f:/a/a.xlsx"); - // //将原文件更改为f:\a\b.xlsx,其中路径是必要的。注意 - // file.renameTo(new File("f:/a/b.xlsx")); - // 想命名的原文件夹的路径 + String newPath = folderPath.substring(0, folderPath.lastIndexOf(File.separator)) + File.separator + newName; + + // 重命名物理文件夹 File file1 = new File(folderPath); - // 将原文件夹更改为A,其中路径是必要的。注意 - file1.renameTo(new File(newPath)); + boolean renameSuccess = file1.renameTo(new File(newPath)); + + if (!renameSuccess) { + return Result.error("文件夹重命名失败"); + } + LocalDateTime now = LocalDateTime.now(); + // 更新文件夹信息 BusinessDataEntity businessDataEntity = new BusinessDataEntity( folderId, newName, @@ -174,6 +188,21 @@ public class BusinessDataServiceImpl implements BusinessDataService { null, newPath); businessDataMapper.reName(businessDataEntity); + +// // 批量更新该文件夹下所有文件的路径 +// businessDataFileService.updateFilePathByFolderId(folderId, newPath); + + + String folderPath1 = folderPath+File.separator; + String newPath1 = newPath+File.separator; + + // 批量更新子文件夹下所有文件的路径 + businessDataFileService.updateSubFilePaths(folderPath1, newPath1); + // 批量更新子文件夹的路径 + updateSubFolderPaths(folderPath1, newPath1,folderId); + return Result.okM("重命名成功"); } + + } diff --git a/core/src/main/resources/mapper/BusinessDataFileMapper.xml b/core/src/main/resources/mapper/BusinessDataFileMapper.xml index c8216b4..62e2583 100644 --- a/core/src/main/resources/mapper/BusinessDataFileMapper.xml +++ b/core/src/main/resources/mapper/BusinessDataFileMapper.xml @@ -94,5 +94,20 @@ where file_id = #{fileId} + + + + + + + + + + + update business_data_part_file + set file_path = replace(file_path, #{oldParentPath1}, #{newParentPath1}) + where file_path like concat(#{oldParentPath2}, '%') + + diff --git a/core/src/main/resources/mapper/BusinessDataMapper.xml b/core/src/main/resources/mapper/BusinessDataMapper.xml index f714eae..e6d9332 100644 --- a/core/src/main/resources/mapper/BusinessDataMapper.xml +++ b/core/src/main/resources/mapper/BusinessDataMapper.xml @@ -51,5 +51,14 @@ + + + + update business_data_part + set folder_path = replace(folder_path, #{oldParentPath1}, #{newParentPath1}), + update_time = now() + where folder_path like concat(#{processedOldParentPath}, '%') + + -- 2.34.1 From f57fe26166536e616c7d8501d0c719edae1d01f8 Mon Sep 17 00:00:00 2001 From: "Mr.j" <2221464500@qq.com> Date: Thu, 14 Aug 2025 15:22:28 +0800 Subject: [PATCH 21/22] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=94=B6=E8=B4=A7?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E9=9A=8F=E7=9D=80=E6=B5=81=E7=A8=8B=E5=8F=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=9C=A8=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=90=8E=E9=80=9A=E8=BF=87=E5=90=8E=E6=89=8D?= =?UTF-8?q?=E5=87=BA=E7=8E=B0=E6=94=B6=E8=B4=A7=E7=8A=B6=E6=80=81,?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=94=AF=E4=BB=98=E7=8A=B6=E6=80=81=E5=92=8C?= =?UTF-8?q?=E6=94=B6=E8=8E=B7=E7=8A=B6=E6=80=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/entity/EquipmentEntity.java | 6 ++ .../dite/znpt/domain/vo/EquipmentResp.java | 9 ++ .../dite/znpt/domain/vo/ReceiptRequest.java | 12 +-- .../dite/znpt/enums/PaymentStatusEnum.java | 52 +++++++++++ .../dite/znpt/enums/ReceiptStatusEnum.java | 52 +++++++++++ .../service/impl/EquipmentServiceImpl.java | 89 ++++++++++++++++--- web/src/main/resources/application-dev.yml | 2 +- 7 files changed, 201 insertions(+), 21 deletions(-) create mode 100644 core/src/main/java/com/dite/znpt/enums/PaymentStatusEnum.java create mode 100644 core/src/main/java/com/dite/znpt/enums/ReceiptStatusEnum.java diff --git a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java index 642ee6e..79afc9f 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/EquipmentEntity.java @@ -180,6 +180,12 @@ public class EquipmentEntity extends AuditableEntity implements Serializable { @ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成") private String procurementStatus; + @ApiModelProperty("收货状态,NOT_RECEIVED-未收货,PARTIALLY_RECEIVED-部分收货,RECEIVED-已收货") + private String receiptStatus; + + @ApiModelProperty("支付状态,NOT_PAID-未支付,PARTIALLY_PAID-部分支付,PAID-已支付") + private String paymentStatus; + @ApiModelProperty("附件") private String attachments; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java index 04642f2..e0529f5 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/EquipmentResp.java @@ -157,6 +157,15 @@ public class EquipmentResp implements Serializable { @ApiModelProperty("采购状态,NOT_STARTED-未开始,PENDING_APPROVAL-待审批,APPROVED-已通过,REJECTED-已拒绝,COMPLETED-已完成") private String procurementStatus; + @ApiModelProperty("收货状态,NOT_RECEIVED-未收货,PARTIALLY_RECEIVED-部分收货,RECEIVED-已收货") + private String receiptStatus; + + @ApiModelProperty("支付状态,NOT_PAID-未支付,PARTIALLY_PAID-部分支付,PAID-已支付") + private String paymentStatus; + + @ApiModelProperty("审批状态,PENDING-待审批,APPROVED-已通过,REJECTED-已拒绝") + private String approvalStatus; + // 移除备用状态字段,使用现有的 location_status 字段 // @ApiModelProperty("备用状态") // private String spareStatus; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java b/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java index d1776ef..8892e98 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/ReceiptRequest.java @@ -18,6 +18,12 @@ import java.math.BigDecimal; @ApiModel(value = "收货请求参数", description = "收货请求参数,包含收货信息和设备信息") public class ReceiptRequest { + @ApiModelProperty("设备序列号(收货时自动生成)") + private String equipmentSn; + + @ApiModelProperty("库存条码(收货时自动生成)") + private String inventoryBarcode; + // 收货特有信息 @NotBlank(message = "收货时间不能为空") @ApiModelProperty("收货时间") @@ -75,9 +81,6 @@ public class ReceiptRequest { @ApiModelProperty("设备类型") private String equipmentType; - @ApiModelProperty("设备序列号") - private String equipmentSn; - @ApiModelProperty("品牌") private String brand; @@ -122,9 +125,6 @@ public class ReceiptRequest { @ApiModelProperty("负责人") private String responsiblePerson; - @ApiModelProperty("库存条码") - private String inventoryBarcode; - // 状态信息 @ApiModelProperty("设备状态") private String equipmentStatus; diff --git a/core/src/main/java/com/dite/znpt/enums/PaymentStatusEnum.java b/core/src/main/java/com/dite/znpt/enums/PaymentStatusEnum.java new file mode 100644 index 0000000..27a8dcf --- /dev/null +++ b/core/src/main/java/com/dite/znpt/enums/PaymentStatusEnum.java @@ -0,0 +1,52 @@ +package com.dite.znpt.enums; + +import cn.hutool.json.JSONObject; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 支付状态枚举 + * + * @author system + * @date 2025-01-08 + */ +@Getter +public enum PaymentStatusEnum { + NOT_PAID("NOT_PAID", "未支付"), + PARTIALLY_PAID("PARTIALLY_PAID", "部分支付"), + PAID("PAID", "已支付"); + + private final String code; + private final String desc; + + PaymentStatusEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static PaymentStatusEnum getByCode(String code) { + for (PaymentStatusEnum e : PaymentStatusEnum.values()) { + if (e.code.equals(code)) { + return e; + } + } + return null; + } + + public static String getDescByCode(String code) { + PaymentStatusEnum e = getByCode(code); + return null == e ? null : e.desc; + } + + public static List listAll() { + List list = new ArrayList<>(PaymentStatusEnum.values().length); + for (PaymentStatusEnum e : PaymentStatusEnum.values()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set(e.code, e.desc); + list.add(jsonObject); + } + return list; + } +} diff --git a/core/src/main/java/com/dite/znpt/enums/ReceiptStatusEnum.java b/core/src/main/java/com/dite/znpt/enums/ReceiptStatusEnum.java new file mode 100644 index 0000000..b2174bc --- /dev/null +++ b/core/src/main/java/com/dite/znpt/enums/ReceiptStatusEnum.java @@ -0,0 +1,52 @@ +package com.dite.znpt.enums; + +import cn.hutool.json.JSONObject; +import lombok.Getter; + +import java.util.ArrayList; +import java.util.List; + +/** + * 收货状态枚举 + * + * @author system + * @date 2025-01-08 + */ +@Getter +public enum ReceiptStatusEnum { + NOT_RECEIVED("NOT_RECEIVED", "未收货"), + PARTIALLY_RECEIVED("PARTIALLY_RECEIVED", "部分收货"), + RECEIVED("RECEIVED", "已收货"); + + private final String code; + private final String desc; + + ReceiptStatusEnum(String code, String desc) { + this.code = code; + this.desc = desc; + } + + public static ReceiptStatusEnum getByCode(String code) { + for (ReceiptStatusEnum e : ReceiptStatusEnum.values()) { + if (e.code.equals(code)) { + return e; + } + } + return null; + } + + public static String getDescByCode(String code) { + ReceiptStatusEnum e = getByCode(code); + return null == e ? null : e.desc; + } + + public static List listAll() { + List list = new ArrayList<>(ReceiptStatusEnum.values().length); + for (ReceiptStatusEnum e : ReceiptStatusEnum.values()) { + JSONObject jsonObject = new JSONObject(); + jsonObject.set(e.code, e.desc); + list.add(jsonObject); + } + return list; + } +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java index 9d6beec..9dcd42e 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/EquipmentServiceImpl.java @@ -478,6 +478,15 @@ public class EquipmentServiceImpl extends ServiceImpl Date: Thu, 14 Aug 2025 17:53:27 +0800 Subject: [PATCH 22/22] =?UTF-8?q?8-14=20=E6=96=B0=E5=A2=9E=E6=94=AF?= =?UTF-8?q?=E5=87=BA=E7=B1=BB=E5=9E=8B=E6=95=B0=E6=8D=AE=E5=BA=93=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B9=E7=9B=AE=E7=AB=8B=E9=A1=B9=E6=97=B6?= =?UTF-8?q?=E6=9C=AA=E5=88=86=E9=85=8D=E4=B8=BB=E8=B4=9F=E8=B4=A3=E4=BA=BA?= =?UTF-8?q?=E6=97=B6=E5=90=8E=E7=AB=AF=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../znpt/domain/entity/ExpenseTypeEntity.java | 27 ++++++++ .../dite/znpt/mapper/ExpenseTypeMapper.java | 11 +++ .../dite/znpt/service/ExpenseTypeService.java | 11 +++ .../service/impl/ExpenseTypeServiceImpl.java | 18 +++++ .../znpt/service/impl/ProjectServiceImpl.java | 4 +- .../resources/mapper/ExpenseTypeMapper.xml | 9 +++ .../web/controller/ExpenseTypeController.java | 68 +++++++++++++++++++ 7 files changed, 147 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/dite/znpt/domain/entity/ExpenseTypeEntity.java create mode 100644 core/src/main/java/com/dite/znpt/mapper/ExpenseTypeMapper.java create mode 100644 core/src/main/java/com/dite/znpt/service/ExpenseTypeService.java create mode 100644 core/src/main/java/com/dite/znpt/service/impl/ExpenseTypeServiceImpl.java create mode 100644 core/src/main/resources/mapper/ExpenseTypeMapper.xml create mode 100644 web/src/main/java/com/dite/znpt/web/controller/ExpenseTypeController.java diff --git a/core/src/main/java/com/dite/znpt/domain/entity/ExpenseTypeEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/ExpenseTypeEntity.java new file mode 100644 index 0000000..d702485 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/entity/ExpenseTypeEntity.java @@ -0,0 +1,27 @@ +package com.dite.znpt.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +@TableName("expense_type") +@ApiModel(value="ExpenseTypeEntity对象", description="支出类型表") +public class ExpenseTypeEntity { + @TableId(type = IdType.AUTO) + private Integer Id; + + @ApiModelProperty("支出类型名称") + private String name; + + @ApiModelProperty("父级id") + private Integer parentId; +} diff --git a/core/src/main/java/com/dite/znpt/mapper/ExpenseTypeMapper.java b/core/src/main/java/com/dite/znpt/mapper/ExpenseTypeMapper.java new file mode 100644 index 0000000..927b0f3 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/mapper/ExpenseTypeMapper.java @@ -0,0 +1,11 @@ +package com.dite.znpt.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dite.znpt.domain.entity.ExpenseTypeEntity; +import org.mapstruct.Mapper; + +import java.util.List; + +public interface ExpenseTypeMapper extends BaseMapper { + List search(String key); +} diff --git a/core/src/main/java/com/dite/znpt/service/ExpenseTypeService.java b/core/src/main/java/com/dite/znpt/service/ExpenseTypeService.java new file mode 100644 index 0000000..da3a6f7 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/ExpenseTypeService.java @@ -0,0 +1,11 @@ +package com.dite.znpt.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.dite.znpt.domain.entity.ExpenseTypeEntity; +import org.springframework.stereotype.Service; + +import java.util.List; + +public interface ExpenseTypeService extends IService { + List search(String key); +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/ExpenseTypeServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ExpenseTypeServiceImpl.java new file mode 100644 index 0000000..e2013a5 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/service/impl/ExpenseTypeServiceImpl.java @@ -0,0 +1,18 @@ +package com.dite.znpt.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import com.dite.znpt.mapper.ExpenseTypeMapper; +import com.dite.znpt.domain.entity.ExpenseTypeEntity; +import com.dite.znpt.service.ExpenseTypeService; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ExpenseTypeServiceImpl extends ServiceImpl implements ExpenseTypeService { + @Override + public List search(String key) { + return this.baseMapper.search(key); + } +} diff --git a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java index b76759a..8d3a466 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/ProjectServiceImpl.java @@ -119,7 +119,9 @@ public class ProjectServiceImpl extends ServiceImpl + + + + \ No newline at end of file diff --git a/web/src/main/java/com/dite/znpt/web/controller/ExpenseTypeController.java b/web/src/main/java/com/dite/znpt/web/controller/ExpenseTypeController.java new file mode 100644 index 0000000..5b3eb1d --- /dev/null +++ b/web/src/main/java/com/dite/znpt/web/controller/ExpenseTypeController.java @@ -0,0 +1,68 @@ +package com.dite.znpt.web.controller; + +import cn.hutool.core.io.LimitedInputStream; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.dite.znpt.domain.Result; +import com.dite.znpt.domain.entity.ExpenseTypeEntity; +import com.dite.znpt.service.ExpenseTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@Api(tags = "支出类型信息") +@RestController +@RequestMapping("/expenseType") +public class ExpenseTypeController { + @Resource + private ExpenseTypeService expenseTypeService; + + @GetMapping("") + @ApiOperation(value = "查询一级支出类型", httpMethod = "GET") + public Result> list() { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.isNull("parent_id"); + List list = expenseTypeService.list(queryWrapper); + return Result.ok(list); + } + + @GetMapping("/{pid}") + @ApiOperation(value = "查询二级支出类型", httpMethod = "GET") + public Result> list2(@PathVariable Integer pid) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id", pid); + List list = expenseTypeService.list(queryWrapper); + return Result.ok(list); + } + + @PostMapping("") + @ApiOperation(value = "新增支出类型", httpMethod = "POST") + public Result save(@RequestBody ExpenseTypeEntity expenseTypeEntity) { + boolean b = expenseTypeService.save(expenseTypeEntity); + return Result.ok(b); + } + + @PutMapping("") + @ApiOperation(value = "更新支出类型", httpMethod = "PUT") + public Result update(@RequestBody ExpenseTypeEntity expenseTypeEntity) { + boolean b = expenseTypeService.updateById(expenseTypeEntity); + return Result.ok(b); + } + + @DeleteMapping("/{id}") + @ApiOperation(value = "删除支出类型", httpMethod = "DELETE") + public Result delete(@PathVariable Integer id) { + boolean b = expenseTypeService.removeById(id); + return Result.ok(b); + } + + @GetMapping("search/{key}") + @ApiOperation(value = "查询支出类型", httpMethod = "GET") + public Result> search(@PathVariable String key) { + List list = expenseTypeService.search(key); + return Result.ok(list); + } +} -- 2.34.1