Commit 0771b49f authored by wuqinghua's avatar wuqinghua

2022-4-1 吴卿华

parent 7617257a
package com.zehong.web.controller.supervise;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.THiddenTroubleInfo;
import com.zehong.system.service.ITHiddenTroubleInfoService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 燃气隐患Controller
*
* @author zehong
* @date 2022-03-31
*/
@RestController
@RequestMapping("/system/info")
public class THiddenTroubleInfoSController extends BaseController
{
@Autowired
private ITHiddenTroubleInfoService tHiddenTroubleInfoService;
/**
* 查询燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public TableDataInfo list(THiddenTroubleInfo tHiddenTroubleInfo)
{
//获取用户信息
SysUser user = SecurityUtils.getLoginUser().getUser();
tHiddenTroubleInfo.setBeyondEnterpriseId(user.getDeptId());
startPage();
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoList(tHiddenTroubleInfo);
return getDataTable(list);
}
/**
* 导出燃气隐患列表
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "燃气隐患", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(THiddenTroubleInfo tHiddenTroubleInfo)
{
List<THiddenTroubleInfo> list = tHiddenTroubleInfoService.selectTHiddenTroubleInfoExcelList(tHiddenTroubleInfo);
ExcelUtil<THiddenTroubleInfo> util = new ExcelUtil<THiddenTroubleInfo>(THiddenTroubleInfo.class);
return util.exportExcel(list, "燃气隐患数据");
}
/**
* 获取燃气隐患详细信息
*/
@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{hiddenTroubleId}")
public AjaxResult getInfo(@PathVariable("hiddenTroubleId") Long hiddenTroubleId)
{
return AjaxResult.success(tHiddenTroubleInfoService.selectTHiddenTroubleInfoById(hiddenTroubleId));
}
/**
* 新增燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:add')")
@Log(title = "燃气隐患", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
//获取用户信息
SysUser user = SecurityUtils.getLoginUser().getUser();
tHiddenTroubleInfo.setBeyondEnterpriseId(user.getDeptId());
return toAjax(tHiddenTroubleInfoService.insertTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 修改燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "燃气隐患", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody THiddenTroubleInfo tHiddenTroubleInfo)
{
return toAjax(tHiddenTroubleInfoService.updateTHiddenTroubleInfo(tHiddenTroubleInfo));
}
/**
* 删除燃气隐患
*/
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "燃气隐患", businessType = BusinessType.DELETE)
@DeleteMapping("/{hiddenTroubleIds}")
public AjaxResult remove(@PathVariable Long[] hiddenTroubleIds)
{
return toAjax(tHiddenTroubleInfoService.deleteTHiddenTroubleInfoByIds(hiddenTroubleIds));
}
}
......@@ -21,8 +21,10 @@ public class THiddenTroubleInfo extends BaseEntity
/** 隐患id */
private Long hiddenTroubleId;
/** 权属单位 */
private Long beyondEnterpriseId;
/** 巡检任务id */
@Excel(name = "巡检任务id")
private Long workId;
/** 隐患名称 */
......@@ -30,11 +32,11 @@ public class THiddenTroubleInfo extends BaseEntity
private String hiddenTroubleName;
/** 隐患等级: 1.I级 2.II级 3.III级 */
@Excel(name = "隐患等级: 1.I级 2.II级 3.III级")
@Excel(name = "隐患等级")
private String hiddenTroubleLevel;
/** 隐患类型: 1.漏气 2.腐蚀 3.裂缝 4.设备故障 5.安全距离不足 6.管道承重 7.其他 */
@Excel(name = "隐患类型: 1.漏气 2.腐蚀 3.裂缝 4.设备故障 5.安全距离不足 6.管道承重 7.其他")
@Excel(name = "隐患类型")
private String hiddenTroubleType;
/** 经度 */
......@@ -46,7 +48,6 @@ public class THiddenTroubleInfo extends BaseEntity
private BigDecimal latitude;
/** 图片地址 */
@Excel(name = "图片地址")
private String pictureUrl;
/** 隐患描述 */
......@@ -54,16 +55,16 @@ public class THiddenTroubleInfo extends BaseEntity
private String hiddenTroubleDescribe;
/** 上报时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date reportTime;
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上报时间", width = 30, dateFormat = "yyyy-MM-dd")
private String reportTime;
/** 上报人 */
@Excel(name = "上报人")
private String reportPerson;
/** 隐患处理状态: 1.待处理 2.处理中 3.已完成 */
@Excel(name = "隐患处理状态: 1.待处理 2.处理中 3.已完成")
@Excel(name = "隐患处理状态")
private String hiddenTroubleDealStatus;
/** 隐患处理情况 */
......@@ -73,10 +74,9 @@ public class THiddenTroubleInfo extends BaseEntity
/** 隐患处理完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "隐患处理完成时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date hiddenTroubleDealFinishTime;
private String hiddenTroubleDealFinishTime;
/** 是否删除(0正常,1删除) */
@Excel(name = "是否删除(0正常,1删除)")
private String isDel;
/** 备注 */
......@@ -86,6 +86,18 @@ public class THiddenTroubleInfo extends BaseEntity
/**上报人名称*/
private String reportPersonName;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Long getBeyondEnterpriseId() {
return beyondEnterpriseId;
}
public void setBeyondEnterpriseId(Long beyondEnterpriseId) {
this.beyondEnterpriseId = beyondEnterpriseId;
}
public String getReportPersonName() {
return reportPersonName;
}
......@@ -175,15 +187,19 @@ public class THiddenTroubleInfo extends BaseEntity
{
return hiddenTroubleDescribe;
}
public void setReportTime(Date reportTime)
{
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public Date getReportTime()
{
return reportTime;
public void setHiddenTroubleDealFinishTime(String hiddenTroubleDealFinishTime) {
this.hiddenTroubleDealFinishTime = hiddenTroubleDealFinishTime;
}
public void setReportPerson(String reportPerson)
{
this.reportPerson = reportPerson;
......@@ -211,15 +227,11 @@ public class THiddenTroubleInfo extends BaseEntity
{
return hiddenTroubleDealCondition;
}
public void setHiddenTroubleDealFinishTime(Date hiddenTroubleDealFinishTime)
{
this.hiddenTroubleDealFinishTime = hiddenTroubleDealFinishTime;
}
public Date getHiddenTroubleDealFinishTime()
{
public String getHiddenTroubleDealFinishTime() {
return hiddenTroubleDealFinishTime;
}
public void setIsDel(String isDel)
{
this.isDel = isDel;
......@@ -241,23 +253,25 @@ public class THiddenTroubleInfo extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("hiddenTroubleId", getHiddenTroubleId())
.append("workId", getWorkId())
.append("hiddenTroubleName", getHiddenTroubleName())
.append("hiddenTroubleLevel", getHiddenTroubleLevel())
.append("hiddenTroubleType", getHiddenTroubleType())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("pictureUrl", getPictureUrl())
.append("hiddenTroubleDescribe", getHiddenTroubleDescribe())
.append("reportTime", getReportTime())
.append("reportPerson", getReportPerson())
.append("hiddenTroubleDealStatus", getHiddenTroubleDealStatus())
.append("hiddenTroubleDealCondition", getHiddenTroubleDealCondition())
.append("hiddenTroubleDealFinishTime", getHiddenTroubleDealFinishTime())
.append("isDel", getIsDel())
.append("remarks", getRemarks())
.toString();
return "THiddenTroubleInfo{" +
"hiddenTroubleId=" + hiddenTroubleId +
", beyondEnterpriseId=" + beyondEnterpriseId +
", workId=" + workId +
", hiddenTroubleName='" + hiddenTroubleName + '\'' +
", hiddenTroubleLevel='" + hiddenTroubleLevel + '\'' +
", hiddenTroubleType='" + hiddenTroubleType + '\'' +
", longitude=" + longitude +
", latitude=" + latitude +
", pictureUrl='" + pictureUrl + '\'' +
", hiddenTroubleDescribe='" + hiddenTroubleDescribe + '\'' +
", reportTime=" + reportTime +
", reportPerson='" + reportPerson + '\'' +
", hiddenTroubleDealStatus='" + hiddenTroubleDealStatus + '\'' +
", hiddenTroubleDealCondition='" + hiddenTroubleDealCondition + '\'' +
", hiddenTroubleDealFinishTime=" + hiddenTroubleDealFinishTime +
", isDel='" + isDel + '\'' +
", remarks='" + remarks + '\'' +
", reportPersonName='" + reportPersonName + '\'' +
'}';
}
}
......@@ -58,4 +58,11 @@ public interface THiddenTroubleInfoMapper
* @return 结果
*/
public int deleteTHiddenTroubleInfoByIds(Long[] hiddenTroubleIds);
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo);
}
......@@ -58,4 +58,11 @@ public interface ITHiddenTroubleInfoService
* @return 结果
*/
public int deleteTHiddenTroubleInfoById(Long hiddenTroubleId);
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo);
}
......@@ -92,4 +92,14 @@ public class THiddenTroubleInfoServiceImpl implements ITHiddenTroubleInfoService
{
return tHiddenTroubleInfoMapper.deleteTHiddenTroubleInfoById(hiddenTroubleId);
}
/**
* Excel数据导出查询接口
* @param tHiddenTroubleInfo
* @return
*/
@Override
public List<THiddenTroubleInfo> selectTHiddenTroubleInfoExcelList(THiddenTroubleInfo tHiddenTroubleInfo) {
return tHiddenTroubleInfoMapper.selectTHiddenTroubleInfoExcelList(tHiddenTroubleInfo);
}
}
......@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="THiddenTroubleInfo" id="THiddenTroubleInfoResult">
<result property="hiddenTroubleId" column="hidden_trouble_id" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="workId" column="work_id" />
<result property="hiddenTroubleName" column="hidden_trouble_name" />
<result property="hiddenTroubleLevel" column="hidden_trouble_level" />
......@@ -31,22 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTHiddenTroubleInfoList" parameterType="THiddenTroubleInfo" resultMap="THiddenTroubleInfoResult">
<include refid="selectTHiddenTroubleInfoVo"/>
<where>
<if test="workId != null "> and work_id = #{workId}</if>
is_del='0'
<if test="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="hiddenTroubleName != null and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
<if test="hiddenTroubleLevel != null and hiddenTroubleLevel != ''"> and hidden_trouble_level = #{hiddenTroubleLevel}</if>
<if test="hiddenTroubleType != null and hiddenTroubleType != ''"> and hidden_trouble_type = #{hiddenTroubleType}</if>
<if test="longitude != null "> and longitude = #{longitude}</if>
<if test="latitude != null "> and latitude = #{latitude}</if>
<if test="pictureUrl != null and pictureUrl != ''"> and picture_url = #{pictureUrl}</if>
<if test="hiddenTroubleDescribe != null and hiddenTroubleDescribe != ''"> and hidden_trouble_describe = #{hiddenTroubleDescribe}</if>
<if test="reportTime != null "> and report_time = #{reportTime}</if>
<if test="reportPerson != null and reportPerson != ''"> and report_person = #{reportPerson}</if>
<if test="hiddenTroubleDealStatus != null and hiddenTroubleDealStatus != ''"> and hidden_trouble_deal_status = #{hiddenTroubleDealStatus}</if>
<if test="hiddenTroubleDealCondition != null and hiddenTroubleDealCondition != ''"> and hidden_trouble_deal_condition = #{hiddenTroubleDealCondition}</if>
<if test="hiddenTroubleDealFinishTime != null "> and hidden_trouble_deal_finish_time = #{hiddenTroubleDealFinishTime}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
</where>
group by hidden_trouble_id desc
</select>
<select id="selectTHiddenTroubleInfoById" parameterType="Long" resultMap="THiddenTroubleInfoResult">
......@@ -54,10 +45,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where hidden_trouble_id = #{hiddenTroubleId}
</select>
<!--Excel数据导出查询接口-->
<select id="selectTHiddenTroubleInfoExcelList" resultMap="THiddenTroubleInfoResult" parameterType="THiddenTroubleInfo">
select hidden_trouble_id, work_id, hidden_trouble_name,
(CASE hidden_trouble_level WHEN '1' THEN 'I级' WHEN '2' THEN 'II级'WHEN '3' THEN 'III级'end) as hidden_trouble_level,
(CASE hidden_trouble_type WHEN '1' THEN '漏气' WHEN '2' THEN '腐蚀'WHEN '3' THEN '裂缝' WHEN '4' THEN '设备故障' WHEN '5' THEN '安全距离不足' WHEN '6' THEN '管道承重'WHEN '7' THEN '其他'end) as hidden_trouble_type,
longitude, latitude, picture_url, hidden_trouble_describe,
report_time, (select u.user_name from sys_user u where u.user_id = report_person) AS report_person_name, report_person,
(CASE hidden_trouble_deal_status WHEN '1' THEN '待处理' WHEN '2' THEN '处理中'WHEN '3' THEN '已完成'end) as hidden_trouble_deal_status,
hidden_trouble_deal_condition, hidden_trouble_deal_finish_time, is_del, remarks
from t_hidden_trouble_info
<where>
is_del='0'
<if test="beyondEnterpriseId != null and beyondEnterpriseId != -2"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="hiddenTroubleName != null and hiddenTroubleName != ''"> and hidden_trouble_name like concat('%', #{hiddenTroubleName}, '%')</if>
<if test="reportPerson != null and reportPerson != ''"> and report_person = #{reportPerson}</if>
</where>
group by hidden_trouble_id desc
</select>
<insert id="insertTHiddenTroubleInfo" parameterType="THiddenTroubleInfo" useGeneratedKeys="true" keyProperty="hiddenTroubleId">
insert into t_hidden_trouble_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workId != null">work_id,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="hiddenTroubleName != null">hidden_trouble_name,</if>
<if test="hiddenTroubleLevel != null">hidden_trouble_level,</if>
<if test="hiddenTroubleType != null">hidden_trouble_type,</if>
......@@ -70,11 +81,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hiddenTroubleDealStatus != null">hidden_trouble_deal_status,</if>
<if test="hiddenTroubleDealCondition != null">hidden_trouble_deal_condition,</if>
<if test="hiddenTroubleDealFinishTime != null">hidden_trouble_deal_finish_time,</if>
<if test="isDel != null">is_del,</if>
<if test="remarks != null">remarks,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workId != null">#{workId},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="hiddenTroubleName != null">#{hiddenTroubleName},</if>
<if test="hiddenTroubleLevel != null">#{hiddenTroubleLevel},</if>
<if test="hiddenTroubleType != null">#{hiddenTroubleType},</if>
......@@ -87,7 +98,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hiddenTroubleDealStatus != null">#{hiddenTroubleDealStatus},</if>
<if test="hiddenTroubleDealCondition != null">#{hiddenTroubleDealCondition},</if>
<if test="hiddenTroubleDealFinishTime != null">#{hiddenTroubleDealFinishTime},</if>
<if test="isDel != null">#{isDel},</if>
<if test="remarks != null">#{remarks},</if>
</trim>
</insert>
......@@ -114,14 +124,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where hidden_trouble_id = #{hiddenTroubleId}
</update>
<delete id="deleteTHiddenTroubleInfoById" parameterType="Long">
delete from t_hidden_trouble_info where hidden_trouble_id = #{hiddenTroubleId}
</delete>
<update id="deleteTHiddenTroubleInfoById" parameterType="Long">
update t_hidden_trouble_info set is_del='1' where hidden_trouble_id = #{hiddenTroubleId}
</update>
<delete id="deleteTHiddenTroubleInfoByIds" parameterType="String">
delete from t_hidden_trouble_info where hidden_trouble_id in
<update id="deleteTHiddenTroubleInfoByIds" parameterType="String">
update t_hidden_trouble_info set is_del='1' where hidden_trouble_id in
<foreach item="hiddenTroubleId" collection="array" open="(" separator="," close=")">
#{hiddenTroubleId}
</foreach>
</delete>
</update>
</mapper>
import request from '@/utils/request'
// 查询燃气隐患列表
export function listInfo(query) {
return request({
url: '/system/info/list',
method: 'get',
params: query
})
}
// 查询燃气隐患详细
export function getInfo(hiddenTroubleId) {
return request({
url: '/system/info/' + hiddenTroubleId,
method: 'get'
})
}
// 新增燃气隐患
export function addInfo(data) {
return request({
url: '/system/info',
method: 'post',
data: data
})
}
// 修改燃气隐患
export function updateInfo(data) {
return request({
url: '/system/info',
method: 'put',
data: data
})
}
// 删除燃气隐患
export function delInfo(hiddenTroubleId) {
return request({
url: '/system/info/' + hiddenTroubleId,
method: 'delete'
})
}
// 导出燃气隐患
export function exportInfo(query) {
return request({
url: '/system/info/export',
method: 'get',
params: query
})
}
\ No newline at end of file
This diff is collapsed.
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