|
|
@ -11,6 +11,8 @@ import com.epmet.constant.ProjectEvaluateConstant; |
|
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao; |
|
|
|
import com.epmet.dao.heart.ActInfoDao; |
|
|
|
import com.epmet.dao.partymember.PartyMemberDao; |
|
|
|
import com.epmet.dao.user.UserDao; |
|
|
|
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; |
|
|
|
import com.epmet.dto.extract.form.GridIssueCountResultDTO; |
|
|
|
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; |
|
|
@ -27,6 +29,8 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.NumberFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
@ -70,6 +74,11 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
private FactIndexServiceAblityGridMonthlyDao factIndexServiceAblityGridMonthlyDao; |
|
|
|
@Autowired |
|
|
|
private ActInfoDao actInfoDao; |
|
|
|
@Autowired |
|
|
|
private UserDao userDao; |
|
|
|
@Autowired |
|
|
|
private PartyMemberDao partyMemberDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 计算网格指标党建能力 |
|
|
|
* @param customerId |
|
|
@ -391,14 +400,52 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
entity.setMonthId(monthId); |
|
|
|
entity.setQuarterId(quarterId); |
|
|
|
entity.setYearId(yearId); |
|
|
|
//网格活动组织次数 爱心活动
|
|
|
|
//网格活动组织次数 爱心活动 : 活动状态已结束并且实际结束时间在评价周期内的
|
|
|
|
if(activityCountMap.containsKey(entity.getGridId())){ |
|
|
|
entity.setActivityCount(activityCountMap.get(entity.getGridId())); |
|
|
|
} |
|
|
|
//网格志愿者占比 todo
|
|
|
|
// entity.setVolunteerRatio();
|
|
|
|
//网格党员志愿者率 todo
|
|
|
|
// entity.setPartyVolunteerRatio();
|
|
|
|
|
|
|
|
List<String> volunteerUserIds=new ArrayList<>(); |
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance(); |
|
|
|
numberFormat.setMaximumFractionDigits(NumConstant.SIX); |
|
|
|
//网格志愿者占比 : 所有注册用户中,注册了志愿者的用户占比
|
|
|
|
//(1)网格内的注册用户有哪些?
|
|
|
|
List<String> regUserIds=this.getGridRegUserIds(customerId,entity.getGridId()); |
|
|
|
if(CollectionUtils.isEmpty(regUserIds)){ |
|
|
|
log.info(String.format("当前网格%s下没有注册用户,所以网格志愿者占比volunteerRatio赋值0",entity.getGridId())); |
|
|
|
entity.setVolunteerRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
//(2)网格内注册用户中,那些人注册了志愿者?
|
|
|
|
volunteerUserIds=this.getGridRegUserVolunteer(regUserIds); |
|
|
|
if(CollectionUtils.isEmpty(volunteerUserIds)){ |
|
|
|
log.info(String.format("当前网格%s下注册用户%s个,其中志愿者为0个,所以网格志愿者占比volunteerRatio赋值0",entity.getGridId(),regUserIds.size())); |
|
|
|
entity.setVolunteerRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
int volunteerTotal=volunteerUserIds.size(); |
|
|
|
int regUserTotal=regUserIds.size(); |
|
|
|
String volunteerRatioStr = numberFormat.format((float) volunteerTotal / regUserTotal); |
|
|
|
BigDecimal volunteerRatio = new BigDecimal(volunteerRatioStr); |
|
|
|
entity.setVolunteerRatio(volunteerRatio); |
|
|
|
} |
|
|
|
} |
|
|
|
//网格党员志愿者率 : 所有志愿者中,同时是党员的占比
|
|
|
|
if(CollectionUtils.isEmpty(volunteerUserIds)){ |
|
|
|
log.info(String.format("当前网格%s下志愿者人数0个,所以网格党员志愿者率partyVolunteerRatio赋值为0",entity.getGridId())); |
|
|
|
entity.setPartyVolunteerRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
List<String> paryUserIds=this.getVolunteerPartyUserIds(volunteerUserIds); |
|
|
|
if(CollectionUtils.isEmpty(paryUserIds)){ |
|
|
|
log.info(String.format("当前网格%s下志愿者%s个,同时是党员的0个,所以网格党员志愿者率partyVolunteerRatio赋值为0",entity.getGridId(),volunteerUserIds.size())); |
|
|
|
entity.setPartyVolunteerRatio(BigDecimal.ZERO); |
|
|
|
}else{ |
|
|
|
int volunteerCount=volunteerUserIds.size(); |
|
|
|
int partyUserCount=paryUserIds.size(); |
|
|
|
String partyVolunteerRatioStr = numberFormat.format((float) partyUserCount / volunteerCount); |
|
|
|
BigDecimal partyVolunteerRatio = new BigDecimal(partyVolunteerRatioStr); |
|
|
|
entity.setPartyVolunteerRatio(partyVolunteerRatio); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//3、批量删
|
|
|
|
deleteBatchIndexServiceAblityGridMonthly(customerId,monthId); |
|
|
@ -410,6 +457,44 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.util.List<java.lang.String> |
|
|
|
* @param customerId |
|
|
|
* @param gridId |
|
|
|
* @author yinzuomei |
|
|
|
* @description 查询当前网格下,首次注册的用户ids |
|
|
|
* @Date 2020/9/21 13:44 |
|
|
|
**/ |
|
|
|
@DataSource(DataSourceConstant.EPMET_USER) |
|
|
|
private List<String> getGridRegUserIds(String customerId, String gridId) { |
|
|
|
return userDao.selectGridRegUserIds(customerId,gridId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.util.List<java.lang.String> |
|
|
|
* @param regUserIds |
|
|
|
* @author yinzuomei |
|
|
|
* @description 根据userId,查询用户是否是志愿者,返回是志愿者的用户集合 |
|
|
|
* @Date 2020/9/21 13:50 |
|
|
|
**/ |
|
|
|
@DataSource(DataSourceConstant.EPMET_HEART) |
|
|
|
private List<String> getGridRegUserVolunteer(List<String> regUserIds) { |
|
|
|
return actInfoDao.selectGridRegUserVolunteer(regUserIds); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.util.List<java.lang.String> |
|
|
|
* @param volunteerUserIds |
|
|
|
* @author yinzuomei |
|
|
|
* @description 志愿者中,同时是党员的人数 |
|
|
|
* @Date 2020/9/21 14:10 |
|
|
|
**/ |
|
|
|
@DataSource(DataSourceConstant.PARTY_MEMBER) |
|
|
|
private List<String> getVolunteerPartyUserIds(List<String> volunteerUserIds) { |
|
|
|
return partyMemberDao.selectVolunteerPartyUserIds(volunteerUserIds); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return java.util.Map<java.lang.String,java.lang.Integer> |
|
|
|
* @param customerId |
|
|
|