Commit f4ab6f96 authored by suhuiguang's avatar suhuiguang

1.安全追溯详情接口开发

parent 50751d2c
...@@ -9,7 +9,7 @@ import java.util.List; ...@@ -9,7 +9,7 @@ import java.util.List;
@Getter @Getter
public enum IssueMainBodyEnum { public enum IssueMainBodyEnum {
//个人 //个人1
PERSON("个人","1"), PERSON("个人","1"),
//企业 //企业
COMPANY("企业","2"), COMPANY("企业","2"),
......
package com.yeejoin.amos.boot.module.statistics.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDateDto;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamForDetailDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.Map;
/**
* 安全追溯问题
*
* @author system_generator
* @date 2024-05-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "SafetyProblemTracingDto", description = "安全追溯问题")
public class SafetyProblemTracingDto extends DPFilterParamForDetailDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "问题编号")
private String problemNum;
@ApiModelProperty(value = "问题类型(维保超期、检验超期、资质超期等)")
private String problemType;
@ApiModelProperty(value = "问题类型图片")
private String problemTypePic;
@ApiModelProperty(value = "问题来源类型(1个人、2设备、3企业)")
private String sourceType;
@ApiModelProperty(value = "问题来源ID(个人ID、设备ID、企业ID)")
private String sourceId;
@ApiModelProperty(value = "问题描述")
private String problemDesc;
@ApiModelProperty(value = "问题产生查询开始时间")
private String problemTimeStart;
@ApiModelProperty(value = "问题产生时间")
private Date problemTime;
@ApiModelProperty(value = "问题产生查询结束时间")
private String problemTimeEnd;
@ApiModelProperty(value = "主体单位名称")
private String principalUnit;
@ApiModelProperty(value = "主体单位统一代码")
private String principalUnitCode;
@ApiModelProperty(value = "主体单位类型(使用、安改维、检验检测等)")
private String principalUnitType;
@ApiModelProperty(value = "管辖机构名称")
private String governingBody;
@ApiModelProperty(value = "管辖机构单位代码")
private String governingBodyCode;
@ApiModelProperty(value = "管辖机构组织机构代码(例如50*60*70)")
private String governingBodyOrgCode;
@ApiModelProperty(value = "主体单位所属区域名称(陕西省/西安市/莲湖区)")
private String regionName;
@ApiModelProperty(value = "所属区域代码(6100000/6100010/6100011)")
private String regionCode;
@ApiModelProperty(value = "问题状态(0未处理、1已处理)")
private String problemStatus;
@ApiModelProperty(value = "问题状态代码(0未处理、1已处理)")
private String problemStatusCode;
@ApiModelProperty(value = "问题状态对象")
private Map<String, String> problemStatusObj;
@ApiModelProperty(value = "更新人员")
private String recUser;
@ApiModelProperty(value = "创建人ID")
private String createUserId;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "创建人")
private String createUser;
@ApiModelProperty(value = "企业负责人")
private String unitCharger;
@ApiModelProperty(value = "企业负责人联系电话")
private String unitChargerPhone;
@ApiModelProperty(value = "设备监管码")
private String equipSuperviseCode;
@ApiModelProperty(value = "设备种类")
private String equipList;
@ApiModelProperty(value = "人员名称")
private String userName;
@ApiModelProperty(value = "人员电话")
private String userPhone;
@ApiModelProperty(value = "人员岗位")
private String userPost;
@ApiModelProperty(value = "扩展信息")
private String extraInfo;
@ApiModelProperty(value = "设备种类代码")
private String equipListCode;
@ApiModelProperty(value = "问题类型代码(维保超期、检验超期、资质超期等)")
private String problemTypeCode;
@ApiModelProperty(value = "问题来源类型code(1个人、2设备、3企业)")
private String sourceTypeCode;
@ApiModelProperty(value = "问题等级(一级、二级、三级)")
private String problemLevel;
@ApiModelProperty(value = "问题等级code")
private String problemLevelCode;
}
package com.yeejoin.amos.boot.module.statistics.api.mapper; package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.dto.KeyValueDto; import com.yeejoin.amos.boot.biz.common.dto.KeyValueDto;
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.statistics.api.dto.EquipQuestionNumCountDto; import com.yeejoin.amos.boot.module.statistics.api.dto.EquipQuestionNumCountDto;
import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -21,7 +23,7 @@ public interface AQZSDPStatisticsMapper { ...@@ -21,7 +23,7 @@ public interface AQZSDPStatisticsMapper {
* @param filterParamDto 过滤日期 * @param filterParamDto 过滤日期
* @return List<CountDto> * @return List<CountDto>
*/ */
List<CountDto> selectByOrgAndMainBody(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto filterParamDto); List<CountDto> selectByOrgAndMainBody(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto filterParamDto, @Param("sourceTypeCode") String sourceTypeCode);
List<CountDto> selectByOrgAndProblemType(@Param("orgCode") String orgCode, @Param("enumNameList") List<String> enumNameList, List<CountDto> selectByOrgAndProblemType(@Param("orgCode") String orgCode, @Param("enumNameList") List<String> enumNameList,
...@@ -31,7 +33,7 @@ public interface AQZSDPStatisticsMapper { ...@@ -31,7 +33,7 @@ public interface AQZSDPStatisticsMapper {
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); int countByOrgCode(@Param("orgCode") String orgCode, @Param("now") String now, @Param("sourceTypeCode") String sourceTypeCode);
List<Map<String, String>> getOrgCodeAndCompanyCodesByCompanyCodes(@Param("regionCodes") List<Integer> regionCodes); List<Map<String, String>> getOrgCodeAndCompanyCodesByCompanyCodes(@Param("regionCodes") List<Integer> regionCodes);
...@@ -75,4 +77,6 @@ public interface AQZSDPStatisticsMapper { ...@@ -75,4 +77,6 @@ public interface AQZSDPStatisticsMapper {
List<CountDto> selectByOrgAndProblemTypeForCy(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto); List<CountDto> selectByOrgAndProblemTypeForCy(@Param("orgCode") String orgCode, @Param("dto") DPFilterParamDto dpFilterParamDto);
Page<SafetyProblemTracingDto> queryForSafetyProblemTracingPage(Page<SafetyProblemTracingDto> page, SafetyProblemTracingDto problemModel);
} }
...@@ -15,13 +15,16 @@ ...@@ -15,13 +15,16 @@
tzs_safety_problem_tracing tzs_safety_problem_tracing
WHERE WHERE
governing_body_org_code LIKE concat (#{orgCode}, '%') governing_body_org_code LIKE concat (#{orgCode}, '%')
<if test="dto.beginDate !=null and dto.beginDate !=''"> <if test="dto != null and dto.beginDate !=null and dto.beginDate !=''">
and date_ge(CAST(problem_time as date),#{dto.beginDate}) and date_ge(CAST(problem_time as date),#{dto.beginDate})
</if> </if>
<if test="dto.endDate !=null and dto.endDate !=''"> <if test="dto != null and dto.endDate !=null and dto.endDate !=''">
and date_le(CAST(problem_time as date),#{dto.endDate}) and date_le(CAST(problem_time as date),#{dto.endDate})
</if> </if>
GROUP BY source_type,problem_status_code <if test="sourceTypeCode !=null and sourceTypeCode !=''">
and source_type_code = #{sourceTypeCode}
</if>
GROUP BY source_type_code,problem_status_code
</select> </select>
<select id="selectByOrgAndProblemType" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto"> <select id="selectByOrgAndProblemType" resultType="com.yeejoin.amos.boot.biz.common.dto.CountDto">
SELECT SELECT
...@@ -109,6 +112,9 @@ ...@@ -109,6 +112,9 @@
<if test="now != null and now != ''"> <if test="now != null and now != ''">
AND DATE_FORMAT(problem_time,'%Y-%m') &gt;= #{now} AND DATE_FORMAT(problem_time,'%Y-%m') &gt;= #{now}
</if> </if>
<if test="sourceTypeCode !=null and sourceTypeCode !=''">
and source_type_code = #{sourceTypeCode}
</if>
</select> </select>
<select id="getOrgCodeAndCompanyCodesByCompanyCodes" resultType="java.util.Map"> <select id="getOrgCodeAndCompanyCodesByCompanyCodes" resultType="java.util.Map">
select org_code AS orgCode,company_code AS companyCode from privilege_company where company_code in select org_code AS orgCode,company_code AS companyCode from privilege_company where company_code in
...@@ -358,6 +364,61 @@ ...@@ -358,6 +364,61 @@
GROUP BY GROUP BY
source_type source_type
</select> </select>
<select id="queryForSafetyProblemTracingPage" resultType="com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto">
select
spt.*,
(select extend::json->>'pic' from cb_data_dictionary where type = 'ISSUE_TYPE' and code = spt.problem_type_code) problemTypePic
from tzs_safety_problem_tracing spt
<where>
spt.is_delete = false
<if test="problemModel.problemNum != null and problemModel.problemNum != ''">
and spt.problem_num = LIKE CONCAT('%', #{problemModel.problemNum}, '%')
</if>
<if test="problemModel.problemStatus != null and problemModel.problemStatus != ''">
and spt.problem_status = #{problemModel.problemStatus}
</if>
<if test="problemModel.sourceTypeCode != null and problemModel.sourceTypeCode != ''">
and spt.source_type_code = #{problemModel.sourceTypeCode}
</if>
<if test="problemModel.problemLevelCode != null and problemModel.problemLevelCode != ''">
and spt.problem_level_code = #{problemModel.problemLevelCode}
</if>
<if test="problemModel.problemTypeCode != null and problemModel.problemTypeCode != ''">
and spt.problem_type_code = #{problemModel.problemTypeCode}
</if>
<if test="problemModel.problemTimeStart != null ">
and cast(spt.problem_time AS DATE) >= #{problemModel.problemTimeStart}
</if>
<if test="problemModel.problemTimeEnd != null">
and cast(spt.problem_time AS DATE) <![CDATA[<=]]> #{problemModel.problemTimeEnd}
</if>
<if test="problemModel.problemDesc != null and problemModel.problemDesc != ''">
and spt.problem_desc like CONCAT('%', #{problemModel.problemDesc}, '%')
</if>
<if test="problemModel.sourceId != null and problemModel.sourceId != ''">
and spt.source_id = #{problemModel.sourceId}
</if>
<if test="problemModel.governingBodyOrgCode != null and problemModel.governingBodyOrgCode != ''">
and spt.governing_body_org_code like CONCAT(#{problemModel.governingBodyOrgCode}, '%')
</if>
<if test="problemModel.governingBodyCode != null and problemModel.governingBodyCode != ''">
and spt.governing_body_code = #{problemModel.governingBodyCode}
</if>
<if test="problemModel.principalUnit != null and problemModel.principalUnit != ''">
and spt.principal_unit like CONCAT('%', #{problemModel.principalUnit}, '%')
</if>
<if test="problemModel.principalUnitType != null and problemModel.principalUnitType != ''">
and spt.principal_unit_type = #{problemModel.principalUnitType}
</if>
<if test="problemModel.regionCode != null and problemModel.regionCode != ''">
and spt.region_code like CONCAT(#{problemModel.regionCode}, '%')
</if>
<if test="problemModel.problemStatusCode != null and problemModel.problemStatusCode != ''">
and spt.problem_status_code = #{problemModel.problemStatusCode}
</if>
</where>
order by spt.create_date desc
</select>
</mapper> </mapper>
package com.yeejoin.amos.boot.module.statistcs.biz.controller; package com.yeejoin.amos.boot.module.statistcs.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.DPFilterParamForDetailDto;
import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl; import com.yeejoin.amos.boot.module.statistcs.biz.service.impl.AQZSDPStatisticsServiceImpl;
import com.yeejoin.amos.boot.module.statistics.api.dto.SafetyProblemTracingDto;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -263,4 +266,55 @@ public class AQZSDPStatisticsController { ...@@ -263,4 +266,55 @@ public class AQZSDPStatisticsController {
} }
return ResponseHelper.buildResponse(statisticsService.getCenterMapCountDataForOverview(dpFilterParamDto)); return ResponseHelper.buildResponse(statisticsService.getCenterMapCountDataForOverview(dpFilterParamDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "安全追溯-详情-左侧分类", notes = "安全追溯-详情-左侧分类")
@PostMapping(value = "/detail/tree")
public ResponseModel<List<Map<String, Object>>> getDetailTree(@RequestBody DPFilterParamDto dpFilterParamDto) {
return ResponseHelper.buildResponse(statisticsService.getDetailTree(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "当年主体单位问题排名-详情-柱状统计图", notes = "安全追溯-当年主体单位问题排名-详情-柱状统计图")
@PostMapping(value = "/companyTopDetail/bar")
public ResponseModel<Map<String, Object>> issueCompanyTopDetailBar(@Validated @RequestBody DPFilterParamForDetailDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.issueCompanyTopDetailBar(dpFilterParamDto));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "当年下级区域问题闭环率排名-详情-折线图", notes = "安全追溯-当年下级区域问题闭环率排名-详情-柱状统计图")
@PostMapping(value = "/childrenCityCount/line")
public ResponseModel<Map<String, Object>> issueChildrenCityCountTopDetailLine(@Validated @RequestBody DPFilterParamForDetailDto dpFilterParamDto, BindingResult result) {
List<FieldError> fieldErrors = result.getFieldErrors();
if (!fieldErrors.isEmpty()) {
throw new BadRequest(fieldErrors.get(0).getDefaultMessage());
}
return ResponseHelper.buildResponse(statisticsService.issueChildrenCityCountTopDetailLine(dpFilterParamDto));
}
/**
* 列表分页查询-大屏使用
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page/dp")
@ApiOperation(httpMethod = "POST",value = "分页查询安全追溯问题-大屏使用", notes = "分页查询安全追溯问题-大屏使用")
public ResponseModel<Page<SafetyProblemTracingDto>> getProblemRecords(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestBody(required = false) SafetyProblemTracingDto problemModel) {
Page<SafetyProblemTracingDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(statisticsService.getProblemRecords(page, problemModel));
}
} }
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