Commit 7b4a899e authored by 刘林's avatar 刘林

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…

Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents 0a7c0921 7a7a46ee
...@@ -31,4 +31,9 @@ public class DPFilterParamDto { ...@@ -31,4 +31,9 @@ public class DPFilterParamDto {
* 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废 * 业务类型0告知管理,1使用登记,2变更登记,3停用启用,4注销报废
*/ */
private String businessKey; private String businessKey;
/**
* month , year
*/
private String searchType;
} }
...@@ -28,7 +28,9 @@ public enum DPMapStatisticsItemEnum { ...@@ -28,7 +28,9 @@ public enum DPMapStatisticsItemEnum {
CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""), CONSTRUCTION_UNITS("安改维单位 (家)", "constructionUnits", ""),
USERS_UNITS("使用单位 (家)", "usersUnits", ""), USERS_UNITS("使用单位 (家)", "usersUnits", ""),
GAS_UNITS("充装单位 (家)", "gasUnits", ""), GAS_UNITS("充装单位 (家)", "gasUnits", ""),
OPERATORS("作业人员 (人)", "operators", ""); OPERATORS("作业人员 (人)", "operators", ""),
DEVICE_COUNT("已纳管设备数", "deviceCount", ""),
CERTIFICATE_COUNT("登记证总量", "certificateCount", "");
private String label; private String label;
private String code; private String code;
private String category; private String category;
......
...@@ -56,4 +56,15 @@ public interface DPStatisticsMapper { ...@@ -56,4 +56,15 @@ public interface DPStatisticsMapper {
List<Map<String, Object>> changeUnitEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime); List<Map<String, Object>> changeUnitEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> vehicleEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime); List<Map<String, Object>> vehicleEquCount(@Param("cityCode") String cityCode,@Param("startTime") String startTime);
List<Map<String, Object>> newRegEquCountByMonth(@Param("cityCode") String cityCode);
List<Map<String, Object>> newVehicleEquCountByMonth(@Param("cityCode") String cityCode);
List<Map<String, Object>> newRegEquCountByYear(@Param("cityCode") String cityCode);
List<Map<String, Object>> newVehicleEquCountByYear(@Param("cityCode") String cityCode);
String newVehicleCountByYear(@Param("cityCode") String cityCode);
String newVehicleCountByMonth(@Param("cityCode") String cityCode);
} }
package com.yeejoin.amos.boot.module.jg.api.mapper; package com.yeejoin.amos.boot.module.jg.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationDto;
import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto; import com.yeejoin.amos.boot.module.jg.api.dto.JgUseRegistrationManageDto;
import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage; import com.yeejoin.amos.boot.module.jg.api.entity.JgUseRegistrationManage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jg.api.vo.SortVo; import com.yeejoin.amos.boot.module.jg.api.vo.SortVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
...@@ -25,4 +23,6 @@ public interface JgUseRegistrationManageMapper extends BaseMapper<JgUseRegistrat ...@@ -25,4 +23,6 @@ public interface JgUseRegistrationManageMapper extends BaseMapper<JgUseRegistrat
Page<JgUseRegistrationManageDto> queryForPage(@Param("page") Page<JgUseRegistrationManageDto> page, Page<JgUseRegistrationManageDto> queryForPage(@Param("page") Page<JgUseRegistrationManageDto> page,
@Param("dto") JgUseRegistrationManageDto dto, @Param("dto") JgUseRegistrationManageDto dto,
@Param("sort") SortVo sortMap); @Param("sort") SortVo sortMap);
Long countCertificateByReginCode(String orgCode);
} }
...@@ -415,5 +415,113 @@ ...@@ -415,5 +415,113 @@
jri.equ_category jri.equ_category
</select> </select>
<select id="newRegEquCountByMonth" resultType="java.util.Map">
SELECT COUNT
( 1 ) ,
DATE_FORMAT(ur.rec_date,'%Y-%m-%d')
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_use_registration_eq te ON te.equip_transfer_id = ur.sequence_nbr
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y-%m') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y-%m-%d')
ORDER BY
ur.rec_date
</select>
<select id="newVehicleEquCountByMonth" resultType="java.util.Map">
SELECT COUNT
( 1 ) ,
DATE_FORMAT(ur.rec_date,'%Y-%m-%d')
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
INNER JOIN tzs_jg_vehicle_information_eq te ON te.vehicle_id = ur.sequence_nbr
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y-%m') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y-%m-%d')
ORDER BY
ur.rec_date
</select>
<select id="newRegEquCountByYear" resultType="java.util.Map">
SELECT COUNT
( 1 ) ,
DATE_FORMAT(ur.rec_date,'%Y-%m')
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_use_registration ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.audit_status = '已完成'
INNER JOIN tzs_jg_use_registration_eq te ON te.equip_transfer_id = ur.sequence_nbr
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y-%m')
ORDER BY
ur.rec_date
</select>
<select id="newVehicleEquCountByYear" resultType="java.util.Map">
SELECT COUNT
( 1 ) ,
DATE_FORMAT(ur.rec_date,'%Y-%m')
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
INNER JOIN tzs_jg_vehicle_information_eq te ON te.vehicle_id = ur.sequence_nbr
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y-%m')
ORDER BY
ur.rec_date
</select>
<select id="newVehicleCountByYear" resultType="String">
SELECT COUNT
( 1 )
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y')
ORDER BY
ur.rec_date
</select>
<select id="newVehicleCountByMonth" resultType="String">
SELECT COUNT
( 1 )
FROM
privilege_company pc
INNER JOIN tz_base_enterprise_info bi ON bi.supervise_org_code LIKE CONCAT ( pc.org_code, '%' )
INNER JOIN tzs_jg_vehicle_information ur ON ur.use_unit_credit_code = bi.use_unit_code
AND ur.status = '已完成'
WHERE
pc.company_code = #{cityCode}
AND ur.rec_date like concat('%',DATE_FORMAT(CURDATE(), '%Y-%m') ,'%')
GROUP BY
DATE_FORMAT(ur.rec_date,'%Y-%m')
ORDER BY
ur.rec_date
</select>
</mapper> </mapper>
...@@ -134,4 +134,16 @@ ...@@ -134,4 +134,16 @@
tjurm.rec_date DESC tjurm.rec_date DESC
</where> </where>
</select> </select>
<select id="countCertificateByReginCode" resultType="java.lang.Long">
select
count(1)
from
tzs_jg_use_registration_manage tjurm
left join
privilege_company pc
on tjurm.receive_company_code = pc.company_code
where
pc.org_code like concat (#{reginCode},'%')
and tjurm.certificate_status = '已登记'
</select>
</mapper> </mapper>
...@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
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.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -202,4 +199,48 @@ public class DPStatisticsController { ...@@ -202,4 +199,48 @@ public class DPStatisticsController {
} }
return ResponseHelper.buildResponse(statisticsService.getRegEquCount(dpFilterParamDto)); return ResponseHelper.buildResponse(statisticsService.getRegEquCount(dpFilterParamDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-左侧新增情况", notes = "监管大屏-左侧新增情况")
@PostMapping(value = "/newRegEquCount")
public ResponseModel<Map<String,Object>> newRegEquCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.newRegEquCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "监管大屏-新增登记新增设备统计", notes = "监管大屏-新增登记新增设备统计")
@PostMapping(value = "/newRegCount")
public ResponseModel<List<Map<String,Object>>> newRegCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.newRegCount(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-各地市数据统计", notes = "大屏监管-中屏-各地市数据统计")
@PostMapping(value = "/jg/centre/dataStatistic")
public ResponseModel<List<Map<String, Object>>> dataStatisticByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.dataStatisticByReginCode(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏监管-中屏-当前区域数据统计", notes = "大屏监管-中屏-当前区域数据统计")
@PostMapping(value = "/jg/centre/dataStatisticCount")
public ResponseModel<Map<String, Object>> dataStatisticCountByReginCode(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.dataStatisticCountByReginCode(dpFilterParamDto));
}
} }
...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.yeejoin.amos.boot.biz.common.dto.CountDto; import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto; import com.yeejoin.amos.boot.module.common.api.dto.LegendDataDto;
import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto; import com.yeejoin.amos.boot.module.jg.api.dto.EquipBizCountDto;
...@@ -35,7 +34,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde ...@@ -35,7 +34,7 @@ import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilde
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
...@@ -88,7 +87,7 @@ public class DPStatisticsServiceImpl { ...@@ -88,7 +87,7 @@ public class DPStatisticsServiceImpl {
*/ */
private final static String COMPANY_TYPE_FILLING = "充装单位"; private final static String COMPANY_TYPE_FILLING = "充装单位";
@Autowired
private EquipmentCategoryMapper equipmentCategoryMapper; private EquipmentCategoryMapper equipmentCategoryMapper;
private JgUseRegistrationMapper useRegistrationMapper; private JgUseRegistrationMapper useRegistrationMapper;
...@@ -113,10 +112,11 @@ public class DPStatisticsServiceImpl { ...@@ -113,10 +112,11 @@ public class DPStatisticsServiceImpl {
private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>(); private static Map<String, String> regionCodeOrgCodeMap = new ConcurrentHashMap<>();
private static List<RegionModel> regionModels = new ArrayList<>(); private static List<RegionModel> regionModels = new ArrayList<>();
@Resource @Resource
private DPStatisticsMapper dpStatisticsMapper; private DPStatisticsMapper dpStatisticsMapper;
@Autowired
private JgUseRegistrationManageMapper jgUseRegistrationManageMapper;
public DPStatisticsServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper, JgUseRegistrationMapper useRegistrationMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, JgEnableDisableMapper enableDisableMapper, JgScrapCancelMapper scrapCancelMapper, RestHighLevelClient restHighLevelClient, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, CommonMapper commonMapper, TzsUserInfoMapper userInfoMapper) { public DPStatisticsServiceImpl(EquipmentCategoryMapper equipmentCategoryMapper, JgUseRegistrationMapper useRegistrationMapper, EquipTechParamPipelineMapper techParamsPipelineMapper, JgEnableDisableMapper enableDisableMapper, JgScrapCancelMapper scrapCancelMapper, RestHighLevelClient restHighLevelClient, TzBaseEnterpriseInfoMapper enterpriseInfoMapper, CommonMapper commonMapper, TzsUserInfoMapper userInfoMapper) {
this.equipmentCategoryMapper = equipmentCategoryMapper; this.equipmentCategoryMapper = equipmentCategoryMapper;
...@@ -1275,4 +1275,170 @@ public class DPStatisticsServiceImpl { ...@@ -1275,4 +1275,170 @@ public class DPStatisticsServiceImpl {
return resultMap; return resultMap;
} }
public List<Map<String, Object>> dataStatisticByReginCode(DPFilterParamDto dpFilterParamDto) {
List<Map<String, Object>> result = regionModels.parallelStream().filter(e -> e.getParentRegionCode() != null && (e.getParentRegionCode().toString()).equals(dpFilterParamDto.getCityCode())).map(r -> {
DPFilterParamDto filterParamDto = new DPFilterParamDto();
filterParamDto.setCityCode(r.getRegionCode().toString());
Map<String, Object> itemResult = staticsCenterMapCountDataForRegin(filterParamDto);
if (itemResult == null) {
itemResult = new HashMap<>();
}
itemResult.put("regionCode", r.getRegionCode());
itemResult.put("regionName", r.getRegionName());
return itemResult;
}).collect(Collectors.toList());
return result;
}
private Map<String, Object> staticsCenterMapCountDataForRegin(DPFilterParamDto dpFilterParamDto) {
Map<String, Object> result = new HashMap<>();
String orgCode = regionCodeOrgCodeMap.get(dpFilterParamDto.getCityCode());
if (orgCode == null) {
orgCode = commonMapper.getOrgCodeByCompanyCode(dpFilterParamDto.getCityCode());
if (orgCode == null) {
result.put(DPMapStatisticsItemEnum.DEVICE_COUNT.getCode(), 0);
result.put(DPMapStatisticsItemEnum.CERTIFICATE_COUNT.getCode(), 0);
return result;
}
regionCodeOrgCodeMap.put(dpFilterParamDto.getCityCode(), orgCode);
}
Long certificateCount = jgUseRegistrationManageMapper.countCertificateByReginCode(orgCode);
Long deviceCount = equipmentCategoryMapper.countEquipByReginCode(orgCode);
result.put(DPMapStatisticsItemEnum.CERTIFICATE_COUNT.getCode(), certificateCount);
result.put(DPMapStatisticsItemEnum.DEVICE_COUNT.getCode(), deviceCount);
return result;
}
public Map<String, Object> dataStatisticCountByReginCode(DPFilterParamDto dpFilterParamDto) {
Map<String,Object> resultMap = new HashMap<>();
List<Map<String, Object>> mapList = this.dataStatisticByReginCode(dpFilterParamDto);
if(ObjectUtils.isEmpty(mapList)){
resultMap.put(DPMapStatisticsItemEnum.CERTIFICATE_COUNT.getCode(), 0);
resultMap.put(DPMapStatisticsItemEnum.DEVICE_COUNT.getCode(), 0);
return resultMap;
}
long certificateCount = mapList.stream().mapToLong(x -> (Long) x.get("certificateCount")).sum();
long deviceCount = mapList.stream().mapToLong(x -> (Long) x.get("deviceCount")).sum();
resultMap.put(DPMapStatisticsItemEnum.CERTIFICATE_COUNT.getCode(), certificateCount);
resultMap.put(DPMapStatisticsItemEnum.DEVICE_COUNT.getCode(), deviceCount);
return resultMap;
}
public Map<String,Object> newRegEquCount(DPFilterParamDto dpFilterParamDto) {
Map<String,Object> resultMap = new HashMap<>();
Map<String,Object> map = new HashMap<>();
map.put("dataKey","newRegisterEq");
map.put("value","新增登记设备");
List<Map<String,Object>> legendData = new ArrayList<>();
legendData.add(map);
resultMap.put("legendData",legendData);
List xDataList = new ArrayList<>();
List newRegisterEq = new ArrayList<>();
Map<String,Object> useCountMap = new HashMap<>();
Map<String,Object> vehicleCountMap = new HashMap<>();
if("month".equals(dpFilterParamDto.getSearchType())){
List<Map<String,Object>> useCountList = dpStatisticsMapper.newRegEquCountByMonth(dpFilterParamDto.getCityCode());
List<Map<String,Object>> vehicleCountList = dpStatisticsMapper.newVehicleEquCountByMonth(dpFilterParamDto.getCityCode());
for(int i = 0; i < useCountList.size(); i++){
useCountMap.put(useCountList.get(i).getOrDefault("date_format","")+"",Integer.valueOf(useCountList.get(i).getOrDefault("count",0)+""));
}
for(int i = 0; i < vehicleCountList.size(); i++){
vehicleCountMap.put(vehicleCountList.get(i).getOrDefault("date_format","")+"",Integer.valueOf(vehicleCountList.get(i).getOrDefault("count",0)+""));
}
for(int i = 0; i < LocalDate.now().getDayOfMonth(); i++){
xDataList.add(LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
newRegisterEq.add(Integer.valueOf(useCountMap.getOrDefault(LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),0)+"")
+Integer.valueOf(vehicleCountMap.getOrDefault(LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),0)+""));
}
}else if("year".equals(dpFilterParamDto.getSearchType())){
List<Map<String,Object>> useCountList = dpStatisticsMapper.newRegEquCountByYear(dpFilterParamDto.getCityCode());
List<Map<String,Object>> vehicleCountList = dpStatisticsMapper.newVehicleEquCountByYear(dpFilterParamDto.getCityCode());
for(int i = 0; i < useCountList.size(); i++){
useCountMap.put(useCountList.get(i).getOrDefault("date_format","")+"",Integer.valueOf(useCountList.get(i).getOrDefault("count",0)+""));
}
for(int i = 0; i < vehicleCountList.size(); i++){
vehicleCountMap.put(vehicleCountList.get(i).getOrDefault("date_format","")+"",Integer.valueOf(vehicleCountList.get(i).getOrDefault("count",0)+""));
}
for (int i = 0; i < LocalDate.now().getMonth().getValue(); i++){
xDataList.add(LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")));
newRegisterEq.add(Integer.valueOf(useCountMap.getOrDefault(LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")),0)+"")
+Integer.valueOf(vehicleCountMap.getOrDefault(LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")),0)+""));
}
}
Collections.reverse(xDataList);
Collections.reverse(newRegisterEq);
resultMap.put("xdata",xDataList);
resultMap.put("newRegisterEq",newRegisterEq);
return resultMap;
}
public List<Map<String,Object>> newRegCount(DPFilterParamDto dpFilterParamDto) {
List<Map<String,Object>> resultList = new ArrayList<>();
//年使用登记设备
List<Map<String,Object>> useEquCountListYear = dpStatisticsMapper.newRegEquCountByYear(dpFilterParamDto.getCityCode());
//年气瓶使用登记设备
List<Map<String,Object>> vehicleEquCountListYear = dpStatisticsMapper.newVehicleEquCountByYear(dpFilterParamDto.getCityCode());
//月使用登记设备
List<Map<String,Object>> useEquCountListMonth = dpStatisticsMapper.newRegEquCountByMonth(dpFilterParamDto.getCityCode());
//月气瓶使用登记设备
List<Map<String,Object>> vehicleEquCountListMonth = dpStatisticsMapper.newVehicleEquCountByMonth(dpFilterParamDto.getCityCode());
//年气瓶使用登记
String vehicleCountYear = dpStatisticsMapper.newVehicleCountByYear(dpFilterParamDto.getCityCode());
//月气瓶使用登记
String vehicleCountListMonth = dpStatisticsMapper.newVehicleCountByMonth(dpFilterParamDto.getCityCode());
/**
* [ { "name": "本年新增登记", "value": 52 }, { "name": "本年新增设备", "value": 83 },
* { "name": "本月新增登记", "value": 16 }, { "name": "本月新增设备", "value": 50 } ]
*/
int useYear = 0;
int useMonth = 0;
int usrEqYear = 0;
int usrEqMonth = 0;
//本年新增登记
for(int i = 0 ; i < useEquCountListYear.size() ; i++){
useYear += Integer.valueOf(useEquCountListYear.get(i).getOrDefault("count",0)+"");
usrEqYear += Integer.valueOf(useEquCountListYear.get(i).getOrDefault("count",0)+"");
}
useYear += StringUtils.isBlank(vehicleCountYear)?0:Integer.valueOf(vehicleCountYear);
//本年新增设备
for(int i = 0 ; i < vehicleEquCountListYear.size() ; i++){
usrEqYear += Integer.valueOf(vehicleEquCountListYear.get(i).getOrDefault("count",0)+"");
}
//本月新增登记
for(int i = 0 ; i < useEquCountListMonth.size() ; i++){
useMonth += Integer.valueOf(useEquCountListMonth.get(i).getOrDefault("count",0)+"");
usrEqMonth += Integer.valueOf(useEquCountListMonth.get(i).getOrDefault("count",0)+"");
}
useMonth += StringUtils.isBlank(vehicleCountListMonth)?0:Integer.valueOf(vehicleCountListMonth);
//本月新增设备
for(int i = 0 ; i < vehicleEquCountListMonth.size() ; i++){
usrEqMonth += Integer.valueOf(vehicleEquCountListMonth.get(i).getOrDefault("count",0)+"");
}
for(int i=0 ; i < 4 ; i++){
Map<String,Object> map = new HashMap<>();
if(i == 0){
map.put("name","本年新增登记");
map.put("value",useYear);
}else if(i == 1){
map.put("name","本年新增设备");
map.put("value",usrEqYear);
}else if(i == 2){
map.put("name","本月新增登记");
map.put("value",useMonth);
}else if(i == 3){
map.put("name","本月新增设备");
map.put("value",usrEqMonth);
}
resultList.add(map);
}
return resultList;
}
} }
...@@ -93,16 +93,22 @@ public class DPSubServiceImpl { ...@@ -93,16 +93,22 @@ public class DPSubServiceImpl {
this.processShowHideRules(children, showHideRules, apiResult); this.processShowHideRules(children, showHideRules, apiResult);
List<Object> noHiddenChildren = children.stream().filter(x -> !"hidden".equals(JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.behavior"))).collect(Collectors.toList()); List<Object> noHiddenChildren = children.stream().filter(x -> !"hidden".equals(JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.behavior"))).collect(Collectors.toList());
// 设置一个图片附件分组
JSONObject matinfo = new JSONObject();
matinfo.put("displayName", "图片附件");
matinfo.put("renderType", "matui");
matinfo.put("datas", new JSONArray());
for (int i = 0; i < noHiddenChildren.size(); i++) { for (int i = 0; i < noHiddenChildren.size(); i++) {
JSONObject yObj = (JSONObject) noHiddenChildren.get(i); JSONObject yObj = (JSONObject) noHiddenChildren.get(i);
if ("pageSection".equals(yObj.get("componentKey")) || "columnsLayout".equals(yObj.get("componentKey"))) { // 分组或者布局容器 if ("pageSection".equals(yObj.get("componentKey")) || "columnsLayout".equals(yObj.get("componentKey"))) { // 分组或者布局容器
List<Object> mergedArray = mergedList(yObj.getJSONArray("children")); List<Object> mergedArray = mergedList(yObj.getJSONArray("children"));
// 第一组去除标题 // 第一组去除标题
if (i == 0 || ValidationUtil.isEmpty(map.get("datas"))) { if (i == 0 || ValidationUtil.isEmpty(map.get("datas"))) {
this.buildContentData(map, mergedArray, apiResult); this.buildContentData(map, mergedArray, apiResult, matinfo);
} else { } else {
this.buildSubContentData(map, i, yObj, mergedArray, apiResult); this.buildSubContentData(map, i, yObj, mergedArray, apiResult, matinfo);
} }
} else if ("subForm".equals(yObj.get("componentKey"))) { // 子表单 } else if ("subForm".equals(yObj.get("componentKey"))) { // 子表单
this.buildSubFormData(map, i, yObj, apiResult); this.buildSubFormData(map, i, yObj, apiResult);
...@@ -124,6 +130,11 @@ public class DPSubServiceImpl { ...@@ -124,6 +130,11 @@ public class DPSubServiceImpl {
content.put(tab.getString("key"), map); content.put(tab.getString("key"), map);
} }
} }
if (!ValidationUtil.isEmpty(matinfo.getJSONArray("datas"))){
matinfo.put("columns", map.getJSONObject("basic").getString("columns"));
map.getJSONArray("subs").add(matinfo);
}
} else { } else {
if (ValidationUtil.isEmpty(map)) { if (ValidationUtil.isEmpty(map)) {
content.put(tab.getString("key"), apiResult); content.put(tab.getString("key"), apiResult);
...@@ -275,7 +286,7 @@ public class DPSubServiceImpl { ...@@ -275,7 +286,7 @@ public class DPSubServiceImpl {
return mergedArray; return mergedArray;
} }
public JSONObject buildContentData(JSONObject map, List<Object> mergedArray, JSONObject apiResult) { public JSONObject buildContentData(JSONObject map, List<Object> mergedArray, JSONObject apiResult, JSONObject matinfo) {
JSONArray datas = new JSONArray(); JSONArray datas = new JSONArray();
// 处理二维码 // 处理二维码
mergedArray.stream().filter(x -> "QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).findFirst().ifPresent(x -> { mergedArray.stream().filter(x -> "QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).findFirst().ifPresent(x -> {
...@@ -302,17 +313,18 @@ public class DPSubServiceImpl { ...@@ -302,17 +313,18 @@ public class DPSubServiceImpl {
}); });
mergedArray = mergedArray.stream().filter(x -> !"QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).collect(Collectors.toList()); mergedArray = mergedArray.stream().filter(x -> !"QRCode".equals(JsonValueUtils.getValueByKey(x, "componentKey", null))).collect(Collectors.toList());
mergedArray.stream().forEach(x -> { mergedArray.stream().forEach(x -> {
Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey"); Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey");
if (!ValidationUtil.isEmpty(fieldKey)) { if (!ValidationUtil.isEmpty(fieldKey)) {
this.processWidgets(datas, x, fieldKey.toString(), apiResult); this.processWidgets(datas, x, fieldKey.toString(), apiResult, matinfo);
} }
}); });
map.put("datas", datas); map.put("datas", datas);
return map; return map;
} }
public JSONObject buildSubContentData(JSONObject map, int i, JSONObject yObj, List<Object> mergedArray, JSONObject apiResult) { public JSONObject buildSubContentData(JSONObject map, int i, JSONObject yObj, List<Object> mergedArray, JSONObject apiResult, JSONObject matinfo) {
JSONArray subs = map.getJSONArray("subs"); JSONArray subs = map.getJSONArray("subs");
JSONArray children = yObj.getJSONArray("children"); JSONArray children = yObj.getJSONArray("children");
List<Object> columnsArray = children.stream().filter(x -> { List<Object> columnsArray = children.stream().filter(x -> {
...@@ -330,7 +342,7 @@ public class DPSubServiceImpl { ...@@ -330,7 +342,7 @@ public class DPSubServiceImpl {
mergedArray.stream().forEach(x -> { mergedArray.stream().forEach(x -> {
Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey"); Object fieldKey = JsonValueUtils.getValueByKey(x, "visualParams", "visualParams.fieldKey");
if (!ValidationUtil.isEmpty(fieldKey)) { if (!ValidationUtil.isEmpty(fieldKey)) {
this.processWidgets(datas, x, fieldKey.toString(), apiResult); this.processWidgets(datas, x, fieldKey.toString(), apiResult, matinfo);
subObj.put("datas", datas); subObj.put("datas", datas);
} }
}); });
...@@ -347,18 +359,26 @@ public class DPSubServiceImpl { ...@@ -347,18 +359,26 @@ public class DPSubServiceImpl {
* @param apiResult * @param apiResult
* @return * @return
*/ */
public JSONArray processWidgets(JSONArray datas, Object x, String fieldKey, JSONObject apiResult) { public JSONArray processWidgets(JSONArray datas, Object x, String fieldKey, JSONObject apiResult, JSONObject matinfo) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
JSONObject xObj = (JSONObject) x; JSONObject xObj = (JSONObject) x;
JSONObject visualParams = xObj.getJSONObject("visualParams"); JSONObject visualParams = xObj.getJSONObject("visualParams");
jsonObject.put("label", visualParams.getString("label")); jsonObject.put("label", visualParams.getString("label"));
Object value = apiResult.get(fieldKey); Object value = apiResult.get(fieldKey);
if ("upload".equals(xObj.getString("componentKey"))) { if ("upload".equals(xObj.getString("componentKey"))) {
jsonObject.put("type", "img"); jsonObject.put("type", "img");
if (!ValidationUtil.isEmpty(value)) { if (!ValidationUtil.isEmpty(value)) {
jsonObject.put("value", ((JSONArray) value).getJSONObject(0).getString("url")); jsonObject.put("value", ((JSONArray) value).getJSONObject(0).getString("url"));
} }
} else if ("attachmentUpload".equals(xObj.getString("componentKey"))) {
JSONArray attachmentUploadDatas = matinfo.getJSONArray("datas");
if (!ValidationUtil.isEmpty(value)) {
JSONObject attachmentUploadDatasObj = new JSONObject();
attachmentUploadDatasObj.put("value", value);
attachmentUploadDatas.add(attachmentUploadDatasObj);
}
} else if ("checkbox".equals(xObj.getString("componentKey"))) { } else if ("checkbox".equals(xObj.getString("componentKey"))) {
jsonObject.put("type", "text"); jsonObject.put("type", "text");
ResponseModel checkboxResult = this.getApiResult(visualParams.getJSONObject("api"), null); ResponseModel checkboxResult = this.getApiResult(visualParams.getJSONObject("api"), null);
......
...@@ -277,7 +277,12 @@ public class TzBaseEnterpriseInfoServiceImpl ...@@ -277,7 +277,12 @@ public class TzBaseEnterpriseInfoServiceImpl
resultMap.remove("tzsBaseInstitution"); resultMap.remove("tzsBaseInstitution");
resultMap.put("unitAddress", resultMap.get("province") + "/" + resultMap.get("city") + "/" + resultMap.get("district")); resultMap.put("unitAddress", resultMap.get("province") + "/" + resultMap.get("city") + "/" + resultMap.get("district"));
resultMap.put("longitudeLatitude", resultMap.get("address"));
Map<String,Object> longitudeLatitudeMap = new HashMap<>();
longitudeLatitudeMap.put("address", resultMap.get("address"));
longitudeLatitudeMap.put("latitude", resultMap.get("latitude"));
longitudeLatitudeMap.put("longitude", resultMap.get("longitude"));
resultMap.put("longitudeLatitude", longitudeLatitudeMap);
resultMap.put("problemTime", ObjectUtils.isEmpty(problemInfo) ? null : problemInfo.get("problem_time")); resultMap.put("problemTime", ObjectUtils.isEmpty(problemInfo) ? null : problemInfo.get("problem_time"));
resultMap.put("problemStatus", (ObjectUtils.isEmpty(resultMap.get("status")) || "null".equals(resultMap.get("status"))) ? ProblemStatusEnum.NORMAL.getName() : ProblemStatusEnum.getName.get(resultMap.get("status"))); resultMap.put("problemStatus", (ObjectUtils.isEmpty(resultMap.get("status")) || "null".equals(resultMap.get("status"))) ? ProblemStatusEnum.NORMAL.getName() : ProblemStatusEnum.getName.get(resultMap.get("status")));
......
...@@ -89,5 +89,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -89,5 +89,7 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<String> selectXiXianNew(); List<String> selectXiXianNew();
Long countEquipByReginCode(String orgCode);
} }
...@@ -680,4 +680,15 @@ ...@@ -680,4 +680,15 @@
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL ) AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领'; AND "CLAIM_STATUS" = '已认领';
</select> </select>
<select id="countEquipByReginCode" resultType="java.lang.Long">
select
count(1)
from
idx_biz_jg_use_info ibjui,
idx_biz_jg_supervision_info ibjsi
where
ibjui."RECORD" = ibjsi."RECORD"
and ibjsi."ORG_BRANCH_CODE" like concat (#{reginCode},'%')
and ibjui."IS_INTO_MANAGEMENT" = true
</select>
</mapper> </mapper>
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