Commit ee41c37f authored by 麻笑宇's avatar 麻笑宇

大屏相关路径文件初始化

parent a9ff3d5b
package com.yeejoin.amos.boot.module.tcm.api.mapper; package com.yeejoin.amos.boot.module.tcm.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.*; import com.yeejoin.amos.boot.module.tcm.api.dto.*;
import com.yeejoin.amos.boot.module.tcm.api.entity.AlertCalled; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* 大屏Mapper 接口 * 大屏Mapper 接口
...@@ -19,7 +13,9 @@ import java.util.Set; ...@@ -19,7 +13,9 @@ import java.util.Set;
* @author maxy * @author maxy
* @date 2024-07-09 * @date 2024-07-09
*/ */
@Mapper
public interface ScreenMapper { public interface ScreenMapper {
List<Map<String, Object>> getCompanyInfo(@Param("screenDto") ScreenDto screenDto);
} }
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tcm.api.dto.*; import com.yeejoin.amos.boot.module.tcm.api.dto.*;
import com.yeejoin.amos.boot.module.tcm.api.enums.DispatchPaperEnums; import com.yeejoin.amos.boot.module.tcm.api.enums.DispatchPaperEnums;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List; import java.util.List;
...@@ -16,7 +17,8 @@ import java.util.Map; ...@@ -16,7 +17,8 @@ import java.util.Map;
* @author maxy * @author maxy
* @date 2024-07-09 * @date 2024-07-09
*/ */
@Service
public interface IScreenService { public interface IScreenService {
ResponseModel<Map> companyInfo(ScreenDto screenDto); List<Map<String,Object>> companyInfo(ScreenDto screenDto);
} }
...@@ -3,7 +3,16 @@ ...@@ -3,7 +3,16 @@
<mapper <mapper
namespace="com.yeejoin.amos.boot.module.tcm.api.mapper.ScreenMapper"> namespace="com.yeejoin.amos.boot.module.tcm.api.mapper.ScreenMapper">
<select id="getCompanyInfo" resultType="java.util.Map">
SELECT bi.equip_category as equipCategory,bi.unit_type as unitType
FROM (
SELECT org_code
FROM privilege_company
WHERE company_code = #{screenDto.cityCode}
) AS subquery
JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT(subquery.org_code, '%')
where bi.equip_category is not null and bi.equip_category != '[]' and bi.unit_type is not null;
</select>
</mapper> </mapper>
......
...@@ -10,9 +10,11 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -10,9 +10,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,9 +32,8 @@ public class ScreenController { ...@@ -30,9 +32,8 @@ public class ScreenController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/companyInfo") @PostMapping(value = "/companyInfo")
@ApiOperation(httpMethod = "POST", value = "大屏企业统计", notes = "大屏企业统计") @ApiOperation(httpMethod = "POST", value = "大屏企业统计", notes = "大屏企业统计")
public ResponseModel<Map> companyInfo(@RequestBody ScreenDto screenDto){ public ResponseModel<List<Map<String,Object>>> companyInfo(@RequestBody ScreenDto screenDto){
return ResponseHelper.buildResponse(screenService.companyInfo(screenDto));
return screenService.companyInfo(screenDto);
} }
} }
package com.yeejoin.amos.boot.module.tcm.biz.service.impl.statistics; package com.yeejoin.amos.boot.module.tcm.biz.service.impl.statistics;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.boot.module.tcm.api.dto.ScreenDto; import com.yeejoin.amos.boot.module.tcm.api.dto.ScreenDto;
import com.yeejoin.amos.boot.module.tcm.api.mapper.ScreenMapper;
import com.yeejoin.amos.boot.module.tcm.api.service.statistics.IScreenService; import com.yeejoin.amos.boot.module.tcm.api.service.statistics.IScreenService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map; import javax.annotation.Resource;
import java.util.*;
@Service
public class ScreenImpl implements IScreenService { public class ScreenImpl implements IScreenService {
@Resource
private ScreenMapper screenMapper;
@Override @Override
public ResponseModel<Map> companyInfo(ScreenDto screenDto) { public List<Map<String,Object>> companyInfo(ScreenDto screenDto) {
List<Map<String,Object>> list = screenMapper.getCompanyInfo(screenDto);
if(CollectionUtils.isEmpty(list)){
return list;
}
//数据处理后Map,key为企业类型+设备,value为计数
Map<String, Integer> dataMap = new HashMap<>();
for(Map<String,Object> map : list){
JSONArray equipCategoryArray = (JSONArray) JSONArray.parse((String) map.get("equipCategory"));
String[] UnitTypeArray = ((String) map.get("unitType")).split("#");
for(int i=0;i<UnitTypeArray.length;i++){
String unitTypeName = UnitTypeArray[i];
for(int j=0;j<equipCategoryArray.size();j++){
if(dataMap.containsKey(unitTypeName+equipCategoryArray.get(j))){
dataMap.put(unitTypeName+equipCategoryArray.get(j),dataMap.get(unitTypeName+equipCategoryArray.get(j))+1);
}else{
dataMap.put(unitTypeName+equipCategoryArray.get(j),1);
}
}
}
}
/**
* 4000 起重机械
* 3000 电梯
* 5000 场(厂)内机动车辆
* 1000 锅炉
* 2000 压力容器
* 6000 大型游乐设施(B类)
* 9000 客运索道
*企业数量:按单位类型及单位管理的设备进行统计(按设备类型收集制造单位数量,省、市-李静):八大类制造单位(不要气瓶)、电梯维保单位、八大类使用单位(不要气瓶)、气瓶充装单位、八大类安改维单位(不要气瓶)、八大类设计单位(不要气瓶)
* 1、设计单位只有压力容器设计和压力管道设计两类;(没有数据显示0)
* 3、安改维有锅炉、压力管道、电梯、起重机械、客运索道、场(厂)内专用机动车辆、大型游乐设施7类;
* 4、充装单位有移动式压力容器、气瓶两类(所有充装企业都统计为气瓶类型)
*/
//制造Map
Map<String,Object> zhizaoMap = new HashMap<>();
List<Map<String,Object>> zhizaoCompanyList = new ArrayList<>();
zhizaoMap.put("key","zhizaoCompany");
zhizaoMap.put("value","制造单位");
//制造电梯
Map<String,Object> zhizaodiantiMap = new HashMap<>();
zhizaodiantiMap.put("key","key01");
zhizaodiantiMap.put("name","电梯");
zhizaodiantiMap.put("value",dataMap.getOrDefault("制造单位3000",0));
zhizaoCompanyList.add(zhizaodiantiMap);
//制造锅炉
Map<String,Object> zhizaoguoluMap = new HashMap<>();
zhizaoguoluMap.put("key","key02");
zhizaoguoluMap.put("name","锅炉");
zhizaoguoluMap.put("value",dataMap.getOrDefault("制造单位1000",0));
zhizaoCompanyList.add(zhizaoguoluMap);
//制造锅炉
Map<String,Object> zhizaojidongcheMap = new HashMap<>();
zhizaojidongcheMap.put("key","key03");
zhizaojidongcheMap.put("name","场内机动车");
zhizaojidongcheMap.put("value",dataMap.getOrDefault("制造单位5000",0));
zhizaoCompanyList.add(zhizaojidongcheMap);
//制造压力容器
Map<String,Object> zhizaoyalirongqiMap = new HashMap<>();
zhizaoyalirongqiMap.put("key","key04");
zhizaoyalirongqiMap.put("name","压力容器");
zhizaoyalirongqiMap.put("value",dataMap.getOrDefault("制造单位2000",0));
zhizaoCompanyList.add(zhizaoyalirongqiMap);
//制造起重机械
Map<String,Object> zhizaoqizhongjixieMap = new HashMap<>();
zhizaoqizhongjixieMap.put("key","key06");
zhizaoqizhongjixieMap.put("name","起重机械");
zhizaoqizhongjixieMap.put("value",dataMap.getOrDefault("制造单位4000",0));
zhizaoCompanyList.add(zhizaoqizhongjixieMap);
//制造游乐设施
Map<String,Object> zhizaoyoulesheshiMap = new HashMap<>();
zhizaoyoulesheshiMap.put("key","key07");
zhizaoyoulesheshiMap.put("name","大型游乐设施");
zhizaoyoulesheshiMap.put("value",dataMap.getOrDefault("制造单位6000",0));
zhizaoCompanyList.add(zhizaoyoulesheshiMap);
//制造客运索道
Map<String,Object> zhizaokeyunsuodaoMap = new HashMap<>();
zhizaokeyunsuodaoMap.put("key","key08");
zhizaokeyunsuodaoMap.put("name","客运索道");
zhizaokeyunsuodaoMap.put("value",dataMap.getOrDefault("制造单位9000",0));
zhizaoCompanyList.add(zhizaokeyunsuodaoMap);
zhizaoMap.put("data",zhizaoCompanyList);
return null; return null;
} }
} }
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