@ -30,11 +30,13 @@ import com.epmet.constant.IcCommunitySelfOrganizationConstant;
import com.epmet.constant.UserDemandConstant ;
import com.epmet.constants.ImportTaskConstants ;
import com.epmet.dao.IcCommunitySelfOrganizationDao ;
import com.epmet.dao.IcUserDemandRecDao ;
import com.epmet.dto.IcCommunitySelfOrganizationDTO ;
import com.epmet.dto.form.* ;
import com.epmet.dto.form.demand.ServiceQueryFormDTO ;
import com.epmet.dto.result.CommunitySelfOrganizationListDTO ;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO ;
import com.epmet.dto.result.ServicePointDTO ;
import com.epmet.dto.result.UploadImgResultDTO ;
import com.epmet.dto.result.demand.OptionDTO ;
import com.epmet.entity.IcCommunitySelfOrganizationEntity ;
@ -45,7 +47,6 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.OssFeignClient ;
import com.epmet.service.IcCommunitySelfOrganizationPersonnelService ;
import com.epmet.service.IcCommunitySelfOrganizationService ;
import com.epmet.service.IcUserDemandRecService ;
import com.github.pagehelper.PageHelper ;
import com.github.pagehelper.PageInfo ;
import lombok.extern.slf4j.Slf4j ;
@ -68,8 +69,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.OutputStream ;
import java.text.ParseException ;
import java.text.SimpleDateFormat ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicBoolean ;
import java.util.concurrent.atomic.AtomicReference ;
@ -85,13 +84,12 @@ import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
* /
@Service
@Slf4j
@EnableAsync
public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl < IcCommunitySelfOrganizationDao , IcCommunitySelfOrganizationEntity > implements IcCommunitySelfOrganizationService {
@Autowired
private IcCommunitySelfOrganizationPersonnelService personnelService ;
@Autowired
private IcUserDemandRecService icUserDemandRecService ;
private IcUserDemandRecDao icUserDemandRecDao ;
@Autowired
private OssFeignClient ossFeignClient ;
@Autowired
@ -307,7 +305,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
throw new RenException ( String . format ( "查询人员{%s}信息失败" , tokenDto . getUserId ( ) ) ) ;
}
//获取单位积分
Map < String , Integer > pointMap = icUserDemandRecService . getServicePoint ( tokenDto . getCustomerId ( ) , UserDemandConstant . COMMUNITY_ORG ) ;
List < ServicePointDTO > servicePointList = icUserDemandRecDao . getServicePoint ( tokenDto . getCustomerId ( ) , UserDemandConstant . COMMUNITY_ORG ) ;
Map < String , Integer > pointMap = new HashMap < > ( ) ;
if ( CollectionUtils . isNotEmpty ( servicePointList ) ) {
pointMap = servicePointList . stream ( ) . collect ( Collectors . toMap ( ServicePointDTO : : getServerId , ServicePointDTO : : getPoint ) ) ;
}
formDTO . setAgencyId ( staffInfo . getAgencyId ( ) ) ;
formDTO . setCustomerId ( tokenDto . getCustomerId ( ) ) ;
final int [ ] i = { ( formDTO . getPageNo ( ) - NumConstant . ONE ) * formDTO . getPageSize ( ) + NumConstant . ONE } ;
@ -316,11 +318,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
PageInfo < CommunitySelfOrganizationListDTO > objectPageInfo = PageHelper . startPage ( formDTO . getPageNo ( ) , formDTO . getPageSize ( ) ) . doSelectPageInfo ( ( ) - > baseDao . selectCommunitySelfOrganizationList ( formDTO ) ) ;
result . setTotal ( Integer . valueOf ( String . valueOf ( objectPageInfo . getTotal ( ) ) ) ) ;
if ( CollectionUtils . isNotEmpty ( objectPageInfo . getList ( ) ) ) {
objectPageInfo . getList ( ) . forEach ( l - > {
for ( CommunitySelfOrganizationListDTO l : objectPageInfo . getList ( ) ) {
l . setSort ( i [ NumConstant . ZERO ] ) ;
i [ NumConstant . ZERO ] + + ;
l . setScore ( null = = pointMap . get ( l . getOrgId ( ) ) ? NumConstant . ZERO : pointMap . get ( l . getOrgId ( ) ) ) ;
} ) ;
}
result . setList ( objectPageInfo . getList ( ) ) ;
}
return result ;
@ -329,10 +331,10 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
if ( CollectionUtils . isNotEmpty ( resultDTOs ) ) {
result . setTotal ( resultDTOs . size ( ) ) ;
AtomicReference < Integer > sort = new AtomicReference < > ( NumConstant . ONE ) ;
resultDTOs . forEach ( r - > {
for ( CommunitySelfOrganizationListDTO r : resultDTOs ) {
r . setSort ( sort . getAndSet ( sort . get ( ) + NumConstant . ONE ) ) ;
r . setScore ( null = = pointMap . get ( r . getOrgId ( ) ) ? NumConstant . ZERO : pointMap . get ( r . getOrgId ( ) ) ) ;
} ) ;
}
result . setList ( resultDTOs ) ;
}
return result ;