Commit 0f06e70c authored by suhuiguang's avatar suhuiguang

1.大屏-安全追溯-问题主体接口调整

parent 27afc1e1
......@@ -24,8 +24,8 @@ public interface AQZSDPStatisticsMapper {
List<CountDto> selectByOrgAndMainBody(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto filterParamDto);
List<Map<String, Object>> selectByOrgAndProblemType(@Param("orgCode") String orgCode, @Param("enumNameList") List<String> enumNameList,
@Param("startDate") String startDate, @Param("sourceType") String sourceType, @Param("equipType") String equipType);
List<CountDto> selectByOrgAndProblemType(@Param("orgCode") String orgCode, @Param("enumNameList") List<String> enumNameList,
@Param("dto") DPFilterParamDto startDate, @Param("sourceType") String sourceType, @Param("equipType") String equipType);
List<Map<String, Object>> getIssueCountByMonth(@Param("orgCode") String orgCode, @Param("year") String year, @Param("status") String status);
......
......@@ -23,15 +23,20 @@
</if>
GROUP BY source_type,problem_status_code
</select>
<select id="selectByOrgAndProblemType" resultType="java.util.Map">
SELECT COUNT
( 1 ),
problem_type AS problemType
<select id="selectByOrgAndProblemType" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT
COUNT(1) as longValue,
problem_type AS keyStr
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND problem_time &gt;= #{startDate}
<if test="dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(problem_time as date),#{dto.beginDate})
</if>
<if test="dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(problem_time as date),#{dto.endDate})
</if>
AND source_type = #{sourceType}
<if test="null != equipType">
AND equip_list_code = #{equipType}
......
......@@ -70,12 +70,12 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-设备问题近30天统计")
@PostMapping(value = "/equipmentCount")
public ResponseModel<Map<String, Object>> equipmentCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
public ResponseModel<Map<String, Object>> equipmentCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
Map<String, Object> result = statisticsService.equipmentCount(regionCode.toString());
Map<String, Object> result = statisticsService.equipmentCount(dpFilterParamDto);
return ResponseHelper.buildResponse(result);
}
......@@ -83,12 +83,12 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-企业问题近30天统计")
@PostMapping(value = "/companyCount")
public ResponseModel<List<Map<String, Object>>> companyCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
public ResponseModel<List<Map<String, Object>>> companyCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
List<Map<String, Object>> result = statisticsService.companyCount(regionCode.toString());
List<Map<String, Object>> result = statisticsService.companyCount(dpFilterParamDto);
return ResponseHelper.buildResponse(result);
}
......@@ -96,12 +96,12 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-人员问题近30天统计")
@PostMapping(value = "/personCount")
public ResponseModel<Map<String, Object>> personCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
public ResponseModel<Map<String, Object>> personCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
Map<String, Object> result = statisticsService.personCount(regionCode.toString());
Map<String, Object> result = statisticsService.personCount(dpFilterParamDto);
return ResponseHelper.buildResponse(result);
}
......@@ -110,12 +110,12 @@ public class AQZSDPStatisticsController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "大屏-安全追溯-左屏-气瓶问题近30天统计")
@PostMapping(value = "/cylinderCount")
public ResponseModel<Map<String, Object>> cylinderCount(@RequestBody Map<String, Object> map) {
Object regionCode = map.get("cityCode");
if (ObjectUtils.isEmpty(regionCode)) {
regionCode = "610000";
public ResponseModel<Map<String, Object>> cylinderCount(@Validated @RequestBody DPFilterParamDto dpFilterParamDto, BindingResult bindingResult) throws Exception {
List<FieldError> fieldErrors = bindingResult.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
Map<String, Object> result = statisticsService.cylinderCount(regionCode.toString());
Map<String, Object> result = statisticsService.cylinderCount(dpFilterParamDto);
return ResponseHelper.buildResponse(result);
}
......
......@@ -368,19 +368,17 @@ public class AQZSDPStatisticsServiceImpl {
}
public Map<String, Object> equipmentCount(String cityCode) {
public Map<String, Object> equipmentCount(DPFilterParamDto dpFilterParamDto) {
this.setDefaultFilter(dpFilterParamDto);
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("3");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if(orgCode != null){
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.EQUIPMENT.getName(), null);
list.forEach(t -> {
dataMap.put(t.get("problemType").toString(), t.get("count").toString());
});
List<CountDto> countDtos = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, dpFilterParamDto, IssueMainBodyEnum.EQUIPMENT.getName(), null);
countDtos.forEach(t -> dataMap.put(t.getKeyStr(), t.getLongValue()));
}
for (int i = 0; i < enumNameList.size(); i++) {
xdata.add(enumNameList.get(i));
......@@ -391,17 +389,15 @@ public class AQZSDPStatisticsServiceImpl {
return resultMap;
}
public List<Map<String, Object>> companyCount(String cityCode) {
public List<Map<String, Object>> companyCount(DPFilterParamDto dpFilterParamDto) {
this.setDefaultFilter(dpFilterParamDto);
List<Map<String, Object>> resultList = new ArrayList<>();
Map<String, Object> dataMap = new HashMap<>();
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("2");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if(orgCode != null){
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.COMPANY.getName(), null);
list.forEach(t -> {
dataMap.put(t.get("problemType").toString(), t.get("count").toString());
});
List<CountDto> countDtos = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, dpFilterParamDto, IssueMainBodyEnum.COMPANY.getName(), null);
countDtos.forEach(t -> dataMap.put(t.getKeyStr(), t.getLongValue()));
}
for (int i = 0; i < enumNameList.size(); i++) {
Map<String, Object> map = new HashMap<>();
......@@ -429,19 +425,17 @@ public class AQZSDPStatisticsServiceImpl {
return resultList;
}
public Map<String, Object> personCount(String cityCode) {
public Map<String, Object> personCount(DPFilterParamDto dpFilterParamDto) {
this.setDefaultFilter(dpFilterParamDto);
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("1");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if(orgCode != null){
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.PERSON.getName(), null);
list.forEach(t -> {
dataMap.put(t.get("problemType").toString(), t.get("count").toString());
});
List<CountDto> countDtos = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, dpFilterParamDto, IssueMainBodyEnum.PERSON.getName(), null);
countDtos.forEach(t -> dataMap.put(t.getKeyStr(), t.getLongValue()));
}
for (int i = 0; i < enumNameList.size(); i++) {
xdata.add(enumNameList.get(i));
......@@ -452,19 +446,17 @@ public class AQZSDPStatisticsServiceImpl {
return resultMap;
}
public Map<String, Object> cylinderCount(String cityCode) {
public Map<String, Object> cylinderCount(DPFilterParamDto dpFilterParamDto) {
this.setDefaultFilter(dpFilterParamDto);
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
List<Object> xdata = new ArrayList<>();
List<Object> ydata = new ArrayList<>();
List<String> enumNameList = IssueTypeEnum.getEnumNameListByMainBody("4");
String startDate = LocalDate.now().minusDays(29).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
String orgCode = stCommonService.getAndSetOrgCode(cityCode);
String orgCode = stCommonService.getAndSetOrgCode(dpFilterParamDto.getCityCode());
if(orgCode != null){
List<Map<String, Object>> list = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, startDate, IssueMainBodyEnum.EQUIPMENT.getName(), "2300");
list.forEach(t -> {
dataMap.put(t.get("problemType").toString(), t.get("count").toString());
});
List<CountDto> countDtos = statisticsMapper.selectByOrgAndProblemType(orgCode, enumNameList, dpFilterParamDto, IssueMainBodyEnum.EQUIPMENT.getName(), "2300");
countDtos.forEach(t -> dataMap.put(t.getKeyStr(), t.getLongValue()));
}
for (int i = 0; i < enumNameList.size(); i++) {
xdata.add(enumNameList.get(i));
......
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