大数据统计接口

This commit is contained in:
ly19960718 2021-08-12 11:33:00 +08:00
parent 9e6079260e
commit fdfc7a2111
2 changed files with 41 additions and 3 deletions

View File

@ -2,12 +2,16 @@ package com.cm.inspection.controller.app.resources.enterprise;
import com.cm.common.base.AbstractController;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.plugin.oauth.service.group.IGroupService;
import com.cm.common.plugin.pojo.bos.UserResourceBO;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.bos.GroupBO;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.controller.app.resources.BigDataResult;
import com.cm.inspection.enums.enterpriseTypeEnum;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.service.enterprise.IEnterpriseService;
import com.cm.inspection.service.enterpriseofgridoperator.IEnterpriseOfGridOperatorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,8 +32,10 @@ public class EnterpriseCountController extends AbstractController {
@Autowired
private IEnterpriseService enterpriseService;
@Autowired
private IGroupService groupService;
@Autowired
private IEnterpriseOfGridOperatorService eoosService;
@ApiOperation(value = "统计企业类型", notes = "统计企业类型接口")
@GetMapping("count-enterprisetype")
@ -110,12 +116,38 @@ public class EnterpriseCountController extends AbstractController {
@GetMapping("enterprise-list")
public SuccessResultList<List<Map<String,Object>>> enterpriseList(ListPage page){
Map<String, Object> params = requestParams();
if(params.get("groupId") != null){
List<String> userId = new ArrayList<>();
List<UserResourceBO> userList = groupService.listUser(params.get("groupId").toString());
for (UserResourceBO userResourceBO : userList) {
userId.add(userResourceBO.getUserId());
}
List<String> enterpriseIds = eoosService.listEnterpriseIdOfUserIds(userId);
params.put("enterpriseIds",enterpriseIds);
}
page.setParams(params);
SuccessResultList<List<Map<String, Object>>> listSuccessResultList = enterpriseService.listPageBigData(page);
return listSuccessResultList;
}
@ApiOperation(value = "获取人员分组", notes = "获取人员分组接口")
@GetMapping("get-group-list")
public BigDataResult getGroupList(){
BigDataResult result = new BigDataResult();
List<Map<String,Object>> list = new ArrayList<>();
List<GroupBO> groupBOList = groupService.list("0");
for (GroupBO groupBO : groupBOList) {
Map<String,Object> params = new HashMap<>();
params.put("id",groupBO.getGroupId());
params.put("name",groupBO.getGroupName());
list.add(params);
}
result.setList(list);
return result;
}

View File

@ -837,7 +837,13 @@
AND
t2.enterprise_type = #{enterpriseType}
</if>
<if test="enterpriseIds != null and enterpriseIds.size > 0">
AND
t1.enterprise_id IN
<foreach collection="enterpriseIds" index="index" open="(" separator="," close=")">
#{enterpriseIds[${index}]}
</foreach>
</if>
</select>