Commit 38c5dd8d 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 97bcd858 ab8601c4
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.elevator.api.mapper; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.elevator.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledQueryDto; import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledRecordDto; import com.yeejoin.amos.boot.module.elevator.api.dto.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto; import com.yeejoin.amos.boot.module.elevator.api.dto.AlertPaperInfoDto;
...@@ -52,7 +53,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> { ...@@ -52,7 +53,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
* *
* @return * @return
*/ */
List<Map<String, Object>> queryListByLocation(@Param("regionCode") String regionCode); List<Map<String, Object>> queryListByLocation(@Param("regionCode") String regionCode, @Param("dto") DPFilterParamDto filterParamDto);
/** /**
* 接警情况统计 * 接警情况统计
* *
......
...@@ -70,6 +70,4 @@ public interface ElevatorMapper extends BaseMapper<Elevator> { ...@@ -70,6 +70,4 @@ public interface ElevatorMapper extends BaseMapper<Elevator> {
Map<String, Object> selectMainUnitMessage(String sequenceNbr); Map<String, Object> selectMainUnitMessage(String sequenceNbr);
Map<String, Object> selectUseUnitByAlertId(String sequenceNbr); Map<String, Object> selectUseUnitByAlertId(String sequenceNbr);
List<Map<String, Object>> elevatorCountStat(@Param("regionCodes") List<String> regionCodes);
} }
...@@ -148,9 +148,16 @@ ...@@ -148,9 +148,16 @@
LEFT JOIN cb_data_dictionary cdd ON ibjuj.USE_PLACE = cdd.sequence_nbr LEFT JOIN cb_data_dictionary cdd ON ibjuj.USE_PLACE = cdd.sequence_nbr
WHERE WHERE
biz_org_code LIKE concat(#{regionCode}, '%') biz_org_code LIKE concat(#{regionCode}, '%')
AND (tac.alarm_type_code = '960' or tac.alarm_type_code = '961')
AND AND
ibjuj.USE_PLACE is NOT NULL ibjuj.USE_PLACE is NOT NULL
AND cdd.NAME is NOT NULL AND cdd.NAME is NOT NULL
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(tac.call_time as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(tac.call_time as date),#{dto.endDate})
</if>
GROUP BY GROUP BY
cdd.NAME cdd.NAME
ORDER BY ibjuj.USE_PLACE ASC ORDER BY ibjuj.USE_PLACE ASC
......
...@@ -581,20 +581,4 @@ ...@@ -581,20 +581,4 @@
ibjmri.SEQUENCE_NBR = #{sequenceNbr} ibjmri.SEQUENCE_NBR = #{sequenceNbr}
</select> </select>
<select id="elevatorCountStat" resultType="java.util.Map">
SELECT
district,
region_code as regionCode,
count(region_code) as total
FROM
tcb_elevator
WHERE
<if test="regionCodes != null">
<foreach collection="regionCodes" index="index" item="item" open="(" separator=" OR " close=")">
tcb_elevator.region_code LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
GROUP BY region_code
</select>
</mapper> </mapper>
...@@ -119,6 +119,16 @@ public class DPStatisticsController { ...@@ -119,6 +119,16 @@ public class DPStatisticsController {
return ResponseHelper.buildResponse(statisticsService.rankUnitByRescueTime(dpFilterParamDto)); return ResponseHelper.buildResponse(statisticsService.rankUnitByRescueTime(dpFilterParamDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-各地市应急事件总数排名", notes = "大屏-应急-各地市应急事件总数排名")
@PostMapping(value = "/yj/regionEventRank")
public ResponseModel<JSONObject> regionEventRank(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult result) throws Exception {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.regionEventRank(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "大屏-应急-中间地图图列统计", notes = "大屏-应急-中间地图图列统计") @ApiOperation(httpMethod = "POST", value = "大屏-应急-中间地图图列统计", notes = "大屏-应急-中间地图图列统计")
......
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.elevator.api.dto.AlertUseUnitStatisticsDto; ...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.elevator.api.dto.AlertUseUnitStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertMaintenanceUnitStatistics; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertMaintenanceUnitStatistics;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertRescueStatistics; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertRescueStatistics;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertUseUnitStatistics; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertUseUnitStatistics;
import com.yeejoin.amos.boot.module.elevator.api.entity.Elevator;
import com.yeejoin.amos.boot.module.elevator.api.mapper.*; import com.yeejoin.amos.boot.module.elevator.api.mapper.*;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
...@@ -111,22 +112,20 @@ public class DPStatisticsServiceImpl { ...@@ -111,22 +112,20 @@ public class DPStatisticsServiceImpl {
public JSONObject elevatorCountStat(DPFilterParamDto dpFilterParamDto) throws Exception { public JSONObject elevatorCountStat(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> regionList = this.getRegionList(dpFilterParamDto); List<RegionModel> regionList = this.getRegionList(dpFilterParamDto);
List<String> regionCodes = regionList.stream().map(r -> r.getRegionCode().toString()).collect(Collectors.toList()); List<String> xdata = regionList.stream().map(r -> r.getRegionName().toString()).collect(Collectors.toList());
List<CompanyModel> companyList = Privilege.companyClient.queryListByCompanyCode(String.join(",", regionCodes)).getResult();
companyList = companyList.stream().sorted(Comparator.comparing(CompanyModel::getRegionSeq, Comparator.naturalOrder())).collect(Collectors.toList());
Map<String, RegionModel> regionMap = regionList.stream().collect(Collectors.toMap(r ->r.getRegionCode().toString(), r -> r));
List<Map<String, Object>> maps = elevatorMapper.elevatorCountStat(regionCodes);
Map<String, Object> map = maps.stream().collect(Collectors.toMap( List<Integer> ydata = new ArrayList<>();
item -> (String) item.get("regionCode"), Map<String, Integer> map = new HashMap<>();
item -> item.get("total")));
List<String> xdata = new ArrayList<>(); regionList.parallelStream().forEach(x -> {
List<String> ydata = new ArrayList<>(); LambdaQueryWrapper<Elevator> lambda = new QueryWrapper<Elevator>().lambda();
JSONObject jsonObject = new JSONObject(); lambda.like(Elevator::getRegionCode, x.getRegionCode());
companyList.stream().forEach(x -> { map.put(x.getRegionName(), elevatorMapper.selectCount(lambda));
xdata.add(x.getCompanyName());
}); });
xdata.stream().forEach(x -> {
ydata.add(map.get(x));
});
JSONObject jsonObject = new JSONObject();
jsonObject.put("xdata", xdata); jsonObject.put("xdata", xdata);
jsonObject.put("ydata", ydata); jsonObject.put("ydata", ydata);
return jsonObject; return jsonObject;
...@@ -134,7 +133,7 @@ public class DPStatisticsServiceImpl { ...@@ -134,7 +133,7 @@ public class DPStatisticsServiceImpl {
public JSONObject eventStatByLocation(DPFilterParamDto dpFilterParamDto) throws Exception { public JSONObject eventStatByLocation(DPFilterParamDto dpFilterParamDto) throws Exception {
String orgCode = this.getAndSetOrgCode(dpFilterParamDto); String orgCode = this.getAndSetOrgCode(dpFilterParamDto);
List<Map<String, Object>> maps = alertCalledMapper.queryListByLocation(orgCode); List<Map<String, Object>> maps = alertCalledMapper.queryListByLocation(orgCode, dpFilterParamDto);
List<Object> xdata = maps.stream().map(item -> item.get("name")).collect(Collectors.toList()); List<Object> xdata = maps.stream().map(item -> item.get("name")).collect(Collectors.toList());
List<Object> ydata = maps.stream().map(item -> item.get("majorAlertCount")).collect(Collectors.toList()); List<Object> ydata = maps.stream().map(item -> item.get("majorAlertCount")).collect(Collectors.toList());
...@@ -190,12 +189,39 @@ public class DPStatisticsServiceImpl { ...@@ -190,12 +189,39 @@ public class DPStatisticsServiceImpl {
LambdaQueryWrapper<AlertMaintenanceUnitStatistics> lambda = new QueryWrapper<AlertMaintenanceUnitStatistics>().lambda(); LambdaQueryWrapper<AlertMaintenanceUnitStatistics> lambda = new QueryWrapper<AlertMaintenanceUnitStatistics>().lambda();
lambda.likeLeft(AlertMaintenanceUnitStatistics::getSupervisoryUnitOrgCode, orgCode); lambda.likeLeft(AlertMaintenanceUnitStatistics::getSupervisoryUnitOrgCode, orgCode);
lambda.eq(AlertMaintenanceUnitStatistics :: getStatisticsDate, "2023-12"); lambda.eq(AlertMaintenanceUnitStatistics :: getStatisticsDate, date);
List<AlertMaintenanceUnitStatistics> alertMaintenanceUnitStatistics = alertMaintenanceUnitStatisticsMapper.selectList(lambda); List<AlertMaintenanceUnitStatistics> alertMaintenanceUnitStatistics = alertMaintenanceUnitStatisticsMapper.selectList(lambda);
List<AlertMaintenanceUnitStatisticsDto> models = Bean.toModels(alertMaintenanceUnitStatistics, AlertMaintenanceUnitStatisticsDto.class); List<AlertMaintenanceUnitStatisticsDto> models = Bean.toModels(alertMaintenanceUnitStatistics, AlertMaintenanceUnitStatisticsDto.class);
return models; return models;
} }
public JSONObject regionEventRank(DPFilterParamDto dpFilterParamDto) throws Exception {
List<RegionModel> childRegion = this.getRegionList(dpFilterParamDto);
JSONObject jsonObject = new JSONObject();
Map<String, Long> map = new HashMap<>();
childRegion.stream().forEach(x -> {
String orgCode = this.getAndSetOrgCode(x.getRegionCode().toString());
if (ValidationUtil.isEmpty(orgCode)) {
map.put(x.getRegionName(), 0L);
} else {
Long num = alertStatisticsMapper.countEmergencyEventsByOrgCodeAndDate(orgCode, dpFilterParamDto);
map.put(x.getRegionName(), num);
}
});
List<String> xdata = new ArrayList<>(map.keySet());
List<Long> ydata = new ArrayList<>();
xdata.sort(Comparator.comparingLong(map::get).reversed());
xdata.stream().forEach(x -> {
ydata.add(map.get(x));
});
jsonObject.put("xdata", xdata);
jsonObject.put("ydata", ydata);
return jsonObject;
}
private List<RegionModel> getRegionList(DPFilterParamDto dpFilterParamDto) { private List<RegionModel> getRegionList(DPFilterParamDto dpFilterParamDto) {
try { try {
if (regionChildRegionMap.get(dpFilterParamDto.getCityCode()) == null) { if (regionChildRegionMap.get(dpFilterParamDto.getCityCode()) == null) {
...@@ -218,6 +244,7 @@ public class DPStatisticsServiceImpl { ...@@ -218,6 +244,7 @@ public class DPStatisticsServiceImpl {
List<RegionModel> independentRegions = ReginStepEnum.enum2RegionList("map"); List<RegionModel> independentRegions = ReginStepEnum.enum2RegionList("map");
regionList.addAll(independentRegions); regionList.addAll(independentRegions);
} }
regionList = regionList.stream().sorted(Comparator.comparing(RegionModel::getRegionCode, Comparator.naturalOrder())).collect(Collectors.toList());
return regionList; return regionList;
} }
...@@ -234,6 +261,18 @@ public class DPStatisticsServiceImpl { ...@@ -234,6 +261,18 @@ public class DPStatisticsServiceImpl {
return orgCode; return orgCode;
} }
private String getAndSetOrgCode(String cityCode) {
String orgCode = regionCodeOrgCodeMap.get(cityCode);
if (orgCode == null) {
orgCode = yjBaseMapper.getOrgCodeByCompanyCode(cityCode);
if (orgCode == null) {
return "";
}
regionCodeOrgCodeMap.put(cityCode, orgCode);
}
return orgCode;
}
/** /**
* 获取两个时间段之间的每一天 * 获取两个时间段之间的每一天
* @param startTime 开始时间 * @param startTime 开始时间
...@@ -303,5 +342,4 @@ public class DPStatisticsServiceImpl { ...@@ -303,5 +342,4 @@ public class DPStatisticsServiceImpl {
dpFilterParamDto.setEndDate(cn.hutool.core.date.DateUtil.today()); dpFilterParamDto.setEndDate(cn.hutool.core.date.DateUtil.today());
} }
} }
} }
package com.yeejoin.amos.boot.module.common.api.enums;
import lombok.Getter;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@Getter
public enum IssueProblemLevelEnum {
LEVEL_ONE("一级","1"),
LEVEL_TWO("二级","2"),
LEVEL_THREE("三级","3"),
;
String name;
String code;
private IssueProblemLevelEnum(String name, String code) {
this.name = name;
this.code = code;
}
public static List<HashMap<String,String>> getEnumList() {
List<HashMap<String, String>> list = new ArrayList<>();
for (IssueProblemLevelEnum testEnum : EnumSet.allOf(IssueProblemLevelEnum.class)) {
HashMap<String, String> map = new HashMap<>();
map.put(testEnum.name,testEnum.code.toString());
list.add(map);
}
return list;
}
}
...@@ -19,4 +19,16 @@ public interface DPStatisticsMapper { ...@@ -19,4 +19,16 @@ public interface DPStatisticsMapper {
List<Map<String, Object>> getIssueCountByMonth(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status); List<Map<String, Object>> getIssueCountByMonth(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status);
List<Map<String, Object>> getIssueCountByDate(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status); List<Map<String, Object>> getIssueCountByDate(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status);
int countByOrgCode(@Param("orgCode") String orgCode, @Param("now") String now);
List<Map<String, String>> getOrgCodeAndCompanyCodesByCompanyCodes(@Param("regionCodes") List<Integer> regionCodes);
List<Map<String, Object>> countByOrgCodes(@Param("orgCodes") List<String> orgCodes, @Param("now") String now);
List<Map<String, Object>> issueMonthList(@Param("orgCode") String orgCode, @Param("time") String time);
List<Map<String, Object>> issueProblemLevelCount(@Param("orgCode") String orgCode, @Param("time") String time);
List<Map<String, Object>> issueCompanyTop(@Param("orgCode") String orgCode, @Param("time") String time);
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' ) governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND create_date &gt;= #{startDate} AND problem_time &gt;= #{startDate}
AND source_type IN AND source_type IN
<foreach collection="mainBodyNameList" item="item" separator="," open="(" close=")"> <foreach collection="mainBodyNameList" item="item" separator="," open="(" close=")">
#{item} #{item}
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' ) governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND create_date &gt;= #{startDate} AND problem_time &gt;= #{startDate}
AND source_type = #{sourceType} AND source_type = #{sourceType}
AND problem_type IN AND problem_type IN
<foreach collection="enumNameList" item="item" separator="," open="(" close=")"> <foreach collection="enumNameList" item="item" separator="," open="(" close=")">
...@@ -46,35 +46,109 @@ ...@@ -46,35 +46,109 @@
<select id="getIssueCountByMonth" resultType="java.util.Map"> <select id="getIssueCountByMonth" resultType="java.util.Map">
SELECT COUNT SELECT COUNT
( 1 ), ( 1 ),
DATE_FORMAT(create_date,'%Y-%m') AS time DATE_FORMAT(problem_time,'%Y-%m') AS time
FROM FROM
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' ) governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(create_date,'%Y') = #{year} AND DATE_FORMAT(problem_time,'%Y') = #{year}
<if test="null != status"> <if test="null != status">
AND problem_status_code = #{status} AND problem_status_code = #{status}
</if> </if>
GROUP BY GROUP BY
DATE_FORMAT(create_date,'%Y-%m') DATE_FORMAT(problem_time,'%Y-%m')
</select> </select>
<select id="getIssueCountByDate" resultType="java.util.Map"> <select id="getIssueCountByDate" resultType="java.util.Map">
SELECT COUNT SELECT COUNT
( 1 ), ( 1 ),
DATE_FORMAT(create_date,'%Y-%m-%d') AS time DATE_FORMAT(problem_time,'%Y-%m-%d') AS time
FROM FROM
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' ) governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(create_date,'%Y-%m-%d') &gt;= #{year} AND DATE_FORMAT(problem_time,'%Y-%m-%d') &gt;= #{year}
<if test="null != status"> <if test="null != status">
AND problem_status_code = #{status} AND problem_status_code = #{status}
</if> </if>
GROUP BY GROUP BY
DATE_FORMAT(create_date,'%Y-%m-%d') DATE_FORMAT(problem_time,'%Y-%m-%d')
</select>
<select id="countByOrgCode" resultType="java.lang.Integer">
SELECT COUNT
( 1 )
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(problem_time,'%Y-%m') &gt;= #{now}
</select>
<select id="getOrgCodeAndCompanyCodesByCompanyCodes" resultType="java.util.Map">
select org_code AS orgCode,company_code AS companyCode from privilege_company where company_code in
<foreach collection="regionCodes" item="regionCode" separator="," open="(" close=")">
#{regionCode} :: VARCHAR
</foreach>
</select>
<select id="countByOrgCodes" resultType="java.util.Map">
SELECT COUNT
( 1 ),
governing_body_org_code AS orgCode
FROM
tzs_safety_problem_tracing
WHERE
DATE_FORMAT(problem_time,'%Y-%m') &gt;= #{now}
AND
<foreach collection="orgCodes" item="orgCode" separator="OR" open="(" close=")">
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
</foreach>
GROUP BY
governing_body_org_code
</select>
<select id="issueMonthList" resultType="java.util.Map">
SELECT
sequence_nbr AS sequenceNbr,
source_type AS sourceType,
problem_type AS problemType,
problem_time AS problemTime
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT ( problem_time, '%Y-%m' ) = #{time}
</select>
<select id="issueProblemLevelCount" resultType="java.util.Map">
SELECT
COUNT
( 1 ),
problem_level AS problemLevel
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT(problem_time,'%Y') = #{time}
AND problem_level IS NOT NULL
GROUP BY
problem_level
ORDER BY
problem_level_code
</select>
<select id="issueCompanyTop" resultType="java.util.Map">
SELECT COUNT
( 1 ),
principal_unit AS principalUnit,
governing_body AS governingBody
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT ( problem_time, '%Y' ) = #{time}
AND problem_level IS NOT NULL
GROUP BY
principal_unit_code
ORDER BY
COUNT DESC
LIMIT 10
</select> </select>
</mapper> </mapper>
...@@ -158,4 +158,64 @@ public class CylinderStatisticsController { ...@@ -158,4 +158,64 @@ public class CylinderStatisticsController {
Map<String, Object> result = service.issueCountByDay(regionCode.toString()); Map<String, Object> result = service.issueCountByDay(regionCode.toString());
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}; };
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当前区域数据统计")
@PostMapping(value = "/issueCountByCityCode")
public ResponseModel<Map<String, Object>> issueCountByCityCode(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.issueCountByCityCode(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当前区域子区域数据统计")
@PostMapping(value = "/issueChildrenCityCount")
public ResponseModel<List<Map<String, Object>>> issueChildrenCityCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
List<Map<String, Object>> result = service.issueChildrenCityCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当月问题列表(主体类型、问题类型、问题时间、操作)")
@PostMapping(value = "/issueMonthList")
public ResponseModel<List<Map<String, Object>>> issueMonthList(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
List<Map<String, Object>> result = service.issueMonthList(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "当年问题等级分类统计")
@PostMapping(value = "/issueProblemLevelCount")
public ResponseModel<Map<String, Object>> issueProblemLevelCount(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
Map<String, Object> result = service.issueProblemLevelCount(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "按问题类型排名top 10")
@PostMapping(value = "/issueCompanyTop")
public ResponseModel<List<Map<String, Object>>> issueCompanyTop(@RequestBody Map<String, Object> map ) throws Exception {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
}
List<Map<String, Object>> result = service.issueCompanyTop(regionCode.toString());
return ResponseHelper.buildResponse(result);
};
} }
...@@ -23,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel; ...@@ -23,6 +23,7 @@ import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl; import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel; import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import joptsimple.internal.Strings; import joptsimple.internal.Strings;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RequestOptions;
...@@ -50,6 +51,7 @@ import java.time.LocalDate; ...@@ -50,6 +51,7 @@ import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -834,7 +836,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -834,7 +836,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
list1.add(mainBodyNameList.get(i)); list1.add(mainBodyNameList.get(i));
List<Map<String, Object>> maps = statisticsMapper.selectByOrgAndMainBody(orgCode, list1, startDate, "1"); List<Map<String, Object>> maps = statisticsMapper.selectByOrgAndMainBody(orgCode, list1, startDate, "1");
if(maps.size() > 0){ if(maps.size() > 0){
problemRate.add(new DecimalFormat("0.00").format(Double.parseDouble(dataMap.get(mainBodyNameList.get(i)).toString()) / Double.parseDouble(maps.get(0).get("count").toString()))); problemRate.add(new DecimalFormat("0.00").format( Double.parseDouble(maps.get(0).get("count").toString()) / Double.parseDouble(dataMap.get(mainBodyNameList.get(i)).toString())));
}else{ }else{
problemRate.add("0"); problemRate.add("0");
} }
...@@ -985,9 +987,9 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -985,9 +987,9 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
List<Object> problemCount = new ArrayList<>(); List<Object> problemCount = new ArrayList<>();
List<Object> processedRate = new ArrayList<>(); List<Object> processedRate = new ArrayList<>();
List<Object> xdata = new ArrayList<>(); List<Object> xdata = new ArrayList<>();
for(int i = 1; i <= 12; i++){ for(int i = 0; i < 12; i++){
xdata.add(i+"月");
String time = LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")); String time = LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM"));
xdata.add(time);
if(allIssueMap.get(time) == null){ if(allIssueMap.get(time) == null){
problemCount.add("0"); problemCount.add("0");
processedRate.add("0"); processedRate.add("0");
...@@ -1000,6 +1002,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -1000,6 +1002,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
} }
} }
} }
Collections.reverse(xdata);
Collections.reverse(problemCount); Collections.reverse(problemCount);
Collections.reverse(processedRate); Collections.reverse(processedRate);
resultMap.put("xdata",xdata); resultMap.put("xdata",xdata);
...@@ -1039,8 +1042,8 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -1039,8 +1042,8 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
List<Object> processedRate = new ArrayList<>(); List<Object> processedRate = new ArrayList<>();
List<Object> xdata = new ArrayList<>(); List<Object> xdata = new ArrayList<>();
for(int i = 0; i < 29; i++){ for(int i = 0; i < 29; i++){
xdata.add(LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); String time = LocalDate.now().minusDays(i).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String time = LocalDate.now().minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")); xdata.add(time);
if(allIssueMap.get(time) == null){ if(allIssueMap.get(time) == null){
problemCount.add("0"); problemCount.add("0");
processedRate.add("0"); processedRate.add("0");
...@@ -1061,4 +1064,91 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto ...@@ -1061,4 +1064,91 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
resultMap.put("processedRate",processedRate); resultMap.put("processedRate",processedRate);
return resultMap; return resultMap;
} }
public Map<String, Object> issueCountByCityCode(String cityCode) {
String orgCode = getAndSetOrgCode(cityCode);
String now = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
int count = statisticsMapper.countByOrgCode(orgCode,now);
Map<String,Object> resultMap = new HashMap<>();
resultMap.put("issueCount",count);
return resultMap;
}
public List<Map<String, Object>> issueChildrenCityCount(String cityCode) throws Exception {
List<RegionModel> regionModels = setRegionIfRootParent(cityCode);
List<Integer> regionCodeList = regionModels.stream().map(m -> m.getRegionCode()).collect(Collectors.toList());
List<Map<String, String>> orgCodeAndCompanyCodesByCompanyCodes = statisticsMapper.getOrgCodeAndCompanyCodesByCompanyCodes(regionCodeList);
List<String> orgCodes = orgCodeAndCompanyCodesByCompanyCodes.stream().map(m -> m.get("orgCode")).collect(Collectors.toList());
String now = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
Map<String,String> orgCodeAndCompanyCodesMap = new HashMap<>();
orgCodeAndCompanyCodesByCompanyCodes.stream().forEach(t->{
orgCodeAndCompanyCodesMap.put(t.get("companyCode"),t.get("orgCode"));
});
List<Map<String, Object>> list = statisticsMapper.countByOrgCodes(orgCodes,now);
Map<String,Object> dataMap = new HashMap<>();
list.stream().forEach(t->{
dataMap.put(t.get("orgCode").toString(),t.get("count"));
});
List<Map<String,Object>> resultList = new ArrayList<>();
for(RegionModel regionModel : regionModels){
Map<String,Object> map = new HashMap<>();
AtomicInteger count = new AtomicInteger();
map.put("regionCode",regionModel.getRegionCode());
map.put("regionName",regionModel.getRegionName());
if(StringUtils.isNotBlank(orgCodeAndCompanyCodesMap.get(regionModel.getRegionCode()+""))){
dataMap.forEach((k, v)->{
if(k.startsWith(orgCodeAndCompanyCodesMap.get(regionModel.getRegionCode()+""))){
if(null != v){
count.addAndGet(Integer.valueOf(v+""));
}
}
});
}
map.put("issueCount",count);
resultList.add(map);
}
return resultList;
}
public List<Map<String, Object>> issueMonthList(String cityCode) {
String orgCode = getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
List<Map<String,Object>> list = statisticsMapper.issueMonthList(orgCode,time);
return list;
}
public Map<String, Object> issueProblemLevelCount(String cityCode) {
Map<String,Object> resultMap = new HashMap<>();
String orgCode = getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy"));
List<Map<String,Object>> list = statisticsMapper.issueProblemLevelCount(orgCode,time);
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
for(int i = 0; i < list.size(); i++){
xdata.add(list.get(i).get("problemLevel"));
ydata.add(list.get(i).get("count"));
}
resultMap.put("xdata",xdata);
resultMap.put("ydata",ydata);
return resultMap;
}
public List<Map<String, Object>> issueCompanyTop(String cityCode) {
List<Map<String,Object>> resultList = new ArrayList<>();
String orgCode = getAndSetOrgCode(cityCode);
String time = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy"));
List<Map<String,Object>> list = statisticsMapper.issueCompanyTop(orgCode,time);
for(int i = 0; i < list.size(); i++){
Map<String,Object> map = new HashMap<>();
map.put("sequenceNbr",(i+1)+"");
map.put("region",list.get(i).get("governingBody"));
map.put("company",list.get(i).get("principalUnit"));
map.put("count",list.get(i).get("count"));
resultList.add(map);
}
return resultList;
}
} }
\ No newline at end of file
...@@ -137,7 +137,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -137,7 +137,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private static final String IS_COPY = "isCopy"; private static final String IS_COPY = "isCopy";
// 设备种类 // 设备种类
public static final String EQU_LIST = "EQU_LIST"; public static final String EQU_LIST = "EQU_LIST";
//模版上传集合 // 模版上传集合
public static final String EQU_LISTS = "equLists"; public static final String EQU_LISTS = "equLists";
// 设备类别 // 设备类别
public static final String EQU_CATEGORY = "EQU_CATEGORY"; public static final String EQU_CATEGORY = "EQU_CATEGORY";
...@@ -157,11 +157,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -157,11 +157,12 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 设备来源名称 jg:新设备 jg_his:历史数据 // 设备来源名称 jg:新设备 jg_his:历史数据
public static final String DATA_SOURCE_NAME = "DATA_SOURCE_NAME"; public static final String DATA_SOURCE_NAME = "DATA_SOURCE_NAME";
private static final String ATTACHMENT_UPLOAD = "attachmentUpload"; private static final String ATTACHMENT_UPLOAD = "attachmentUpload";
public static final String USE_PLACE_CODE = "USE_PLACE_CODE";
private final List<String> resultError = new ArrayList<>(); private final List<String> resultError = new ArrayList<>();
List<String> useInnerCodeList = new ArrayList<>();//单位内部编号集合 List<String> useInnerCodeList = new ArrayList<>();// 单位内部编号集合
List<String> equCodeList = new ArrayList<>();//设备代码集合 List<String> equCodeList = new ArrayList<>();// 设备代码集合
List<String> factoryNumList = new ArrayList<>();//出厂编码集合 List<String> factoryNumList = new ArrayList<>();// 出厂编码集合
/** /**
* 业务类型 0:单个新增 1:批量导入 * 业务类型 0:单个新增 1:批量导入
...@@ -549,15 +550,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -549,15 +550,15 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
// 历史设备录入 直接取所有的设备种类(equList)下的所有设备类别 // 历史设备录入 直接取所有的设备种类(equList)下的所有设备类别
if ("his".equals(dataSource)) { if ("his".equals(dataSource)) {
// 历史数据导入设备类别限制 bug-21172 // 历史数据导入设备类别限制 bug-21172
if (!ObjectUtils.isEmpty(type) && "PL_DR".equals(type)){ if (!ObjectUtils.isEmpty(type) && "PL_DR".equals(type)) {
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream() return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream()
.filter(x -> "2300".equals(x.getDictDataKey())) .filter(x -> "2300".equals(x.getDictDataKey()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
// 历史数据新增设备类别限制 bug-21139 // 历史数据新增设备类别限制 bug-21139
if (!ObjectUtils.isEmpty(equList) && "8000".equals(equList)){ if (!ObjectUtils.isEmpty(equList) && "8000".equals(equList)) {
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream() return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList).stream()
.filter(x -> "8300".equals(x.getDictDataKey())) .filter(x -> "8300".equals(x.getDictDataKey()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList); return this.baseMapper.queryAllEquCategoriesUnderTheEquList(equList);
...@@ -656,8 +657,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -656,8 +657,10 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
} }
return objMap; return objMap;
} }
@Autowired
private SafetyProblemTracingMapper safetyProblemTracingMapper; @Autowired
private SafetyProblemTracingMapper safetyProblemTracingMapper;
/** /**
* 查询设备基本信息 * 查询设备基本信息
* *
...@@ -1348,14 +1351,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1348,14 +1351,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
BoolQueryBuilder dBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder dBuilder = QueryBuilders.boolQuery();
if (map.containsKey("DATA_SOURCE") && !ObjectUtils.isEmpty(map.get("DATA_SOURCE"))) { if (map.containsKey("DATA_SOURCE") && !ObjectUtils.isEmpty(map.get("DATA_SOURCE"))) {
if ("jg_his".equals(map.get("DATA_SOURCE"))) {//只查历史,前缀jg_his if ("jg_his".equals(map.get("DATA_SOURCE"))) {// 只查历史,前缀jg_his
dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg_his")); dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg_his"));
} else if (!"jg_his".equals(map.getString("DATA_SOURCE"))) {//只查新增,前缀为jg且前缀不为jg_his } else if (!"jg_his".equals(map.getString("DATA_SOURCE"))) {// 只查新增,前缀为jg且前缀不为jg_his
dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg")); dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg"));
dBuilder.mustNot(QueryBuilders.prefixQuery("DATA_SOURCE", "jg_his")); dBuilder.mustNot(QueryBuilders.prefixQuery("DATA_SOURCE", "jg_his"));
} }
} else { } else {
//查所有,前缀jg // 查所有,前缀jg
dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg")); dBuilder.must(QueryBuilders.prefixQuery("DATA_SOURCE", "jg"));
} }
boolMust.must(dBuilder); boolMust.must(dBuilder);
...@@ -1363,17 +1366,19 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1363,17 +1366,19 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
String queryType = map.getString("QUERY_TYPE"); String queryType = map.getString("QUERY_TYPE");
if (!ObjectUtils.isEmpty(queryType)) { if (!ObjectUtils.isEmpty(queryType)) {
// 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】 // 查询 安装告知【可告知设备列表】【USE_UNIT_CREDIT_CODE=== null || ""】
if (ValidationUtil.equals(queryType, "AZ")) {//安装 if (ValidationUtil.equals(queryType, "AZ")) {// 安装
BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery() BoolQueryBuilder nullOrEmptyQuery = QueryBuilders.boolQuery()
.mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*")); .mustNot(QueryBuilders.wildcardQuery("USE_UNIT_CREDIT_CODE", "*"));
boolMust.must(nullOrEmptyQuery); boolMust.must(nullOrEmptyQuery);
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
} else if (ValidationUtil.equals(queryType, "WB")) {//维保 // 安装告知设备选择 - 业务限制
// 根据设备类别(EQU_CATEGORY)、安装单位过滤设备(USC_UNIT_CREDIT_CODE) 下面过滤条件已有
} else if (ValidationUtil.equals(queryType, "WB")) {// 维保
// 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】 // 查询 维保备案【可绑定设备列表】【(EQU_STATE=== null || "")】
BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder wbBuilder = QueryBuilders.boolQuery();
wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); wbBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
boolMust.must(wbBuilder); boolMust.must(wbBuilder);
} else if (ValidationUtil.equals(queryType, "SY")) {//使用 } else if (ValidationUtil.equals(queryType, "SY")) {// 使用
// 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】 // 查询 使用登记【可选设备列表】【(EQU_STATUS=== null || "" ) && (USE_ORG_CODE(使用登记证编号) ==="" || null)】
BoolQueryBuilder syBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder syBuilder = QueryBuilders.boolQuery();
syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE")); syBuilder.mustNot(QueryBuilders.existsQuery("EQU_STATE"));
...@@ -1392,6 +1397,32 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1392,6 +1397,32 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
syBuilder.must(QueryBuilders.existsQuery("EQU_STATE")); syBuilder.must(QueryBuilders.existsQuery("EQU_STATE"));
syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*")); syBuilder.must(QueryBuilders.wildcardQuery("USE_ORG_CODE", "*"));
boolMust.must(syBuilder); boolMust.must(syBuilder);
if (ValidationUtil.equals(queryType, "GZ_GZ")) {// 改造告知设备选择 - 业务限制
// 设备类别(EQU_CATEGORY)、安装单位(USC_UNIT_CREDIT_CODE)、选择的使用单位(USE_UNIT_CREDIT_CODE)、选择的区县(USE_PLACE_CODE)过滤数据
if (ValidationUtil.isEmpty(map.get("useUnitCreditCode")) || ValidationUtil.isEmpty(map.get("county"))) {
throw new BadRequest("请先选择使用单位,施工区县等信息");
}
map.put("USE_UNIT_CREDIT_CODE", map.get("useUnitCreditCode"));
map.put(USE_PLACE_CODE, String.valueOf(map.get("county")).split("_")[0]);
} else if (ValidationUtil.equals(queryType, "GZ_WX")) {// 维修告知设备选择 - 业务限制
// 设备类别(EQU_CATEGORY)、安装单位(USC_UNIT_CREDIT_CODE)、选择的使用单位(USE_UNIT_CREDIT_CODE)、选择的区县(USE_PLACE_CODE)过滤数据
if (ValidationUtil.isEmpty(map.get("useUnitCreditCode")) || ValidationUtil.isEmpty(map.get("county"))) {
throw new BadRequest("请先选择使用单位,施工区县等信息");
}
map.put("USE_UNIT_CREDIT_CODE", map.get("useUnitCreditCode"));
map.put(USE_PLACE_CODE, String.valueOf(map.get("county")).split("_")[0]);
} else if (ValidationUtil.equals(queryType, "GZ_YZ")) {// 移装告知设备选择 - 业务限制
// 设备类别(EQU_CATEGORY)、安装单位(USC_UNIT_CREDIT_CODE)、选择的使用单位(USE_UNIT_CREDIT_CODE)、(区内移装(transferType=区内移装)根据区县(USE_PLACE_CODE))过滤数据
if (ValidationUtil.isEmpty(map.get("useUnitCreditCode"))) {
throw new BadRequest("请先选择使用单位等信息");
}
if (!ValidationUtil.isEmpty(map.get("transferType")) && ValidationUtil.equals(map.get("transferType"), "区内移装")
&& ValidationUtil.isEmpty(map.get("county"))) {
throw new BadRequest("请先选择施工区域等信息");
}
map.put("USE_UNIT_CREDIT_CODE", map.get("useUnitCreditCode"));
map.put(USE_PLACE_CODE, ValidationUtil.equals(map.get("transferType"), "区内移装") ? String.valueOf(map.get("county")).split("_")[0] : null);
}
} }
// this.setRepeatUsedCheckFilterByType(boolMust,companyCode,queryType); // this.setRepeatUsedCheckFilterByType(boolMust,companyCode,queryType);
} }
...@@ -1437,11 +1468,10 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1437,11 +1468,10 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
BoolQueryBuilder ubuilder = QueryBuilders.boolQuery(); BoolQueryBuilder ubuilder = QueryBuilders.boolQuery();
String useCode = QueryParser.escape(map.getString("USE_UNIT_CREDIT_CODE")); String useCode = QueryParser.escape(map.getString("USE_UNIT_CREDIT_CODE"));
useCode = useCode.contains("_") ? useCode.split("_")[0] : useCode; useCode = useCode.contains("_") ? useCode.split("_")[0] : useCode;
ubuilder.should(QueryBuilders.matchQuery("USE_UNIT_CREDIT_CODE", useCode)); ubuilder.must(QueryBuilders.matchQuery("USE_UNIT_CREDIT_CODE", useCode));
String uscCode = QueryParser.escape(map.getString("USC_UNIT_CREDIT_CODE")).toLowerCase(); String uscCode = QueryParser.escape(map.getString("USC_UNIT_CREDIT_CODE")).toLowerCase();
ubuilder.should(QueryBuilders.wildcardQuery("USC_UNIT_CREDIT_CODE", "*" + uscCode + "*")); ubuilder.must(QueryBuilders.wildcardQuery("USC_UNIT_CREDIT_CODE", "*" + QueryParser.escape(uscCode) + "*"));
ubuilder.minimumShouldMatch(1);
boolMust.must(ubuilder); boolMust.must(ubuilder);
} else { } else {
if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) || !ObjectUtils.isEmpty(map.getString("useUnitCreditCode"))) { if (!ObjectUtils.isEmpty(map.getString("USE_UNIT_CREDIT_CODE")) || !ObjectUtils.isEmpty(map.getString("useUnitCreditCode"))) {
...@@ -1455,7 +1485,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1455,7 +1485,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
if (!ObjectUtils.isEmpty(map.getString("USC_UNIT_CREDIT_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USC_UNIT_CREDIT_CODE"))) {
BoolQueryBuilder uuccBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder uuccBuilder = QueryBuilders.boolQuery();
String uscCode = QueryParser.escape(map.getString("USC_UNIT_CREDIT_CODE")).toLowerCase(); String uscCode = QueryParser.escape(map.getString("USC_UNIT_CREDIT_CODE")).toLowerCase();
uuccBuilder.must(QueryBuilders.wildcardQuery("USC_UNIT_CREDIT_CODE", "*" + uscCode + "*")); uuccBuilder.must(QueryBuilders.wildcardQuery("USC_UNIT_CREDIT_CODE", "*" + QueryParser.escape(uscCode) + "*"));
boolMust.must(uuccBuilder); boolMust.must(uuccBuilder);
} }
} }
...@@ -1515,28 +1545,35 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1515,28 +1545,35 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
if (!ObjectUtils.isEmpty(map.getString(EQU_CODE))) { if (!ObjectUtils.isEmpty(map.getString(EQU_CODE))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString(EQU_CODE)); String test = QueryParser.escape(map.getString(EQU_CODE));
pBuilder.must(QueryBuilders.wildcardQuery(EQU_CODE, "*" + test.toLowerCase() + "*")); pBuilder.must(QueryBuilders.wildcardQuery(EQU_CODE, "*" + QueryParser.escape(test.toLowerCase()) + "*"));
boolMust.must(pBuilder); boolMust.must(pBuilder);
} }
// 单位内部编号模糊查询 // 单位内部编号模糊查询
if (!ObjectUtils.isEmpty(map.getString("USE_INNER_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("USE_INNER_CODE"))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("USE_INNER_CODE")); String test = QueryParser.escape(map.getString("USE_INNER_CODE"));
pBuilder.must(QueryBuilders.wildcardQuery("USE_INNER_CODE", "*" + test.toLowerCase() + "*")); pBuilder.must(QueryBuilders.wildcardQuery("USE_INNER_CODE", "*" + QueryParser.escape(test.toLowerCase()) + "*"));
boolMust.must(pBuilder); boolMust.must(pBuilder);
} }
// 出厂编号/产品编码模糊查询 // 出厂编号/产品编码模糊查询
if (!ObjectUtils.isEmpty(map.getString(FACTORY_NUM))) { if (!ObjectUtils.isEmpty(map.getString(FACTORY_NUM))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString(FACTORY_NUM)); String test = QueryParser.escape(map.getString(FACTORY_NUM));
pBuilder.must(QueryBuilders.wildcardQuery(FACTORY_NUM, "*" + test.toLowerCase() + "*")); pBuilder.must(QueryBuilders.wildcardQuery(FACTORY_NUM, "*" + QueryParser.escape(test.toLowerCase()) + "*"));
boolMust.must(pBuilder); boolMust.must(pBuilder);
} }
// 制造单位(生产单位)名称模糊查询 // 制造单位(生产单位)名称模糊查询
if (!ObjectUtils.isEmpty(map.getString("PRODUCE_UNIT_NAME"))) { if (!ObjectUtils.isEmpty(map.getString("PRODUCE_UNIT_NAME"))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("PRODUCE_UNIT_NAME")); String test = QueryParser.escape(map.getString("PRODUCE_UNIT_NAME"));
pBuilder.must(QueryBuilders.wildcardQuery("PRODUCE_UNIT_NAME", "*" + test.toLowerCase() + "*")); pBuilder.must(QueryBuilders.wildcardQuery("PRODUCE_UNIT_NAME", "*" + QueryParser.escape(test.toLowerCase()) + "*"));
boolMust.must(pBuilder);
}
// 模糊查询
if (!ObjectUtils.isEmpty(map.getString(USE_PLACE_CODE))) {
BoolQueryBuilder pBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString(USE_PLACE_CODE));
pBuilder.must(QueryBuilders.wildcardQuery(USE_PLACE_CODE, "*" + QueryParser.escape(test.toLowerCase()) + "*"));
boolMust.must(pBuilder); boolMust.must(pBuilder);
} }
builder.query(boolMust); builder.query(boolMust);
...@@ -1637,39 +1674,39 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -1637,39 +1674,39 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
} }
private void setRepeatUsedCheckFilterByType(BoolQueryBuilder boolMust, String companyCode, String queryType) { private void setRepeatUsedCheckFilterByType(BoolQueryBuilder boolMust, String companyCode, String queryType) {
if("AZ".equals(queryType)){//安装告知 if ("AZ".equals(queryType)) {// 安装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "installNotice");
}else if("GZ_GZ".equals(queryType)){//改造告知 } else if ("GZ_GZ".equals(queryType)) {// 改造告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "renovationNoticeNew"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "renovationNoticeNew");
}else if("GZ_WX".equals(queryType)){//维修告知 } else if ("GZ_WX".equals(queryType)) {// 维修告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintainInfo"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintainInfo");
}else if("GZ_YZ".equals(queryType)){//移装告知 } else if ("GZ_YZ".equals(queryType)) {// 移装告知
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "transferNotice"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "transferNotice");
}else if("SY".equals(queryType)){//使用登记 } else if ("SY".equals(queryType)) {// 使用登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "useRegister"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "useRegister");
}else if("DJ_GZ".equals(queryType)){//改造变更登记 } else if ("DJ_GZ".equals(queryType)) {// 改造变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistration"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistration");
}else if("DJ_YZ".equals(queryType)){//移装变更登记 } else if ("DJ_YZ".equals(queryType)) {// 移装变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistrationTransfer"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeRegistrationTransfer");
}else if("DJ_DW".equals(queryType)){//单位变更登记 } else if ("DJ_DW".equals(queryType)) {// 单位变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "unitChange"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "unitChange");
}else if("DJ_GM".equals(queryType)){//更名变更登记 } else if ("DJ_GM".equals(queryType)) {// 更名变更登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeName"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "changeName");
}else if("BF_YZ".equals(queryType)){//注销 } else if ("BF_YZ".equals(queryType)) {// 注销
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, ""); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("BF_ZX".equals(queryType)){//报废 } else if ("BF_ZX".equals(queryType)) {// 报废
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, ""); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_QY".equals(queryType)){//启用 } else if ("SB_QY".equals(queryType)) {// 启用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, ""); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("SB_TY".equals(queryType)){//停用 } else if ("SB_TY".equals(queryType)) {// 停用
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, ""); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "");
}else if("WB_BA".equals(queryType)){//维保备案 } else if ("WB_BA".equals(queryType)) {// 维保备案
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintenanceFiling"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "maintenanceFiling");
}else if("SB_YJ".equals(queryType)){//设备移交 } else if ("SB_YJ".equals(queryType)) {// 设备移交
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "equipmentHandover"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "equipmentHandover");
}else if("QP_BG".equals(queryType)){//车用气瓶变更 } else if ("QP_BG".equals(queryType)) {// 车用气瓶变更
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleGasCylinderChange"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleGasCylinderChange");
}else if("QP_DJ".equals(queryType)){//车用气瓶登记 } else if ("QP_DJ".equals(queryType)) {// 车用气瓶登记
this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleInformation"); this.setRepeatUsedCheckFilterParam(boolMust, companyCode, "vehicleInformation");
} }
} }
...@@ -2046,10 +2083,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2046,10 +2083,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
object.put("orgCode", company.getOrgCode()); object.put("orgCode", company.getOrgCode());
object.put("companyName", company.getCompanyName()); object.put("companyName", company.getCompanyName());
object.put("companyCode", company.getCompanyCode()); object.put("companyCode", company.getCompanyCode());
CompanyModel result = Privilege.companyClient.queryByCompanyCode(company.getCompanyCode()).getResult(); object.put("companyType", company.getCompanyType());
if (!ValidationUtil.isEmpty(result)) {
object.put("companyType", result.getCompanyType());
}
} }
return object; return object;
} }
...@@ -2098,14 +2132,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2098,14 +2132,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
String sourceRecord = equipmentClassForm.get(RECORD).toString(); String sourceRecord = equipmentClassForm.get(RECORD).toString();
// dataSource = "new".equals(equipSource) ? ("jg_" + sourceRecord) : ("jg_his_" + sourceRecord); // dataSource = "new".equals(equipSource) ? ("jg_" + sourceRecord) : ("jg_his_" + sourceRecord);
// bug-21203 // bug-21203
if (equipmentInfoForm.containsKey("DATA_SOURCE")){ if (equipmentInfoForm.containsKey("DATA_SOURCE")) {
String dataSourceCopy = equipmentInfoForm.get("DATA_SOURCE").toString(); String dataSourceCopy = equipmentInfoForm.get("DATA_SOURCE").toString();
if (dataSourceCopy.startsWith("jg_his")){ if (dataSourceCopy.startsWith("jg_his")) {
dataSource = "jg_his_" + sourceRecord; dataSource = "jg_his_" + sourceRecord;
}else { } else {
dataSource = "jg_" + sourceRecord; dataSource = "jg_" + sourceRecord;
} }
}else { } else {
throw new BadRequest("数据异常,请联系管理员"); throw new BadRequest("数据异常,请联系管理员");
} }
} }
...@@ -2236,7 +2270,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2236,7 +2270,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
} }
iIdxBizJgOtherInfoService.saveOrUpdateData(otherInfo); iIdxBizJgOtherInfoService.saveOrUpdateData(otherInfo);
if(CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) || "2100".equals(equCategory)) { if (CylinderTypeEnum.CYLINDER.getCode().equals(equCategory) || "2100".equals(equCategory)) {
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(JSON.toJSONString(equipmentInfoForm), IdxBizJgInspectionDetectionInfo.class); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = JSON.parseObject(JSON.toJSONString(equipmentInfoForm), IdxBizJgInspectionDetectionInfo.class);
List<Map<String, Object>> inspectionAndTestingInstitutions = commonMapper.getUnitListByType(INSPECTION_AND_TESTING_INSTITUTIONS); List<Map<String, Object>> inspectionAndTestingInstitutions = commonMapper.getUnitListByType(INSPECTION_AND_TESTING_INSTITUTIONS);
Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst(); Optional<Map<String, Object>> optional = inspectionAndTestingInstitutions.stream().filter(x -> x.get("useCode").equals(inspectionDetectionInfo.getInspectOrgCode())).findFirst();
...@@ -2456,9 +2490,9 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2456,9 +2490,9 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
jsonObject.put("useUnitCreditCode", useUnitCreditCode); jsonObject.put("useUnitCreditCode", useUnitCreditCode);
Page<JSONObject> page = new Page<>(jsonObject.getLong("number"), jsonObject.getLong("size")); Page<JSONObject> page = new Page<>(jsonObject.getLong("number"), jsonObject.getLong("size"));
Set<String> records = EquipUsedCheckStrategyContext.getUsedStrategy("useRegister").getEquipInFlow(useUnitCreditCode); Set<String> records = EquipUsedCheckStrategyContext.getUsedStrategy("useRegister").getEquipInFlow(useUnitCreditCode);
if ("8300".equals(jsonObject.get("EQU_CATEGORY_CODE"))) {//管道 if ("8300".equals(jsonObject.get("EQU_CATEGORY_CODE"))) {// 管道
return jgUseRegistrationMapper.queryForUnitPipelineEquipmentPage(page, jsonObject, records); return jgUseRegistrationMapper.queryForUnitPipelineEquipmentPage(page, jsonObject, records);
} else if ("2300".equals(jsonObject.get("EQU_CATEGORY_CODE"))) {//气瓶 } else if ("2300".equals(jsonObject.get("EQU_CATEGORY_CODE"))) {// 气瓶
List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult(); List<DictionarieValueModel> fillingMedium = Systemctl.dictionarieClient.dictValues("FILLING_MEDIUM").getResult();
Map<String, Object> fillingMediumMap = fillingMedium.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue)); Map<String, Object> fillingMediumMap = fillingMedium.stream().collect(Collectors.toMap(DictionarieValueModel::getDictDataKey, DictionarieValueModel::getDictDataValue));
Page<JSONObject> result = jgUseRegistrationMapper.queryForUnitVesselEquipmentPage(page, jsonObject, records); Page<JSONObject> result = jgUseRegistrationMapper.queryForUnitVesselEquipmentPage(page, jsonObject, records);
...@@ -2617,14 +2651,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2617,14 +2651,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
String insUseMaintainExplain = getUrlByKey(fileDataList, "INS_USE_MAINTAIN_EXPLAIN"); String insUseMaintainExplain = getUrlByKey(fileDataList, "INS_USE_MAINTAIN_EXPLAIN");
String otherAccessoriesFact = getUrlByKey(fileDataList, "OTHER_ACCESSORIES_FACT"); String otherAccessoriesFact = getUrlByKey(fileDataList, "OTHER_ACCESSORIES_FACT");
String factSupervisionInspectionReport = getUrlByKey(fileDataList, "FACT_SUPERVISION_INSPECTION_REPORT"); String factSupervisionInspectionReport = getUrlByKey(fileDataList, "FACT_SUPERVISION_INSPECTION_REPORT");
//使用信息 // 使用信息
IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo(); IdxBizJgUseInfo useInfo = new IdxBizJgUseInfo();
BeanUtils.copyProperties(data, useInfo); BeanUtils.copyProperties(data, useInfo);
useInfo.setRecord(record); useInfo.setRecord(record);
useInfo.setRecDate(new Date()); useInfo.setRecDate(new Date());
useInfo.setDataSource("his".equals(equipInfoDto.getDataSource()) ? "jg_his" : "jg");//区分历史设备和新增设备 useInfo.setDataSource("his".equals(equipInfoDto.getDataSource()) ? "jg_his" : "jg");// 区分历史设备和新增设备
useInfo.setEquState(null); useInfo.setEquState(null);
useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));//历史气瓶导入为已纳管设备 useInfo.setIsIntoManagement("his".equals(equipInfoDto.getDataSource()));// 历史气瓶导入为已纳管设备
// 使用单位信息 // 使用单位信息
if ("个人主体".equals(company.getCompanyType())) { if ("个人主体".equals(company.getCompanyType())) {
useInfo.setUseUnitCreditCode(company.getCompanyCode().split("_")[1]); useInfo.setUseUnitCreditCode(company.getCompanyCode().split("_")[1]);
...@@ -2635,7 +2669,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2635,7 +2669,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
} }
useInfoList.add(useInfo); useInfoList.add(useInfo);
//设计信息 // 设计信息
IdxBizJgDesignInfo designInfo = new IdxBizJgDesignInfo(); IdxBizJgDesignInfo designInfo = new IdxBizJgDesignInfo();
BeanUtils.copyProperties(data, designInfo); BeanUtils.copyProperties(data, designInfo);
designInfo.setRecord(record); designInfo.setRecord(record);
...@@ -2648,7 +2682,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2648,7 +2682,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
designInfo.setOtherAccessoriesDes(otherAccessoriesDes); designInfo.setOtherAccessoriesDes(otherAccessoriesDes);
designInfoList.add(designInfo); designInfoList.add(designInfo);
//制造信息 // 制造信息
IdxBizJgFactoryInfo factoryInfo = new IdxBizJgFactoryInfo(); IdxBizJgFactoryInfo factoryInfo = new IdxBizJgFactoryInfo();
BeanUtils.copyProperties(data, factoryInfo); BeanUtils.copyProperties(data, factoryInfo);
factoryInfo.setRecord(record); factoryInfo.setRecord(record);
...@@ -2662,7 +2696,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2662,7 +2696,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0")); factoryInfo.setImported(Optional.ofNullable(data.getImported()).orElse("0"));
factoryInfoList.add(factoryInfo); factoryInfoList.add(factoryInfo);
//注册登记 // 注册登记
IdxBizJgRegisterInfo registerInfo = new IdxBizJgRegisterInfo(); IdxBizJgRegisterInfo registerInfo = new IdxBizJgRegisterInfo();
BeanUtils.copyProperties(data, registerInfo); BeanUtils.copyProperties(data, registerInfo);
registerInfo.setRecord(record); registerInfo.setRecord(record);
...@@ -2679,14 +2713,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2679,14 +2713,14 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
} }
registerInfoList.add(registerInfo); registerInfoList.add(registerInfo);
//检验检测 // 检验检测
IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = new IdxBizJgInspectionDetectionInfo(); IdxBizJgInspectionDetectionInfo inspectionDetectionInfo = new IdxBizJgInspectionDetectionInfo();
BeanUtils.copyProperties(data, inspectionDetectionInfo); BeanUtils.copyProperties(data, inspectionDetectionInfo);
inspectionDetectionInfo.setInspectOrgCode(data.getInspectOrgCode()); inspectionDetectionInfo.setInspectOrgCode(data.getInspectOrgCode());
inspectionDetectionInfo.setRecord(record); inspectionDetectionInfo.setRecord(record);
inspectionDetectionInfo.setRecDate(new Date()); inspectionDetectionInfo.setRecDate(new Date());
inspectionDetectionInfo.setInspectType("ZZJDJY"); inspectionDetectionInfo.setInspectType("ZZJDJY");
inspectionDetectionInfo.setInspectConclusion("6040");//默认合格 inspectionDetectionInfo.setInspectConclusion("6040");// 默认合格
inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd")); inspectionDetectionInfo.setInspectDate(DateUtil.parse(data.getInspectDate(), "yyyy-MM-dd"));
// 根据条件确定增加的年数 // 根据条件确定增加的年数
inspectionDetectionInfo.setNextInspectDate(Date.from( inspectionDetectionInfo.setNextInspectDate(Date.from(
...@@ -2707,7 +2741,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2707,7 +2741,7 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
} }
otherInfoList.add(otherInfo); otherInfoList.add(otherInfo);
//技术参数 // 技术参数
IdxBizJgTechParamsVessel paramsVessel = new IdxBizJgTechParamsVessel(); IdxBizJgTechParamsVessel paramsVessel = new IdxBizJgTechParamsVessel();
BeanUtils.copyProperties(data, paramsVessel); BeanUtils.copyProperties(data, paramsVessel);
paramsVessel.setRecord(record); paramsVessel.setRecord(record);
...@@ -2745,9 +2779,9 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2745,9 +2779,9 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
if ("his".equals(equipInfoDto.getDataSource())) { if ("his".equals(equipInfoDto.getDataSource())) {
// 生成tzs_jg_certificate_change_record_eq记录 // 生成tzs_jg_certificate_change_record_eq记录
JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq(); JgCertificateChangeRecordEq changeRecordEq = new JgCertificateChangeRecordEq();
changeRecordEq.setChangeRecordId(String.valueOf(changeRecordId));//登记证记录主键 changeRecordEq.setChangeRecordId(String.valueOf(changeRecordId));// 登记证记录主键
changeRecordEq.setEquId(registerInfo.getRecord());//设备主键 changeRecordEq.setEquId(registerInfo.getRecord());// 设备主键
changeRecordEq.setProductCode(factoryInfo.getFactoryNum());//产品编号 changeRecordEq.setProductCode(factoryInfo.getFactoryNum());// 产品编号
certificateChangeRecordEqService.save(changeRecordEq); certificateChangeRecordEqService.save(changeRecordEq);
} }
}); });
...@@ -2823,13 +2857,13 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper; ...@@ -2823,13 +2857,13 @@ private SafetyProblemTracingMapper safetyProblemTracingMapper;
changeRecord.setAuditPassDate(new Date()); changeRecord.setAuditPassDate(new Date());
changeRecord.setRegType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName()); changeRecord.setRegType(BusinessTypeEnum.JG_USAGE_REGISTRATION.getName());
changeRecord.setRegDate(registrationManage.getCreateDate()); changeRecord.setRegDate(registrationManage.getCreateDate());
changeRecord.setChangeContent(this.buildRecordContent(registrationManage));//变更内容 changeRecord.setChangeContent(this.buildRecordContent(registrationManage));// 变更内容
changeRecord.setUseRegistrationCode(registrationManage.getUseRegistrationCode());//使用登记编号 changeRecord.setUseRegistrationCode(registrationManage.getUseRegistrationCode());// 使用登记编号
changeRecord.setReceiveCompanyCode(registrationManage.getReceiveCompanyCode());//接收机构公司代码 changeRecord.setReceiveCompanyCode(registrationManage.getReceiveCompanyCode());// 接收机构公司代码
changeRecord.setCertificateNo(registrationManage.getCertificateNo());//登记证书唯一码 changeRecord.setCertificateNo(registrationManage.getCertificateNo());// 登记证书唯一码
changeRecord.setUseUnitCreditCode(registrationManage.getUseUnitCreditCode());//使用单位统一信用代码 changeRecord.setUseUnitCreditCode(registrationManage.getUseUnitCreditCode());// 使用单位统一信用代码
changeRecord.setUseUnitName(registrationManage.getUseUnitName());//使用单位名称 changeRecord.setUseUnitName(registrationManage.getUseUnitName());// 使用单位名称
changeRecord.setEquCategory(registrationManage.getEquCategory());//设备类别编码 changeRecord.setEquCategory(registrationManage.getEquCategory());// 设备类别编码
changeRecord.setRoutePath(""); changeRecord.setRoutePath("");
changeRecord.setCreateDate(new Date()); changeRecord.setCreateDate(new Date());
changeRecord.setSequenceNbr(changeRecordId); changeRecord.setSequenceNbr(changeRecordId);
......
...@@ -20,10 +20,11 @@ public interface JyjcInspectionApplicationEquipMapper extends BaseMapper<JyjcIns ...@@ -20,10 +20,11 @@ public interface JyjcInspectionApplicationEquipMapper extends BaseMapper<JyjcIns
/** /**
* 检验检测次数统计维度按照设备种类、检验类型进行统计 * 检验检测次数统计维度按照设备种类、检验类型进行统计
* *
* @param dpFilterParamDto g过滤条件 * @param dpFilterParamDto 过滤条件时间
* @param orgCode 过滤条件区域对应的公司的orgCode
* @return 统计列表 * @return 统计列表
*/ */
List<InspectTimeCountDto> countInspectTimeCountByTypeAndEquList(DPFilterParamDto dpFilterParamDto); List<InspectTimeCountDto> countInspectTimeCountByTypeAndEquList(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
Integer inspectTimeCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto); Integer inspectTimeCount(@Param("dpFilterParamDto") DPFilterParamDto dpFilterParamDto);
} }
...@@ -21,31 +21,29 @@ ...@@ -21,31 +21,29 @@
c.equ_define, c.equ_define,
count(1) as num count(1) as num
from from
(SELECT (
ae.equ_list, SELECT
ae.equ_category, ae.equ_list,
ae.equ_define, ae.equ_category,
a.biz_type, ae.equ_define,
concat(u.PROVINCE,'#', u.CITY,'#', u.COUNTY) as areaCode a.biz_type,
FROM s.ORG_BRANCH_CODE as orgBranchCode
"tz_jyjc_inspection_application_equip" ae, FROM
tz_jyjc_inspection_application a, "tz_jyjc_inspection_application_equip" ae,
"idx_biz_jg_use_info" u tz_jyjc_inspection_application a,
where "idx_biz_jg_supervision_info" s
ae.equip_unicode = u."RECORD" where
and a.sequence_nbr = ae.application_seq s."RECORD" = ae.equip_unicode
and (a.application_date between #{beginDate} and #{endDate}) and a.sequence_nbr = ae.application_seq
and a.status='6616' and a.application_date between #{dto.beginDate} and #{dto.endDate}
and u."PROVINCE" <![CDATA[<>]]> '' and a.status='6616'
and u."CITY" <![CDATA[<>]]> '' ) c
and u."COUNTY" <![CDATA[<>]]> ''
) c
where where
c.areaCode like concat('%',#{cityCode}, '%') c.orgBranchCode like concat(#{orgCode}, '%')
group by c.biz_type, group by c.biz_type,
c.equ_list, c.equ_list,
c.equ_category, c.equ_category,
c.equ_define c.equ_define
</select> </select>
<select id="inspectTimeCount" resultType="java.lang.Integer"> <select id="inspectTimeCount" resultType="java.lang.Integer">
SELECT COUNT SELECT COUNT
......
...@@ -114,8 +114,9 @@ public class DPStatisticsServiceImpl { ...@@ -114,8 +114,9 @@ public class DPStatisticsServiceImpl {
} }
private void buildYData(Map<String, Object> result, List<BizTypeEnum> bizTypeEnums, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) { private void buildYData(Map<String, Object> result, List<BizTypeEnum> bizTypeEnums, DPFilterParamDto dpFilterParamDto, List<EquipmentCategoryDto> equipmentCategoryDtos) {
String orgCode = this.getAndSetOrgCode(dpFilterParamDto.getCityCode());
// 待统计的数据本来sql可以单独统计,但是要求气瓶单独从压力容器里拎出来,与八大类同级,故java处理 // 待统计的数据本来sql可以单独统计,但是要求气瓶单独从压力容器里拎出来,与八大类同级,故java处理
List<InspectTimeCountDto> inspectTimeCountDtos = inspectionApplicationEquipMapper.countInspectTimeCountByTypeAndEquList(dpFilterParamDto); List<InspectTimeCountDto> inspectTimeCountDtos = inspectionApplicationEquipMapper.countInspectTimeCountByTypeAndEquList(orgCode,dpFilterParamDto);
bizTypeEnums.forEach(bizTypeEnum -> { bizTypeEnums.forEach(bizTypeEnum -> {
result.put(bizTypeEnum.getCode(), this.countNumByBizTypeAndEquList(equipmentCategoryDtos, bizTypeEnum.getCode(), inspectTimeCountDtos)); result.put(bizTypeEnum.getCode(), this.countNumByBizTypeAndEquList(equipmentCategoryDtos, bizTypeEnum.getCode(), inspectTimeCountDtos));
}); });
......
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