Commit 55d9fa8d authored by lizhichao's avatar lizhichao
parents 9c424292 f8e249a4
......@@ -14,6 +14,7 @@ import com.zehong.system.mapper.TEnterpriseInfoMapper;
import com.zehong.system.service.*;
import com.zehong.web.controller.tool.DESEncoder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
......@@ -98,6 +99,11 @@ public class lpgGasController {
@Resource
private TEnterpriseInfoMapper tEnterpriseInfoMapper;
@Autowired
private ITInspectionAccidentService tInspectionAccidentService;
@Autowired
private ITLinePatrolService tLinePatrolService;
/**
* 创建 气瓶档案接口
......@@ -2879,6 +2885,276 @@ public class lpgGasController {
return AjaxResult.success(sb.toString());
}
/**
* 创建 巡检事故接口
* @return r
*/
@PostMapping("/inspectionAccident")
public AjaxResult inspectionAccident(@RequestBody Encryption encryption) {
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
if (selectkey == null) {
return AjaxResult.error("企业编码不存在!!!");
}
DESEncoder desEncoder = new DESEncoder();
String data = encryption.getData();
String decrypt = desEncoder.decrypt(data, selectkey.getSecretKey());
TEnterpriseInfo tEnterpriseInfo = tEnterpriseInfoMapper.selectTEnterpriseInfoById(selectkey.getEnterpriseId());
if (tEnterpriseInfo == null) {
return AjaxResult.error("监管平台配置企业信息不存在!!!");
}
int successNum = 0;
int errorNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
JSONArray jsonArray = JSON.parseArray(decrypt);
String js = JSONObject.toJSONString(jsonArray, SerializerFeature.WriteClassName);
List<JSONObject> list = JSONObject.parseArray(js, JSONObject.class);
if (list.size() > 500) {
return AjaxResult.error("每次最多处理500条数据");
}
List<TInspectionAccident> userTInspectionAccidents = new ArrayList<>();
//List<TUserManageVillage> userManageVillages = new ArrayList<>();
List<TInspectionAccident> noRepeatList = new ArrayList<>();
TInspectionAccident userTInspectionAccident;
String dateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
// 接口保存记录
List<TLpgThirdPartyDockingInterfaceRecord> lpgThirdPartyDockingInterfaceRecords = new ArrayList<>();
TLpgThirdPartyDockingInterfaceRecord lpgThirdPartyDockingInterfaceRecord;
for (JSONObject object : list) {
userTInspectionAccident = new TInspectionAccident();
//事故名称
String accidentName = object.getString("accidentName");
if (StringUtils.isBlank(accidentName)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionAccident", object.toJSONString(),
"事故名称不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
// 经度
String longitude = object.getString("longitude") == null ? "" : object.getString("longitude");
BigDecimal bigDecimalLongitude = BigDecimal.ZERO;
if (longitude.length() > 0) {
try {
bigDecimalLongitude = new BigDecimal(longitude);
} catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionAccident", object.toJSONString(),
"经度不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
// 纬度
String latitude = object.getString("latitude") == null ? "" : object.getString("latitude");
BigDecimal bigDecimalLatitude = BigDecimal.ZERO;
if (latitude.length() > 0) {
try {
bigDecimalLatitude = new BigDecimal(latitude);
} catch (NumberFormatException e) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionAccident", object.toJSONString(),
"纬度不符合要求!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
}
userTInspectionAccident.setAccidentName(accidentName);
userTInspectionAccident.setHappenDate(object.getString("happenDate") == null ? "" : object.getString("happenDate"));
userTInspectionAccident.setAccidentLocation(object.getString("accidentLocation") == null ? "" : object.getString("accidentLocation"));
if (!BigDecimal.ZERO.equals(bigDecimalLongitude)) {
userTInspectionAccident.setLongitude(bigDecimalLongitude);
}
if (!BigDecimal.ZERO.equals(bigDecimalLatitude)) {
userTInspectionAccident.setLatitude(bigDecimalLatitude);
}
userTInspectionAccident.setAccidentDescription(object.getString("accidentDescription") == null ? "" : object.getString("accidentDescription"));
userTInspectionAccident.setAccidentReason(object.getString("accidentReason") == null ? "" : object.getString("accidentReason"));
userTInspectionAccident.setObligationPerson(object.getString("obligationPerson") == null ? "" : object.getString("obligationPerson"));
userTInspectionAccident.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
userTInspectionAccident.setBeyondEnterpriseName(tEnterpriseInfo.getEnterpriseName());
userTInspectionAccident.setCreateTime(new Date());
userTInspectionAccident.setRemark(object.getString("remark") == null ? "" : object.getString("remark"));
userTInspectionAccidents.add(userTInspectionAccident);
}
if (userTInspectionAccidents.size() > 0) {
successNum = userTInspectionAccidents.size();
for (TInspectionAccident tInspectionAccident : userTInspectionAccidents) {
lpgThirdPartyDockingInterfaceRecord = successRecord("inspectionAccident", tInspectionAccident.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
tInspectionAccidentService.insertBatch(userTInspectionAccidents);
}
// 5接口记录直接插入
if (lpgThirdPartyDockingInterfaceRecords.size() > 0) {
lpgThirdPartyDockingInterfaceRecordService.insertBatch(lpgThirdPartyDockingInterfaceRecords);
}
}
StringBuilder sb = new StringBuilder();
if (errorNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条。");
return AjaxResult.success(sb.toString());
}
sb.append("成功:").append(successNum).append("条");
return AjaxResult.success(sb.toString());
}
/**
* 创建 巡检轨迹接口
* @return r
*/
@PostMapping("/inspectionRoute")
public AjaxResult inspectionRoute(@RequestBody Encryption encryption) {
keyInformation selectkey = decryptService.selectkey(encryption.getQybm());
if (selectkey == null) {
return AjaxResult.error("企业编码不存在!!!");
}
DESEncoder desEncoder = new DESEncoder();
String data = encryption.getData();
String decrypt = desEncoder.decrypt(data, selectkey.getSecretKey());
TEnterpriseInfo tEnterpriseInfo = tEnterpriseInfoMapper.selectTEnterpriseInfoById(selectkey.getEnterpriseId());
if (tEnterpriseInfo == null) {
return AjaxResult.error("监管平台配置企业信息不存在!!!");
}
int successNum = 0;
int errorNum = 0;
if (StringUtils.isNotBlank(decrypt)) {
JSONArray jsonArray = JSON.parseArray(decrypt);
String js = JSONObject.toJSONString(jsonArray, SerializerFeature.WriteClassName);
List<JSONObject> list = JSONObject.parseArray(js, JSONObject.class);
if (list.size() > 500) {
return AjaxResult.error("每次最多处理500条数据");
}
List<TLinePatrol> userTLinePatrols = new ArrayList<>();
List<TLinePatrol> noRepeatList = new ArrayList<>();
TLinePatrol userTLinePatrol;
String dateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
// 接口保存记录
List<TLpgThirdPartyDockingInterfaceRecord> lpgThirdPartyDockingInterfaceRecords = new ArrayList<>();
TLpgThirdPartyDockingInterfaceRecord lpgThirdPartyDockingInterfaceRecord;
for (JSONObject object : list) {
userTLinePatrol = new TLinePatrol();
//任务名称
String taskName = object.getString("taskName");
if (StringUtils.isBlank(taskName)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionRoute", object.toJSONString(),
"任务名称不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
//任务名称
String linePatrolPerson = object.getString("linePatrolPerson");
if (StringUtils.isBlank(linePatrolPerson)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionRoute", object.toJSONString(),
"巡检人员不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
//任务名称
String linePatrolTime = object.getString("linePatrolTime");
if (StringUtils.isBlank(linePatrolTime)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionRoute", object.toJSONString(),
"巡检时间不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
//任务名称
String coordinates = object.getString("coordinates");
if (StringUtils.isBlank(coordinates)) {
lpgThirdPartyDockingInterfaceRecord = errorRecord("inspectionRoute", object.toJSONString(),
"坐标不许为空!!!", encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
errorNum++;
continue;
}
userTLinePatrol.setTaskName(taskName);
userTLinePatrol.setLinePatrolPerson(linePatrolPerson);
userTLinePatrol.setLinePatrolTime(linePatrolTime);
userTLinePatrol.setCoordinates(coordinates);
userTLinePatrol.setBeyondEnterpriseId(tEnterpriseInfo.getEnterpriseId());
userTLinePatrol.setBeyondEnterpriseName(tEnterpriseInfo.getEnterpriseName());
userTLinePatrol.setCreateTime(new Date());
userTLinePatrol.setRemark(object.getString("remark") == null ? "" : object.getString("remark"));
userTLinePatrols.add(userTLinePatrol);
}
if (userTLinePatrols.size() > 0) {
successNum = userTLinePatrols.size();
for (TLinePatrol tLinePatrol : userTLinePatrols) {
lpgThirdPartyDockingInterfaceRecord = successRecord("inspectionRoute", tLinePatrol.toString(), encryption.getQybm());
lpgThirdPartyDockingInterfaceRecords.add(lpgThirdPartyDockingInterfaceRecord);
}
tLinePatrolService.insertBatch(userTLinePatrols);
}
// 5接口记录直接插入
if (lpgThirdPartyDockingInterfaceRecords.size() > 0) {
lpgThirdPartyDockingInterfaceRecordService.insertBatch(lpgThirdPartyDockingInterfaceRecords);
}
}
StringBuilder sb = new StringBuilder();
if (errorNum > 0) {
sb.append("成功:").append(successNum).append("条;失败:").append(errorNum).append("条。");
return AjaxResult.success(sb.toString());
}
sb.append("成功:").append(successNum).append("条");
return AjaxResult.success(sb.toString());
}
/**
* 封装一个 失败的接口对象
......
package com.zehong.web.controller.task;
import java.util.List;
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.TInspectionAccident;
import com.zehong.system.service.ITInspectionAccidentService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 巡检事故Controller
*
* @author zehong
* @date 2026-02-02
*/
@RestController
@RequestMapping("/system/accident")
public class TInspectionAccidentController extends BaseController
{
@Autowired
private ITInspectionAccidentService tInspectionAccidentService;
/**
* 查询巡检事故列表
*/
@GetMapping("/list")
public TableDataInfo list(TInspectionAccident tInspectionAccident)
{
startPage();
List<TInspectionAccident> list = tInspectionAccidentService.selectTInspectionAccidentList(tInspectionAccident);
return getDataTable(list);
}
/**
* 导出巡检事故列表
*/
@Log(title = "巡检事故", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TInspectionAccident tInspectionAccident)
{
List<TInspectionAccident> list = tInspectionAccidentService.selectTInspectionAccidentList(tInspectionAccident);
ExcelUtil<TInspectionAccident> util = new ExcelUtil<TInspectionAccident>(TInspectionAccident.class);
return util.exportExcel(list, "巡检事故数据");
}
/**
* 获取巡检事故详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tInspectionAccidentService.selectTInspectionAccidentById(id));
}
/**
* 新增巡检事故
*/
@Log(title = "巡检事故", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TInspectionAccident tInspectionAccident)
{
return toAjax(tInspectionAccidentService.insertTInspectionAccident(tInspectionAccident));
}
/**
* 修改巡检事故
*/
@Log(title = "巡检事故", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TInspectionAccident tInspectionAccident)
{
return toAjax(tInspectionAccidentService.updateTInspectionAccident(tInspectionAccident));
}
/**
* 删除巡检事故
*/
@Log(title = "巡检事故", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tInspectionAccidentService.deleteTInspectionAccidentByIds(ids));
}
}
\ No newline at end of file
package com.zehong.web.controller.task;
import java.util.List;
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.TLinePatrol;
import com.zehong.system.service.ITLinePatrolService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
/**
* 巡线Controller
*
* @author zehong
* @date 2026-02-02
*/
@RestController
@RequestMapping("/line/patrol")
public class TLinePatrolController extends BaseController
{
@Autowired
private ITLinePatrolService tLinePatrolService;
/**
* 查询巡线列表
*/
@GetMapping("/list")
public TableDataInfo list(TLinePatrol tLinePatrol)
{
startPage();
List<TLinePatrol> list = tLinePatrolService.selectTLinePatrolList(tLinePatrol);
return getDataTable(list);
}
/**
* 导出巡线列表
*/
@Log(title = "巡线", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TLinePatrol tLinePatrol)
{
List<TLinePatrol> list = tLinePatrolService.selectTLinePatrolList(tLinePatrol);
ExcelUtil<TLinePatrol> util = new ExcelUtil<TLinePatrol>(TLinePatrol.class);
return util.exportExcel(list, "巡线数据");
}
/**
* 获取巡线详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(tLinePatrolService.selectTLinePatrolById(id));
}
/**
* 新增巡线
*/
@Log(title = "巡线", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TLinePatrol tLinePatrol)
{
return toAjax(tLinePatrolService.insertTLinePatrol(tLinePatrol));
}
/**
* 修改巡线
*/
@Log(title = "巡线", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TLinePatrol tLinePatrol)
{
return toAjax(tLinePatrolService.updateTLinePatrol(tLinePatrol));
}
/**
* 删除巡线
*/
@Log(title = "巡线", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(tLinePatrolService.deleteTLinePatrolByIds(ids));
}
}
\ No newline at end of file
package com.zehong.system.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 巡检事故对象 t_inspection_accident
*
* @author zehong
* @date 2026-02-02
*/
public class TInspectionAccident extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 事故名称 */
@Excel(name = "事故名称")
private String accidentName;
/** 事故发生时间 */
@Excel(name = "事故发生时间")
private String happenDate;
/** 事故地点 */
@Excel(name = "事故地点")
private String accidentLocation;
/** 经度 */
private BigDecimal longitude;
/** 纬度 */
private BigDecimal latitude;
/** 事故描述 */
@Excel(name = "事故描述")
private String accidentDescription;
/** 事故原因 */
@Excel(name = "事故原因")
private String accidentReason;
/** 责任人 */
@Excel(name = "责任人")
private String obligationPerson;
/** 权属单位 */
@Excel(name = "权属单位")
private String beyondEnterpriseId;
/** 权属单位名称 */
@Excel(name = "权属单位名称")
private String beyondEnterpriseName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setAccidentName(String accidentName)
{
this.accidentName = accidentName;
}
public String getAccidentName()
{
return accidentName;
}
public void setHappenDate(String happenDate)
{
this.happenDate = happenDate;
}
public String getHappenDate()
{
return happenDate;
}
public void setAccidentLocation(String accidentLocation)
{
this.accidentLocation = accidentLocation;
}
public String getAccidentLocation()
{
return accidentLocation;
}
public void setLongitude(BigDecimal longitude)
{
this.longitude = longitude;
}
public BigDecimal getLongitude()
{
return longitude;
}
public void setLatitude(BigDecimal latitude)
{
this.latitude = latitude;
}
public BigDecimal getLatitude()
{
return latitude;
}
public void setAccidentDescription(String accidentDescription)
{
this.accidentDescription = accidentDescription;
}
public String getAccidentDescription()
{
return accidentDescription;
}
public void setAccidentReason(String accidentReason)
{
this.accidentReason = accidentReason;
}
public String getAccidentReason()
{
return accidentReason;
}
public void setObligationPerson(String obligationPerson)
{
this.obligationPerson = obligationPerson;
}
public String getObligationPerson()
{
return obligationPerson;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId)
{
this.beyondEnterpriseId = beyondEnterpriseId;
}
public String getBeyondEnterpriseId()
{
return beyondEnterpriseId;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName)
{
this.beyondEnterpriseName = beyondEnterpriseName;
}
public String getBeyondEnterpriseName()
{
return beyondEnterpriseName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("accidentName", getAccidentName())
.append("happenDate", getHappenDate())
.append("accidentLocation", getAccidentLocation())
.append("longitude", getLongitude())
.append("latitude", getLatitude())
.append("accidentDescription", getAccidentDescription())
.append("accidentReason", getAccidentReason())
.append("obligationPerson", getObligationPerson())
.append("beyondEnterpriseId", getBeyondEnterpriseId())
.append("beyondEnterpriseName", getBeyondEnterpriseName())
.append("createTime", getCreateTime())
.append("remark", getRemark())
.toString();
}
}
package com.zehong.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 巡线对象 t_line_patrol
*
* @author zehong
* @date 2026-02-02
*/
public class TLinePatrol extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 任务名称 */
@Excel(name = "任务名称")
private String taskName;
/** 巡线人员 */
@Excel(name = "巡线人员")
private String linePatrolPerson;
/** 巡线时间 */
@Excel(name = "巡线时间")
private String linePatrolTime;
/** 坐标 */
private String coordinates;
/** 权属单位 */
@Excel(name = "权属单位")
private String beyondEnterpriseId;
/** 权属单位名称 */
@Excel(name = "权属单位名称")
private String beyondEnterpriseName;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTaskName(String taskName)
{
this.taskName = taskName;
}
public String getTaskName()
{
return taskName;
}
public void setLinePatrolPerson(String linePatrolPerson)
{
this.linePatrolPerson = linePatrolPerson;
}
public String getLinePatrolPerson()
{
return linePatrolPerson;
}
public void setLinePatrolTime(String linePatrolTime)
{
this.linePatrolTime = linePatrolTime;
}
public String getLinePatrolTime()
{
return linePatrolTime;
}
public void setCoordinates(String coordinates)
{
this.coordinates = coordinates;
}
public String getCoordinates()
{
return coordinates;
}
public String getBeyondEnterpriseId() {
return beyondEnterpriseId;
}
public void setBeyondEnterpriseId(String beyondEnterpriseId) {
this.beyondEnterpriseId = beyondEnterpriseId;
}
public String getBeyondEnterpriseName() {
return beyondEnterpriseName;
}
public void setBeyondEnterpriseName(String beyondEnterpriseName) {
this.beyondEnterpriseName = beyondEnterpriseName;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("taskName", getTaskName())
.append("linePatrolPerson", getLinePatrolPerson())
.append("linePatrolTime", getLinePatrolTime())
.append("coordinates", getCoordinates())
.append("createTime", getCreateTime())
.toString();
}
}
\ No newline at end of file
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TInspectionAccident;
/**
* 巡检事故Mapper接口
*
* @author zehong
* @date 2026-02-02
*/
public interface TInspectionAccidentMapper
{
/**
* 查询巡检事故
*
* @param id 巡检事故ID
* @return 巡检事故
*/
public TInspectionAccident selectTInspectionAccidentById(Long id);
/**
* 查询巡检事故列表
*
* @param tInspectionAccident 巡检事故
* @return 巡检事故集合
*/
public List<TInspectionAccident> selectTInspectionAccidentList(TInspectionAccident tInspectionAccident);
/**
* 新增巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
public int insertTInspectionAccident(TInspectionAccident tInspectionAccident);
/**
* 修改巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
public int updateTInspectionAccident(TInspectionAccident tInspectionAccident);
/**
* 删除巡检事故
*
* @param id 巡检事故ID
* @return 结果
*/
public int deleteTInspectionAccidentById(Long id);
/**
* 批量删除巡检事故
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTInspectionAccidentByIds(Long[] ids);
int insertBatch(List<TInspectionAccident> tInspectionAccident);
}
\ No newline at end of file
package com.zehong.system.mapper;
import java.util.List;
import com.zehong.system.domain.TLinePatrol;
/**
* 巡线Mapper接口
*
* @author zehong
* @date 2026-02-02
*/
public interface TLinePatrolMapper
{
/**
* 查询巡线
*
* @param id 巡线ID
* @return 巡线
*/
public TLinePatrol selectTLinePatrolById(Long id);
/**
* 查询巡线列表
*
* @param tLinePatrol 巡线
* @return 巡线集合
*/
public List<TLinePatrol> selectTLinePatrolList(TLinePatrol tLinePatrol);
/**
* 新增巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
public int insertTLinePatrol(TLinePatrol tLinePatrol);
/**
* 修改巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
public int updateTLinePatrol(TLinePatrol tLinePatrol);
/**
* 删除巡线
*
* @param id 巡线ID
* @return 结果
*/
public int deleteTLinePatrolById(Long id);
/**
* 批量删除巡线
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteTLinePatrolByIds(Long[] ids);
int insertBatch(List<TLinePatrol> tLinePatrol);
}
\ No newline at end of file
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TInspectionAccident;
/**
* 巡检事故Service接口
*
* @author zehong
* @date 2026-02-02
*/
public interface ITInspectionAccidentService
{
/**
* 查询巡检事故
*
* @param id 巡检事故ID
* @return 巡检事故
*/
public TInspectionAccident selectTInspectionAccidentById(Long id);
/**
* 查询巡检事故列表
*
* @param tInspectionAccident 巡检事故
* @return 巡检事故集合
*/
public List<TInspectionAccident> selectTInspectionAccidentList(TInspectionAccident tInspectionAccident);
/**
* 新增巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
public int insertTInspectionAccident(TInspectionAccident tInspectionAccident);
/**
* 修改巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
public int updateTInspectionAccident(TInspectionAccident tInspectionAccident);
/**
* 批量删除巡检事故
*
* @param ids 需要删除的巡检事故ID
* @return 结果
*/
public int deleteTInspectionAccidentByIds(Long[] ids);
/**
* 删除巡检事故信息
*
* @param id 巡检事故ID
* @return 结果
*/
public int deleteTInspectionAccidentById(Long id);
int insertBatch(List<TInspectionAccident> tInspectionAccident);
}
\ No newline at end of file
package com.zehong.system.service;
import java.util.List;
import com.zehong.system.domain.TLinePatrol;
/**
* 巡线Service接口
*
* @author zehong
* @date 2026-02-02
*/
public interface ITLinePatrolService
{
/**
* 查询巡线
*
* @param id 巡线ID
* @return 巡线
*/
public TLinePatrol selectTLinePatrolById(Long id);
/**
* 查询巡线列表
*
* @param tLinePatrol 巡线
* @return 巡线集合
*/
public List<TLinePatrol> selectTLinePatrolList(TLinePatrol tLinePatrol);
/**
* 新增巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
public int insertTLinePatrol(TLinePatrol tLinePatrol);
/**
* 修改巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
public int updateTLinePatrol(TLinePatrol tLinePatrol);
/**
* 批量删除巡线
*
* @param ids 需要删除的巡线ID
* @return 结果
*/
public int deleteTLinePatrolByIds(Long[] ids);
/**
* 删除巡线信息
*
* @param id 巡线ID
* @return 结果
*/
public int deleteTLinePatrolById(Long id);
int insertBatch(List<TLinePatrol> tLinePatrol);
}
\ No newline at end of file
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TInspectionAccidentMapper;
import com.zehong.system.domain.TInspectionAccident;
import com.zehong.system.service.ITInspectionAccidentService;
/**
* 巡检事故Service业务层处理
*
* @author zehong
* @date 2026-02-02
*/
@Service
public class TInspectionAccidentServiceImpl implements ITInspectionAccidentService
{
@Autowired
private TInspectionAccidentMapper tInspectionAccidentMapper;
/**
* 查询巡检事故
*
* @param id 巡检事故ID
* @return 巡检事故
*/
@Override
public TInspectionAccident selectTInspectionAccidentById(Long id)
{
return tInspectionAccidentMapper.selectTInspectionAccidentById(id);
}
/**
* 查询巡检事故列表
*
* @param tInspectionAccident 巡检事故
* @return 巡检事故
*/
@Override
public List<TInspectionAccident> selectTInspectionAccidentList(TInspectionAccident tInspectionAccident)
{
return tInspectionAccidentMapper.selectTInspectionAccidentList(tInspectionAccident);
}
/**
* 新增巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
@Override
public int insertTInspectionAccident(TInspectionAccident tInspectionAccident)
{
tInspectionAccident.setCreateTime(DateUtils.getNowDate());
return tInspectionAccidentMapper.insertTInspectionAccident(tInspectionAccident);
}
/**
* 修改巡检事故
*
* @param tInspectionAccident 巡检事故
* @return 结果
*/
@Override
public int updateTInspectionAccident(TInspectionAccident tInspectionAccident)
{
return tInspectionAccidentMapper.updateTInspectionAccident(tInspectionAccident);
}
/**
* 批量删除巡检事故
*
* @param ids 需要删除的巡检事故ID
* @return 结果
*/
@Override
public int deleteTInspectionAccidentByIds(Long[] ids)
{
return tInspectionAccidentMapper.deleteTInspectionAccidentByIds(ids);
}
/**
* 删除巡检事故信息
*
* @param id 巡检事故ID
* @return 结果
*/
@Override
public int deleteTInspectionAccidentById(Long id)
{
return tInspectionAccidentMapper.deleteTInspectionAccidentById(id);
}
@Override
public int insertBatch(List<TInspectionAccident> tInspectionAccident) {
return tInspectionAccidentMapper.insertBatch(tInspectionAccident);
}
}
\ No newline at end of file
package com.zehong.system.service.impl;
import java.util.List;
import com.zehong.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.TLinePatrolMapper;
import com.zehong.system.domain.TLinePatrol;
import com.zehong.system.service.ITLinePatrolService;
/**
* 巡线Service业务层处理
*
* @author zehong
* @date 2026-02-02
*/
@Service
public class TLinePatrolServiceImpl implements ITLinePatrolService
{
@Autowired
private TLinePatrolMapper tLinePatrolMapper;
/**
* 查询巡线
*
* @param id 巡线ID
* @return 巡线
*/
@Override
public TLinePatrol selectTLinePatrolById(Long id)
{
return tLinePatrolMapper.selectTLinePatrolById(id);
}
/**
* 查询巡线列表
*
* @param tLinePatrol 巡线
* @return 巡线
*/
@Override
public List<TLinePatrol> selectTLinePatrolList(TLinePatrol tLinePatrol)
{
return tLinePatrolMapper.selectTLinePatrolList(tLinePatrol);
}
/**
* 新增巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
@Override
public int insertTLinePatrol(TLinePatrol tLinePatrol)
{
tLinePatrol.setCreateTime(DateUtils.getNowDate());
return tLinePatrolMapper.insertTLinePatrol(tLinePatrol);
}
/**
* 修改巡线
*
* @param tLinePatrol 巡线
* @return 结果
*/
@Override
public int updateTLinePatrol(TLinePatrol tLinePatrol)
{
return tLinePatrolMapper.updateTLinePatrol(tLinePatrol);
}
/**
* 批量删除巡线
*
* @param ids 需要删除的巡线ID
* @return 结果
*/
@Override
public int deleteTLinePatrolByIds(Long[] ids)
{
return tLinePatrolMapper.deleteTLinePatrolByIds(ids);
}
/**
* 删除巡线信息
*
* @param id 巡线ID
* @return 结果
*/
@Override
public int deleteTLinePatrolById(Long id)
{
return tLinePatrolMapper.deleteTLinePatrolById(id);
}
@Override
public int insertBatch(List<TLinePatrol> tLinePatrol) {
return tLinePatrolMapper.insertBatch(tLinePatrol);
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TInspectionAccidentMapper">
<resultMap type="com.zehong.system.domain.TInspectionAccident" id="TInspectionAccidentResult">
<result property="id" column="id" />
<result property="accidentName" column="accident_name" />
<result property="happenDate" column="happen_date" />
<result property="accidentLocation" column="accident_location" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="accidentDescription" column="accident_description" />
<result property="accidentReason" column="accident_reason" />
<result property="obligationPerson" column="obligation_person" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="createTime" column="create_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTInspectionAccidentVo">
select id, accident_name, happen_date, accident_location, longitude, latitude, accident_description, accident_reason, obligation_person, beyond_enterprise_id, beyond_enterprise_name, create_time, remark from t_inspection_accident
</sql>
<select id="selectTInspectionAccidentList" parameterType="com.zehong.system.domain.TInspectionAccident" resultMap="TInspectionAccidentResult">
<include refid="selectTInspectionAccidentVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="accidentName != null and accidentName != ''"> and accident_name like concat('%', #{accidentName}, '%')</if>
<if test="happenDate != null and happenDate != ''"> and happen_date = #{happenDate}</if>
<if test="obligationPerson != null and obligationPerson != ''"> and obligation_person = #{obligationPerson}</if>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != ''"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="beyondEnterpriseName != null and beyondEnterpriseName != ''"> and beyond_enterprise_name like concat('%', #{beyondEnterpriseName}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
</where>
</select>
<select id="selectTInspectionAccidentById" parameterType="Long" resultMap="TInspectionAccidentResult">
<include refid="selectTInspectionAccidentVo"/>
where id = #{id}
</select>
<insert id="insertTInspectionAccident" parameterType="com.zehong.system.domain.TInspectionAccident" useGeneratedKeys="true" keyProperty="id">
insert into t_inspection_accident
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="accidentName != null">accident_name,</if>
<if test="happenDate != null">happen_date,</if>
<if test="accidentLocation != null">accident_location,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="accidentDescription != null">accident_description,</if>
<if test="accidentReason != null">accident_reason,</if>
<if test="obligationPerson != null">obligation_person,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accidentName != null">#{accidentName},</if>
<if test="happenDate != null">#{happenDate},</if>
<if test="accidentLocation != null">#{accidentLocation},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="accidentDescription != null">#{accidentDescription},</if>
<if test="accidentReason != null">#{accidentReason},</if>
<if test="obligationPerson != null">#{obligationPerson},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTInspectionAccident" parameterType="com.zehong.system.domain.TInspectionAccident">
update t_inspection_accident
<trim prefix="SET" suffixOverrides=",">
<if test="accidentName != null">accident_name = #{accidentName},</if>
<if test="happenDate != null">happen_date = #{happenDate},</if>
<if test="accidentLocation != null">accident_location = #{accidentLocation},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="accidentDescription != null">accident_description = #{accidentDescription},</if>
<if test="accidentReason != null">accident_reason = #{accidentReason},</if>
<if test="obligationPerson != null">obligation_person = #{obligationPerson},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTInspectionAccidentById" parameterType="Long">
delete from t_inspection_accident where id = #{id}
</delete>
<delete id="deleteTInspectionAccidentByIds" parameterType="String">
delete from t_inspection_accident where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertBatch" parameterType="list">
insert into t_inspection_accident (accident_name, happen_date, accident_location, longitude, latitude, accident_description,
accident_reason, obligation_person, beyond_enterprise_id, beyond_enterprise_name, create_time, remark)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.accidentName,jdbcType=VARCHAR}, #{item.happenDate}, #{item.accidentLocation},
#{item.longitude},#{item.latitude},#{item.accidentDescription}, #{item.accidentReason},
#{item.obligationPerson},#{item.beyondEnterpriseId},#{item.beyondEnterpriseName},#{item.createTime},#{item.remark}
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zehong.system.mapper.TLinePatrolMapper">
<resultMap type="com.zehong.system.domain.TLinePatrol" id="TLinePatrolResult">
<result property="id" column="id" />
<result property="taskName" column="task_name" />
<result property="linePatrolPerson" column="line_patrol_person" />
<result property="linePatrolTime" column="line_patrol_time" />
<result property="coordinates" column="coordinates" />
<result property="beyondEnterpriseId" column="beyond_enterprise_id" />
<result property="beyondEnterpriseName" column="beyond_enterprise_name" />
<result property="createTime" column="create_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTLinePatrolVo">
select id, task_name, line_patrol_person, line_patrol_time, coordinates, beyond_enterprise_id, beyond_enterprise_name, create_time, remark from t_line_patrol
</sql>
<select id="selectTLinePatrolList" parameterType="com.zehong.system.domain.TLinePatrol" resultMap="TLinePatrolResult">
<include refid="selectTLinePatrolVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
<if test="linePatrolPerson != null and linePatrolPerson != ''"> and line_patrol_person = #{linePatrolPerson}</if>
<if test="linePatrolTime != null and linePatrolTime != ''"> and line_patrol_time = #{linePatrolTime}</if>
<if test="beyondEnterpriseId != null and beyondEnterpriseId != ''"> and beyond_enterprise_id = #{beyondEnterpriseId}</if>
<if test="beyondEnterpriseName != null and beyondEnterpriseName != ''"> and beyond_enterprise_name like concat('%', #{beyondEnterpriseName}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
</where>
</select>
<select id="selectTLinePatrolById" parameterType="Long" resultMap="TLinePatrolResult">
<include refid="selectTLinePatrolVo"/>
where id = #{id}
</select>
<insert id="insertTLinePatrol" parameterType="com.zehong.system.domain.TLinePatrol" useGeneratedKeys="true" keyProperty="id">
insert into t_line_patrol
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskName != null">task_name,</if>
<if test="linePatrolPerson != null">line_patrol_person,</if>
<if test="linePatrolTime != null">line_patrol_time,</if>
<if test="coordinates != null">coordinates,</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id,</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name,</if>
<if test="createTime != null">create_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="taskName != null">#{taskName},</if>
<if test="linePatrolPerson != null">#{linePatrolPerson},</if>
<if test="linePatrolTime != null">#{linePatrolTime},</if>
<if test="coordinates != null">#{coordinates},</if>
<if test="beyondEnterpriseId != null">#{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">#{beyondEnterpriseName},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTLinePatrol" parameterType="com.zehong.system.domain.TLinePatrol">
update t_line_patrol
<trim prefix="SET" suffixOverrides=",">
<if test="taskName != null">task_name = #{taskName},</if>
<if test="linePatrolPerson != null">line_patrol_person = #{linePatrolPerson},</if>
<if test="linePatrolTime != null">line_patrol_time = #{linePatrolTime},</if>
<if test="coordinates != null">coordinates = #{coordinates},</if>
<if test="beyondEnterpriseId != null">beyond_enterprise_id = #{beyondEnterpriseId},</if>
<if test="beyondEnterpriseName != null">beyond_enterprise_name = #{beyondEnterpriseName},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTLinePatrolById" parameterType="Long">
delete from t_line_patrol where id = #{id}
</delete>
<delete id="deleteTLinePatrolByIds" parameterType="String">
delete from t_line_patrol where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertBatch" parameterType="list">
insert into t_line_patrol (task_name, line_patrol_person, line_patrol_time, coordinates, beyond_enterprise_id, beyond_enterprise_name, create_time, remark)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.taskName,jdbcType=VARCHAR}, #{item.linePatrolPerson}, #{item.linePatrolTime},
#{item.coordinates},#{item.beyondEnterpriseId},#{item.beyondEnterpriseName},#{item.createTime},#{item.remark}
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
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