|
@@ -43,8 +43,6 @@ import com.minto.tap.task.api.TaskApi;
|
|
|
import com.minto.tip.common.authenticate.bo.User;
|
|
|
import com.minto.tip.common.exceptions.BusinessException;
|
|
|
import com.minto.tip.organization.enums.RelationValueName;
|
|
|
-import freemarker.core.ArithmeticEngine;
|
|
|
-import org.apache.commons.math3.dfp.DfpField;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -514,21 +512,42 @@ public class TaskAnalysisManagerImpl implements ITaskAnalysisManager{
|
|
|
tOverduePercent = NumberUtil.getPercent(tOverdueCount, tAllCount, 1);
|
|
|
}
|
|
|
}
|
|
|
+ //计算每颗星星的分数
|
|
|
+ Long maxScore =
|
|
|
+ allTaskCounts.stream().map(e -> ParameterUtil.getLong(e, "score")).filter(Objects::nonNull)
|
|
|
+ .max(Comparator.naturalOrder()).orElse(0L);
|
|
|
+ BigDecimal singleStarScore = new BigDecimal(maxScore.toString()).divide(new BigDecimal("5"),0,
|
|
|
+ RoundingMode.HALF_UP);
|
|
|
+ if(singleStarScore.compareTo(BigDecimal.ONE)<0){
|
|
|
+ singleStarScore = BigDecimal.ONE;
|
|
|
+ }
|
|
|
|
|
|
//组装列表数据
|
|
|
for(Map<String, Object> map : allTaskCounts){
|
|
|
Long resourceId = ParameterUtil.getLong(map, "resourceId");
|
|
|
Long resourceType = ParameterUtil.getLong(map, "resourceType");
|
|
|
+ BigDecimal score = ParameterUtil.getBigDecimal(map, "score");
|
|
|
+ //计算星星个数
|
|
|
+ BigDecimal star = score.divide(singleStarScore, 2, RoundingMode.HALF_UP)
|
|
|
+ .divide(new BigDecimal("5"), 1, RoundingMode.HALF_UP);
|
|
|
+ if(BigDecimal.ZERO.compareTo(star)>0){
|
|
|
+ star = BigDecimal.ZERO;
|
|
|
+ }else if(new BigDecimal("5").compareTo(star)<0){
|
|
|
+ star = new BigDecimal("5");
|
|
|
+ }
|
|
|
+ map.put("star",star.doubleValue());
|
|
|
|
|
|
//责任单位
|
|
|
String managerName = "";
|
|
|
if(resourceType == ResourceEnum.ResourceTypeEnum.OrgDepartment.getKey() && depMap.containsKey(resourceId)){
|
|
|
OrgUnitBean orgDepartmentBean = depMap.get(resourceId);
|
|
|
managerName = orgDepartmentBean.getDname();
|
|
|
+ map.put("pid", null);
|
|
|
} else if(resourceType == ResourceEnum.ResourceTypeEnum.OrgPerson.getKey() && personMap.containsKey(
|
|
|
resourceId)){
|
|
|
OrgPersonBean orgPersonBean = personMap.get(resourceId);
|
|
|
managerName = orgPersonBean.getPname();
|
|
|
+ map.put("pid", orgPersonBean.getId());
|
|
|
}
|
|
|
map.put("targetName", managerName);
|
|
|
|