|
@@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.sql.Array;
|
|
|
import java.sql.SQLException;
|
|
|
import java.util.*;
|
|
@@ -123,7 +124,7 @@ public class TaskTypeSettingManagerImpl implements ITaskTypeSettingManager{
|
|
|
public void saveCaseProportion(Long userId, Long taskId, Integer typeState) {
|
|
|
DetachedCriteria detachedCriteria = DetachedCriteria.forClass(TaskTypeSettingBean.class);
|
|
|
detachedCriteria.add(Restrictions.eq("referenceId",taskId));
|
|
|
- detachedCriteria.add(Restrictions.eq("typeId",-1));
|
|
|
+ detachedCriteria.add(Restrictions.eq("typeId",-1L));
|
|
|
TaskTypeSettingBean bean = (TaskTypeSettingBean) taskTypeSettingDao.get(detachedCriteria);
|
|
|
|
|
|
if (null == bean){
|
|
@@ -143,16 +144,32 @@ public class TaskTypeSettingManagerImpl implements ITaskTypeSettingManager{
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<Long, BigDecimal> findReachPerGroupByTypeId() {
|
|
|
- List<Map<String, Object>> list = taskTypeSettingDao.findReachCountGroupByTypeId();
|
|
|
+ public Map<Long, BigDecimal> findReachPerGroupByTypeId(Map<String, Object> param) {
|
|
|
+ List<Map<String, Object>> list = taskTypeSettingDao.findReachCountGroupByTypeId(param);
|
|
|
Map<Long, BigDecimal> map = new HashMap<>();
|
|
|
if (!list.isEmpty()){
|
|
|
list.stream().forEach(e -> {
|
|
|
BigDecimal hundredBigDecimal = new BigDecimal(100);
|
|
|
BigDecimal reachPer = new BigDecimal(e.get("reachNum").toString()).divide(new BigDecimal(e.get("allNum").toString()), 2, BigDecimal.ROUND_HALF_UP);
|
|
|
- map.put(Long.parseLong(e.get("id").toString()),reachPer.multiply(hundredBigDecimal));
|
|
|
+ map.put(Long.parseLong(e.get("typeId").toString()),reachPer.multiply(hundredBigDecimal).setScale(0, RoundingMode.DOWN));
|
|
|
});
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> calculateCaseProportion(Map<String, Object> param) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("name","案件比");
|
|
|
+ map.put("allNum",0);
|
|
|
+ List<Map<String, Object>> list = taskTypeSettingDao.findCaseProportion(param);
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ Map<String, Object> caseProportionMap = list.get(0);
|
|
|
+ BigDecimal caseProportion = new BigDecimal(caseProportionMap.get("caseProportionSum").toString()).divide(new BigDecimal(caseProportionMap.get("allNum").toString()), 1, BigDecimal.ROUND_HALF_UP);
|
|
|
+ map.put("caseProportion",caseProportion);
|
|
|
+ map.put("allNum",caseProportionMap.get("allNum"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return map;
|
|
|
+ }
|
|
|
}
|