Buggy code:
@ Service ( "RotateGroupService" ) public class RotateGroupServiceImpl implements RotateGroupService { private static final int MAX_RESULT_SIZE = 10000 ; @ Autowired RotateGroupDAO rotateGroupDAO ; @ Autowired RotateGroupShopDAO rotateGroupShopDAO ; @ Autowired ApolloShopBusinessStatusDAO apolloShopBusinessStatusDAO ; @ Autowired ApolloShopExtendDAO apolloShopExtendDAO ; @ Autowired DepartmentGroupService departmentGroupService ; private Function < RotateGroupEntity , RotateGroupDTO > toRotateGroupDTO = new Function < RotateGroupEntity , RotateGroupDTO > ( ) { @ Override public RotateGroupDTO apply ( RotateGroupEntity from ) { } } ; @ Override public RotateGroupDTO getRotateGroup ( int rotateGroupID ) { } @ Override public RotateGroupDTO getRotateGroup ( int bizID , int shopID ) { } @ Override public List < RotateGroupDTO > getRotateGroup ( List < Integer > rotateGroupIDList ) { } @ Override public RotateGroupDTO getRotateGroupWithCooperationStatus ( int rotateGroupID ) { } @ Override public RotateGroupDTO getRotateGroupWithCustomerStatus ( int rotateGroupID ) { } @ Override public boolean mergeRotateGroup ( int rotateGroupID , List < Integer > rotateGroupIDList ) { } @ Override public RotateGroupDTO createRotateGroup ( int shopGroupId , int bizID , List < Integer > apolloShopIDList ) { } @ Override public boolean deleteRotateGroupByRotateGroupID ( int rotateGroupID ) { } @ Override public RotateGroupDTO createRotateGroup ( int bizID ) { } @ Override public void updateType ( int rotateGroupID , int type ) { } @ Override public List < RotateGroupDTO > getRotateGroupList ( int shopGroupID , int bizID ) { } @ Override public List < RotateGroupDTO > getRotateGroupWithNoStatus ( int rotateGroupID ) { } @ Override public void updateTypeUsedBySplitAndMerge ( int rotateGroupID , int type ) { } @ Override public void deleteRotateGroupUsedBySplitAndMerge ( int rotateGroupID ) { } private RotateGroupEntity addRotateGroup ( int bizID , List < Integer > apolloShopIDList ) { } private void addRotateGroupShop ( int rotateGroupID , List < Integer > apolloShopIDList , int shopGroupId ) { } private void removeDuplicate ( List < Integer > apolloShopIDList ) { } private int getRotateGroupType ( List < Integer > apolloShopIDList ) { } private void updateShopExtendType ( int rotateGroupID , RotateGroupEntity rotateGroupEntity , List < Integer > rotateGroupIDList ) { } private void processRotateShopDTOCooperationStatus ( RotateGroupDTO rotateGroupDTO , int rotateGroupID ) { } private void processRotateShopDTOCustomerStatus ( RotateGroupDTO rotateGroupDTO , int rotateGroupID ) { } private RotateGroupEntity getRotateGroupEntityByBizIDAndShopID ( int bizID , int shopID ) { } private ApolloShopExtendEntity getApolloShopExtendEntityByBizIDAndShopID ( int bizID , int shopID ) { } private void processRotateShopCustomerStatus ( RotateGroupDTO rotateGroupDTO , ApolloShopExtendEntity apolloShopExtendEntity ) { } private void processRotateShopCooperationStatus ( List < ApolloShopBusinessStatusEntity > apolloShopBusinessStatusEntityList , RotateGroupDTO rotateGroupDTO ) { if ( CollectionUtils . isNotEmpty ( apolloShopBusinessStatusEntityList ) ) { <START_BUG> int rotateGroupStatusIndexTemp = 0 ; <END_BUG> List < Date > offlineTimeList = new ArrayList < Date > ( ) ; List < Integer > businessTypeList = getBusinessTypeList ( departmentGroupService . getGroupBusinesses ( rotateGroupDTO . getBizID ( ) ) ) ; for ( int i = 0 ; i < ( apolloShopBusinessStatusEntityList . size ( ) ) ; i ++ ) { ApolloShopBusinessStatusEntity apolloShopBusinessStatusEntity = apolloShopBusinessStatusEntityList . get ( i ) ; if ( businessTypeList . contains ( apolloShopBusinessStatusEntity . getBusinessType ( ) ) ) { if ( ( ONLINE . getCode ( ) ) == ( apolloShopBusinessStatusEntity . getCooperationStatus ( ) ) ) { rotateGroupStatusIndexTemp = 3 ; rotateGroupDTO . setCooperationStatus ( COOPING . getCode ( ) ) ; return ; } else if ( ( ( ( apolloShopBusinessStatusEntity . getOfflineDate ( ) ) != null ) && ( ( OFFLINE . getCode ( ) ) == ( apolloShopBusinessStatusEntity . getCooperationStatus ( ) ) ) ) && ( rotateGroupStatusIndexTemp <= 2 ) ) { rotateGroupStatusIndexTemp = 2 ; offlineTimeList . add ( apolloShopBusinessStatusEntity . getOfflineDate ( ) ) ; } else if ( ( ( ( apolloShopBusinessStatusEntity . getOfflineDate ( ) ) == null ) && ( ( OFFLINE . getCode ( ) ) == ( apolloShopBusinessStatusEntity . getCooperationStatus ( ) ) ) ) && ( rotateGroupStatusIndexTemp < 1 ) ) { rotateGroupStatusIndexTemp = 1 ; } } } if ( rotateGroupStatusIndexTemp == 2 ) { rotateGroupDTO . setCooperationStatus ( COOP_BREAK . getCode ( ) ) ; List < Date > dateList = getMinAndMaxOfflineTime ( offlineTimeList ) ; rotateGroupDTO . setMinOfflineTime ( dateList . get ( 0 ) ) ; rotateGroupDTO . setMaxOfflineTime ( dateList . get ( 1 ) ) ; } else if ( rotateGroupStatusIndexTemp == 1 ) { rotateGroupDTO . setCooperationStatus ( NO_COOP . getCode ( ) ) ; } } else { rotateGroupDTO . setCooperationStatus ( NO_COOP . getCode ( ) ) ; } } private List < Integer > getBusinessTypeList ( List < GroupBusiness > groupBusinessList ) { } private List < Date > getMinAndMaxOfflineTime ( List < Date > offlineTimeList ) { } private List < Integer > getShopIDs ( List < RotateGroupShopEntity > rotateGroupShopEntityList ) { } private RotateGroupEntity getRotateGroupEntity ( int rotateGroupID ) { } private List < RotateGroupEntity > getRotateGroupEntity ( List < Integer > rotateGroupIDList ) { } }

Fix:
int rotateGroupStatusIndexTemp = 1 ;