|
@@ -0,0 +1,65 @@
|
|
|
+package cn.cslg.pas.factorys.reGroupFactory;
|
|
|
+
|
|
|
+import cn.cslg.pas.common.model.cronModel.ReGroupDataVO;
|
|
|
+import cn.cslg.pas.common.vo.EntityVO;
|
|
|
+import cn.cslg.pas.common.vo.EntrustVO;
|
|
|
+import cn.cslg.pas.domain.business.Matter;
|
|
|
+import cn.cslg.pas.mapper.EventMapper;
|
|
|
+import cn.cslg.pas.service.business.MatterService;
|
|
|
+import cn.cslg.pas.service.permissions.PermissionService;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Component
|
|
|
+public class GetEntrustGroup implements QueryGroupImp {
|
|
|
+ @Autowired
|
|
|
+ private EventMapper eventMapper;
|
|
|
+ @Autowired
|
|
|
+ private PermissionService permissionService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ReGroupDataVO getGroup(List<String> sqls, String tableName, String groupField) {
|
|
|
+ groupField = "p.entrust_type,p.entrust_id";
|
|
|
+ ReGroupDataVO reGroupDataVO = new ReGroupDataVO();
|
|
|
+ List<Map<String, Object>> maps = new ArrayList<>();
|
|
|
+ String selectField = groupField;
|
|
|
+ List<EntrustVO> entrustVOList = new ArrayList<>();
|
|
|
+ try {
|
|
|
+ String json = permissionService.getEntrustsOrder(0);
|
|
|
+ entrustVOList = JSON.parseArray(json, EntrustVO.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
+
|
|
|
+ List<EntrustVO> entrustVOS = eventMapper.getEntrustGroup(sqls, tableName, groupField, selectField);
|
|
|
+ Long total = eventMapper.getEntrustGroupCount(sqls, tableName, groupField, selectField);
|
|
|
+ //装载调查类型名称
|
|
|
+ for (EntrustVO item : entrustVOS) {
|
|
|
+ if (item == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ EntrustVO entrustVO = entrustVOList.stream().filter(tem -> tem.getEntrustId().equals(item.getEntrustId()) && tem.getEntrustType().equals(item.getEntrustType())).findFirst().orElse(null);
|
|
|
+ if (entrustVO != null) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("name", entrustVO.getName());
|
|
|
+ map.put("value", entrustVO.getName());
|
|
|
+ map.put("count",item.getNum());
|
|
|
+ maps.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ reGroupDataVO.setValues(maps);
|
|
|
+ reGroupDataVO.setTotal(total);
|
|
|
+ return reGroupDataVO;
|
|
|
+ }
|
|
|
+
|
|
|
+ ;
|
|
|
+
|
|
|
+}
|