Commit 814c0392 authored by DESKTOP-BQLVS7A\admin's avatar DESKTOP-BQLVS7A\admin

优化设备弹窗统计接口(权限)

parent 57257f57
package com.yeejoin.amos.boot.module.ugp.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.Company;
import com.yeejoin.amos.boot.module.ugp.api.entity.Equipment;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
......@@ -23,5 +21,5 @@ import java.util.Set;
public interface EquipmentMapper extends BaseMapper<Equipment> {
IPage<EquipmentDto> queryEquipmentPage(IPage<EquipmentDto> page, Equipment equipment, Set<String> companyIds);
List<Map<String, Long>> informationStatistics(@Param("companySequenceNbr") Long companySequenceNbr);
List<Map<String, Long>> informationStatistics(@Param("companyIds") Set<String> companyIds);
}
......@@ -26,7 +26,16 @@
</select>
<select id="informationStatistics" parameterType="Long" resultType="java.util.HashMap">
SELECT type as name ,count(1) AS value FROM tz_ugp_equipment where company_id = #{companySequenceNbr} GROUP BY type
SELECT type as name ,count(1) AS value FROM tz_ugp_equipment
<where>
<if test="companyIds !=null and companyIds.size>0">
and company_id in
<foreach collection="companyIds" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY type
</select>
</mapper>
......@@ -8,11 +8,14 @@ import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.entity.*;
import com.yeejoin.amos.boot.module.ugp.api.mapper.CompanyMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.EquipmentMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.ProjectMapper;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.IEquipmentService;
import com.yeejoin.amos.boot.module.ugp.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.ugp.biz.framework.BusinessIdentify;
......@@ -44,11 +47,17 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
OrgServiceImpl orgService;
@Autowired
SuperviseRuleMapper superviseRuleMapper;
@Autowired
SuperviseRuleServiceImpl superviseRuleService;
@Autowired
CompanyServiceImpl companyService;
@Autowired
CompanyMapper companyMapper;
/**
* 分页查询
......@@ -239,8 +248,44 @@ public class EquipmentServiceImpl extends BaseService<EquipmentDto, Equipment, E
//设备管理->信息统计
@BusinessIdentify
public List<Map<String,Long>> informationStatistics() {
// List<Map<String,Long>> D = new ArrayList<>();
// Map<String,Long> w = new HashMap<>();
Set<String> strings = new HashSet<>();
Long companySequenceNbr = orgService.getReginParams().getBusinessInfo().getCompanySequenceNbr();
return equipmentMapper.informationStatistics(companySequenceNbr);
if(companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.安装单位.getKey())){
LambdaQueryWrapper<Equipment> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Equipment::getSequenceNbr,companySequenceNbr);
strings.add(String.valueOf(companySequenceNbr));
} else if (companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.监检机构.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getInspectionUnitId,companySequenceNbr);
List<SuperviseRule> inspectionLists = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule inspectionList : inspectionLists){
LambdaQueryWrapper<Company> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(Company::getRegionCode,inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1);
for(Company codeList : codeLists){
strings.add(String.valueOf(codeList.getSequenceNbr()));
}
}
} else if (companyMapper.selectById(companySequenceNbr).getType().equals(OrgEnum.监察部门.getKey())) {
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SuperviseRule::getSuperviseDeptId, companySequenceNbr);
List<SuperviseRule> superviseLists = superviseRuleMapper.selectList(wrapper);
for (SuperviseRule inspectionList : superviseLists) {
LambdaQueryWrapper<Company> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(Company::getRegionCode, inspectionList.getAdminRegionCode());
List<Company> codeLists = companyMapper.selectList(wrapper1);
for (Company codeList : codeLists) {
strings.add(String.valueOf(codeList.getSequenceNbr()));
}
}
}
return equipmentMapper.informationStatistics(strings);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment