安全带监测

This commit is contained in:
pengjie 2024-08-19 10:32:31 +08:00
parent e2fcf7a96c
commit d3216b40eb
23 changed files with 1047 additions and 1 deletions

View File

@ -11,6 +11,7 @@ import com.zhgd.xmgl.modules.basicdata.entity.Company;
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
import com.zhgd.xmgl.modules.cost.dto.CostBudgetDto;
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
import com.zhgd.xmgl.modules.cost.dto.CostDynamicDto;
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
import com.zhgd.xmgl.modules.cost.service.ICostSubjectService;
import com.zhgd.xmgl.modules.exam.entity.ExamQuestionBank;
@ -496,4 +497,16 @@ public class CostBudgetController {
public Result<List<CostBulletinDto>> costBulletin(@RequestBody Map<String, Object> map) {
return Result.success(costSubjectService.getCostBulletin(map));
}
/**
* 动态成本
* @return
*/
@OperLog(operModul = "成本科目预算管理", operType = "列表查询", operDesc = "动态成本信息")
@ApiOperation(value = " 动态成本信息", notes = "动态成本信息", httpMethod = "POST")
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", dataType = "String")
@PostMapping(value = "costDynamic")
public Result<List<CostDynamicDto>> costDynamic(@RequestBody Map<String, Object> map) {
return Result.success(costSubjectService.getCostDynamicDto(map));
}
}

View File

@ -78,7 +78,8 @@ public class IndexController {
// 查询项目数
int projectSize = projectService.count(Wrappers.<Project>lambdaQuery().eq(Project::getNature, 1));
// 查询合同总金额
BigDecimal contractAmount = costContractService.list().stream().map(c -> c.getHthszj()).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal contractAmount = costContractService.list(Wrappers.<CostContract>lambdaQuery()
.eq(CostContract::getXszt, "生效合同")).stream().map(c -> c.getHthszj()).reduce(BigDecimal.ZERO, BigDecimal::add);
// 总投资金额(支付金额)
BigDecimal payAmount = new BigDecimal(0);
// 总成本预算

View File

@ -0,0 +1,34 @@
package com.zhgd.xmgl.modules.cost.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "成本简报信息(DTO)", description = "CostBulletinDto")
public class CostDynamicDto {
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "项目SN")
private String projectNSn;
@ApiModelProperty(value = "竣工日期")
private String completeWorkDate;
@ApiModelProperty(value = "项目面积")
private String projectAcreage;
@ApiModelProperty(value = "可售面积")
private String saleAcreage;
@ApiModelProperty(value = "总价")
private String totalCost;
@ApiModelProperty(value = "建筑单方造价")
private String projectCostAvg;
@ApiModelProperty(value = "可售单方造价")
private String saleCostAvg;
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
import com.zhgd.xmgl.modules.cost.dto.CostDynamicDto;
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
import com.baomidou.mybatisplus.extension.service.IService;
@ -27,4 +28,6 @@ public interface ICostSubjectService extends IService<CostSubject> {
boolean delInfo(CostSubject costSubject);
List<CostBulletinDto> getCostBulletin(Map<String, Object> map);
List<CostDynamicDto> getCostDynamicDto(Map<String, Object> map);
}

View File

@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.xmgl.modules.cost.dto.CostBulletinDto;
import com.zhgd.xmgl.modules.cost.dto.CostDynamicDto;
import com.zhgd.xmgl.modules.cost.entity.CostContract;
import com.zhgd.xmgl.modules.cost.entity.CostSubject;
import com.zhgd.xmgl.modules.cost.mapper.CostSubjectMapper;
@ -119,6 +120,11 @@ public class CostSubjectServiceImpl extends ServiceImpl<CostSubjectMapper, CostS
return costBulletinDtoList;
}
@Override
public List<CostDynamicDto> getCostDynamicDto(Map<String, Object> map) {
return null;
}
private void getChildren(List<CostSubject> list, List<CostSubject> allList) {
for (CostSubject costSubject : list) {
List<CostSubject> childrenList = allList.stream().filter(a -> a.getParentId().toString().equals(costSubject.getId().toString())).collect(Collectors.toList());

View File

@ -0,0 +1,182 @@
package com.zhgd.xmgl.modules.safetybelt.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.util.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltAlarm;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltAlarmService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import springfox.documentation.annotations.ApiIgnore;
/**
* @Title: Controller
* @Description: 安全带监测预警
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/safetyBeltAlarm")
@Slf4j
@Api(tags = "安全带监测预警管理")
public class SafetyBeltAlarmController {
@Autowired
private ISafetyBeltAlarmService safetyBeltAlarmService;
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "分页查询", operDesc = "分页列表查询安全带监测预警信息")
@ApiOperation(value = " 分页列表查询安全带监测预警信息", notes = "分页列表查询安全带监测预警信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<SafetyBeltAlarm>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<SafetyBeltAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyBeltAlarm.class, map);
Page<SafetyBeltAlarm> page = PageUtil.getPage(map);
IPage<SafetyBeltAlarm> pageList = safetyBeltAlarmService.page(page, queryWrapper);
return Result.success(pageList);
}
/**
* 列表查询
*
* @param safetyBeltAlarm
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "列表查询", operDesc = "列表查询安全带监测预警信息")
@ApiOperation(value = " 列表查询安全带监测预警信息", notes = "列表查询安全带监测预警信息", httpMethod = "POST")
@PostMapping(value = "/list")
public Result<List<SafetyBeltAlarm>> queryList(@RequestBody SafetyBeltAlarm safetyBeltAlarm) {
QueryWrapper<SafetyBeltAlarm> queryWrapper = QueryGenerator.initQueryWrapper(safetyBeltAlarm);
List<SafetyBeltAlarm> list = safetyBeltAlarmService.list(queryWrapper);
return Result.success(list);
}
/**
* 添加
*
* @param safetyBeltAlarm
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "新增", operDesc = "添加安全带监测预警信息")
@ApiOperation(value = " 添加安全带监测预警信息", notes = "添加安全带监测预警信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<Object> add(@RequestBody SafetyBeltAlarm safetyBeltAlarm) {
safetyBeltAlarmService.save(safetyBeltAlarm);
return Result.success("添加成功!");
}
/**
* 编辑
*
* @param safetyBeltAlarm
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "修改", operDesc = "编辑安全带监测预警信息")
@ApiOperation(value = "编辑安全带监测预警信息", notes = "编辑安全带监测预警信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<SafetyBeltAlarm> edit(@RequestBody SafetyBeltAlarm safetyBeltAlarm) {
Result<SafetyBeltAlarm> result = new Result<SafetyBeltAlarm>();
SafetyBeltAlarm safetyBeltAlarmEntity = safetyBeltAlarmService.getById(safetyBeltAlarm.getId());
if (safetyBeltAlarmEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltAlarmService.updateById(safetyBeltAlarm);
if (ok) {
result.success("修改成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "删除", operDesc = "删除安全带监测预警信息")
@ApiOperation(value = "删除安全带监测预警信息", notes = "删除安全带监测预警信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测预警ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<SafetyBeltAlarm> delete(@RequestBody SafetyBeltAlarm safetyBeltAlarm) {
Result<SafetyBeltAlarm> result = new Result<SafetyBeltAlarm>();
SafetyBeltAlarm safetyBeltAlarmEntity = safetyBeltAlarmService.getById(safetyBeltAlarm.getId());
if (safetyBeltAlarmEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltAlarmService.removeById(safetyBeltAlarm.getId());
if (ok) {
result.success("删除成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 通过id查询
*
* @return
*/
@OperLog(operModul = "安全带监测预警管理", operType = "查询", operDesc = "通过id查询安全带监测预警信息")
@ApiOperation(value = "通过id查询安全带监测预警信息", notes = "通过id查询安全带监测预警信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测预警ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<SafetyBeltAlarm> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<SafetyBeltAlarm> result = new Result<SafetyBeltAlarm>();
SafetyBeltAlarm safetyBeltAlarm = safetyBeltAlarmService.getById(MapUtils.getString(map, "id"));
if (safetyBeltAlarm == null) {
result.error500("未找到对应实体");
} else {
result.setResult(safetyBeltAlarm);
result.setSuccess(true);
}
return result;
}
}

View File

@ -0,0 +1,275 @@
package com.zhgd.xmgl.modules.safetybelt.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.util.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltDevice;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltDeviceService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import springfox.documentation.annotations.ApiIgnore;
/**
* @Title: Controller
* @Description: 安全带监测设备
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/safetyBeltDevice")
@Slf4j
@Api(tags = "安全带监测设备管理")
public class SafetyBeltDeviceController {
@Autowired
private ISafetyBeltDeviceService safetyBeltDeviceService;
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "分页查询", operDesc = "分页列表查询安全带监测设备信息")
@ApiOperation(value = " 分页列表查询安全带监测设备信息", notes = "分页列表查询安全带监测设备信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<SafetyBeltDevice>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<SafetyBeltDevice> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyBeltDevice.class, map);
Page<SafetyBeltDevice> page = PageUtil.getPage(map);
IPage<SafetyBeltDevice> pageList = safetyBeltDeviceService.page(page, queryWrapper);
return Result.success(pageList);
}
/**
* 列表查询
*
* @param safetyBeltDevice
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "列表查询", operDesc = "列表查询安全带监测设备信息")
@ApiOperation(value = " 列表查询安全带监测设备信息", notes = "列表查询安全带监测设备信息", httpMethod = "POST")
@PostMapping(value = "/list")
public Result<List<SafetyBeltDevice>> queryList(@RequestBody SafetyBeltDevice safetyBeltDevice) {
QueryWrapper<SafetyBeltDevice> queryWrapper = QueryGenerator.initQueryWrapper(safetyBeltDevice);
List<SafetyBeltDevice> list = safetyBeltDeviceService.list(queryWrapper);
return Result.success(list);
}
/**
* 添加
*
* @param safetyBeltDevice
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "新增", operDesc = "添加安全带监测设备信息")
@ApiOperation(value = " 添加安全带监测设备信息", notes = "添加安全带监测设备信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<Object> add(@RequestBody SafetyBeltDevice safetyBeltDevice) {
safetyBeltDeviceService.save(safetyBeltDevice);
return Result.success("添加成功!");
}
/**
* 编辑
*
* @param safetyBeltDevice
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "修改", operDesc = "编辑安全带监测设备信息")
@ApiOperation(value = "编辑安全带监测设备信息", notes = "编辑安全带监测设备信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<SafetyBeltDevice> edit(@RequestBody SafetyBeltDevice safetyBeltDevice) {
Result<SafetyBeltDevice> result = new Result<SafetyBeltDevice>();
SafetyBeltDevice safetyBeltDeviceEntity = safetyBeltDeviceService.getById(safetyBeltDevice.getId());
if (safetyBeltDeviceEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltDeviceService.updateById(safetyBeltDevice);
if (ok) {
result.success("修改成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "删除", operDesc = "删除安全带监测设备信息")
@ApiOperation(value = "删除安全带监测设备信息", notes = "删除安全带监测设备信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测设备ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<SafetyBeltDevice> delete(@RequestBody SafetyBeltDevice safetyBeltDevice) {
Result<SafetyBeltDevice> result = new Result<SafetyBeltDevice>();
SafetyBeltDevice safetyBeltDeviceEntity = safetyBeltDeviceService.getById(safetyBeltDevice.getId());
if (safetyBeltDeviceEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltDeviceService.removeById(safetyBeltDevice.getId());
if (ok) {
result.success("删除成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 批量删除
*
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "批量删除", operDesc = "批量删除安全带监测设备信息")
@ApiOperation(value = "批量删除安全带监测设备信息", notes = "批量删除安全带监测设备信息", httpMethod = "POST")
@ApiImplicitParam(name = "ids", value = "安全带监测设备ID字符串", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/deleteBatch")
public Result<SafetyBeltDevice> deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<SafetyBeltDevice> result = new Result<SafetyBeltDevice>();
String ids = MapUtils.getString(map, "ids");
if (ids == null || "".equals(ids.trim())) {
result.error500("参数不识别!");
} else {
this.safetyBeltDeviceService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* 通过id查询
*
* @return
*/
@OperLog(operModul = "安全带监测设备管理", operType = "查询", operDesc = "通过id查询安全带监测设备信息")
@ApiOperation(value = "通过id查询安全带监测设备信息", notes = "通过id查询安全带监测设备信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测设备ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<SafetyBeltDevice> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<SafetyBeltDevice> result = new Result<SafetyBeltDevice>();
SafetyBeltDevice safetyBeltDevice = safetyBeltDeviceService.getById(MapUtils.getString(map, "id"));
if (safetyBeltDevice == null) {
result.error500("未找到对应实体");
} else {
result.setResult(safetyBeltDevice);
result.setSuccess(true);
}
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@ApiOperation(value = "导出excel安全带监测设备信息", notes = "导出excel安全带监测设备信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SafetyBeltDevice> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SafetyBeltDevice safetyBeltDevice = JSON.parseObject(deString, SafetyBeltDevice.class);
queryWrapper = QueryGenerator.initQueryWrapper(safetyBeltDevice, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SafetyBeltDevice> pageList = safetyBeltDeviceService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "安全带监测设备列表");
mv.addObject(NormalExcelConstants.CLASS, SafetyBeltDevice.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("安全带监测设备列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入安全带监测设备信息", notes = "通过excel导入安全带监测设备信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<SafetyBeltDevice> listSafetyBeltDevices = ExcelImportUtil.importExcel(file.getInputStream(), SafetyBeltDevice.class, params);
for (SafetyBeltDevice safetyBeltDeviceExcel : listSafetyBeltDevices) {
safetyBeltDeviceService.save(safetyBeltDeviceExcel);
}
return Result.ok("文件导入成功!数据行数:" + listSafetyBeltDevices.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}

View File

@ -0,0 +1,203 @@
package com.zhgd.xmgl.modules.safetybelt.controller;
import com.zhgd.annotation.OperLog;
import com.zhgd.xmgl.util.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltRealData;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltRealDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import springfox.documentation.annotations.ApiIgnore;
/**
* @Title: Controller
* @Description: 安全带监测实时数据
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/safetyBeltRealData")
@Slf4j
@Api(tags = "安全带监测实时数据管理")
public class SafetyBeltRealDataController {
@Autowired
private ISafetyBeltRealDataService safetyBeltRealDataService;
/**
* 分页列表查询
*
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "分页查询", operDesc = "分页列表查询安全带监测实时数据信息")
@ApiOperation(value = " 分页列表查询安全带监测实时数据信息", notes = "分页列表查询安全带监测实时数据信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
})
@PostMapping(value = "/page")
public Result<IPage<SafetyBeltRealData>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<SafetyBeltRealData> queryWrapper = QueryGenerator.initPageQueryWrapper(SafetyBeltRealData.class, map);
Page<SafetyBeltRealData> page = PageUtil.getPage(map);
IPage<SafetyBeltRealData> pageList = safetyBeltRealDataService.page(page, queryWrapper);
return Result.success(pageList);
}
/**
* 列表查询
*
* @param safetyBeltRealData
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "列表查询", operDesc = "列表查询安全带监测实时数据信息")
@ApiOperation(value = " 列表查询安全带监测实时数据信息", notes = "列表查询安全带监测实时数据信息", httpMethod = "POST")
@PostMapping(value = "/list")
public Result<List<SafetyBeltRealData>> queryList(@RequestBody SafetyBeltRealData safetyBeltRealData) {
QueryWrapper<SafetyBeltRealData> queryWrapper = QueryGenerator.initQueryWrapper(safetyBeltRealData);
List<SafetyBeltRealData> list = safetyBeltRealDataService.list(queryWrapper);
return Result.success(list);
}
/**
* 添加
*
* @param safetyBeltRealData
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "新增", operDesc = "添加安全带监测实时数据信息")
@ApiOperation(value = " 添加安全带监测实时数据信息", notes = "添加安全带监测实时数据信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<Object> add(@RequestBody SafetyBeltRealData safetyBeltRealData) {
Result<SafetyBeltRealData> result = new Result<SafetyBeltRealData>();
safetyBeltRealDataService.save(safetyBeltRealData);
return Result.success("添加成功!");
}
/**
* 编辑
*
* @param safetyBeltRealData
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "修改", operDesc = "编辑安全带监测实时数据信息")
@ApiOperation(value = "编辑安全带监测实时数据信息", notes = "编辑安全带监测实时数据信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<SafetyBeltRealData> edit(@RequestBody SafetyBeltRealData safetyBeltRealData) {
Result<SafetyBeltRealData> result = new Result<SafetyBeltRealData>();
SafetyBeltRealData safetyBeltRealDataEntity = safetyBeltRealDataService.getById(safetyBeltRealData.getId());
if (safetyBeltRealDataEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltRealDataService.updateById(safetyBeltRealData);
if (ok) {
result.success("修改成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 通过id删除
*
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "删除", operDesc = "删除安全带监测实时数据信息")
@ApiOperation(value = "删除安全带监测实时数据信息", notes = "删除安全带监测实时数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测实时数据ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete")
public Result<SafetyBeltRealData> delete(@RequestBody SafetyBeltRealData safetyBeltRealData) {
Result<SafetyBeltRealData> result = new Result<SafetyBeltRealData>();
SafetyBeltRealData safetyBeltRealDataEntity = safetyBeltRealDataService.getById(safetyBeltRealData.getId());
if (safetyBeltRealDataEntity == null) {
result.error500("未找到对应实体");
} else {
boolean ok = safetyBeltRealDataService.removeById(safetyBeltRealData.getId());
if (ok) {
result.success("删除成功!");
} else {
result.success("操作失败!");
}
}
return result;
}
/**
* 批量删除
*
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "批量删除", operDesc = "批量删除安全带监测实时数据信息")
@ApiOperation(value = "批量删除安全带监测实时数据信息", notes = "批量删除安全带监测实时数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "ids", value = "安全带监测实时数据ID字符串", paramType = "body", required = true, dataType = "String")
@PostMapping(value = "/deleteBatch")
public Result<SafetyBeltRealData> deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<SafetyBeltRealData> result = new Result<SafetyBeltRealData>();
String ids = MapUtils.getString(map, "ids");
if (ids == null || "".equals(ids.trim())) {
result.error500("参数不识别!");
} else {
this.safetyBeltRealDataService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* 通过id查询
*
* @return
*/
@OperLog(operModul = "安全带监测实时数据管理", operType = "查询", operDesc = "通过id查询安全带监测实时数据信息")
@ApiOperation(value = "通过id查询安全带监测实时数据信息", notes = "通过id查询安全带监测实时数据信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "安全带监测实时数据ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<SafetyBeltRealData> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
Result<SafetyBeltRealData> result = new Result<SafetyBeltRealData>();
SafetyBeltRealData safetyBeltRealData = safetyBeltRealDataService.getById(MapUtils.getString(map, "id"));
if (safetyBeltRealData == null) {
result.error500("未找到对应实体");
} else {
result.setResult(safetyBeltRealData);
result.setSuccess(true);
}
return result;
}
}

View File

@ -0,0 +1,58 @@
package com.zhgd.xmgl.modules.safetybelt.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 安全带监测预警
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Data
@TableName("safety_belt_alarm")
@ApiModel(value="SafetyBeltAlarm实体类",description="SafetyBeltAlarm")
public class SafetyBeltAlarm implements Serializable {
private static final long serialVersionUID = 1L;
/**预警ID*/
@TableId(type = IdType.AUTO)
@ApiModelProperty(value="预警ID")
private Integer id ;
/**设备编码*/
@Excel(name = "设备编码", width = 15)
@ApiModelProperty(value="设备编码")
private String deviceCode ;
/**操作人员名称*/
@Excel(name = "操作人员名称", width = 15)
@ApiModelProperty(value="操作人员名称")
private String username ;
/**预警类型*/
@Excel(name = "预警类型", width = 15)
@ApiModelProperty(value="预警类型")
private String alarmType ;
/**预警参数*/
@Excel(name = "预警参数", width = 15)
@ApiModelProperty(value="预警参数")
private String alarmParam ;
/**预警时间*/
@Excel(name = "预警时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="预警时间")
private Date alarmTime ;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="创建时间")
private Date createTime ;
}

View File

@ -0,0 +1,42 @@
package com.zhgd.xmgl.modules.safetybelt.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 安全带监测设备
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Data
@TableName("safety_belt_device")
@ApiModel(value="SafetyBeltDevice实体类",description="SafetyBeltDevice")
public class SafetyBeltDevice implements Serializable {
private static final long serialVersionUID = 1L;
/**安全带设备ID*/
@TableId(type = IdType.AUTO)
@ApiModelProperty(value="安全带设备ID")
private Integer id ;
/**设备编码*/
@Excel(name = "设备编码", width = 15)
@ApiModelProperty(value="设备编码")
private String code ;
/**设备名称*/
@Excel(name = "设备名称", width = 15)
@ApiModelProperty(value="设备名称")
private String name ;
/**是否可用(0:不可用;1:可用;)*/
@Excel(name = "是否可用(0:不可用;1:可用;)", width = 15)
@ApiModelProperty(value="是否可用(0:不可用;1:可用;)")
private Integer state ;
}

View File

@ -0,0 +1,58 @@
package com.zhgd.xmgl.modules.safetybelt.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description: 安全带监测实时数据
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Data
@TableName("safety_belt_real_data")
@ApiModel(value="SafetyBeltRealData实体类",description="SafetyBeltRealData")
public class SafetyBeltRealData implements Serializable {
private static final long serialVersionUID = 1L;
/**实时数据ID*/
@TableId(type = IdType.AUTO)
@ApiModelProperty(value="实时数据ID")
private Integer id ;
/**设备编码*/
@Excel(name = "设备编码", width = 15)
@ApiModelProperty(value="设备编码")
private String deviceCode ;
/**操作人员名称*/
@Excel(name = "操作人员名称", width = 15)
@ApiModelProperty(value="操作人员名称")
private String username ;
/**挂钩使用状态(0异常1正常)*/
@Excel(name = "挂钩使用状态(0异常1正常)", width = 15)
@ApiModelProperty(value="挂钩使用状态(0异常1正常)")
private Integer usageState ;
/**双钩挂接距离*/
@Excel(name = "双钩挂接距离", width = 15)
@ApiModelProperty(value="双钩挂接距离")
private String distance ;
/**上报时间*/
@Excel(name = "上报时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="上报时间")
private Date reportTime ;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="创建时间")
private Date createTime ;
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltAlarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 安全带监测预警
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Mapper
public interface SafetyBeltAlarmMapper extends BaseMapper<SafetyBeltAlarm> {
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 安全带监测设备
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Mapper
public interface SafetyBeltDeviceMapper extends BaseMapper<SafetyBeltDevice> {
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltRealData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* @Description: 安全带监测实时数据
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Mapper
public interface SafetyBeltRealDataMapper extends BaseMapper<SafetyBeltRealData> {
}

View File

@ -0,0 +1,5 @@
<?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.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltAlarmMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?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.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltDeviceMapper">
</mapper>

View File

@ -0,0 +1,5 @@
<?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.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltRealDataMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.safetybelt.service;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltAlarm;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 安全带监测预警
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
public interface ISafetyBeltAlarmService extends IService<SafetyBeltAlarm> {
}

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.safetybelt.service;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltDevice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 安全带监测设备
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
public interface ISafetyBeltDeviceService extends IService<SafetyBeltDevice> {
}

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.safetybelt.service;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltRealData;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @Description: 安全带监测实时数据
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
public interface ISafetyBeltRealDataService extends IService<SafetyBeltRealData> {
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.service.impl;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltAlarm;
import com.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltAlarmMapper;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltAlarmService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 安全带监测预警
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Service
public class SafetyBeltAlarmServiceImpl extends ServiceImpl<SafetyBeltAlarmMapper, SafetyBeltAlarm> implements ISafetyBeltAlarmService {
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.service.impl;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltDevice;
import com.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltDeviceMapper;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltDeviceService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 安全带监测设备
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Service
public class SafetyBeltDeviceServiceImpl extends ServiceImpl<SafetyBeltDeviceMapper, SafetyBeltDevice> implements ISafetyBeltDeviceService {
}

View File

@ -0,0 +1,19 @@
package com.zhgd.xmgl.modules.safetybelt.service.impl;
import com.zhgd.xmgl.modules.safetybelt.entity.SafetyBeltRealData;
import com.zhgd.xmgl.modules.safetybelt.mapper.SafetyBeltRealDataMapper;
import com.zhgd.xmgl.modules.safetybelt.service.ISafetyBeltRealDataService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 安全带监测实时数据
* @author pengj
* @date 2024-08-19
* @version V1.0
*/
@Service
public class SafetyBeltRealDataServiceImpl extends ServiceImpl<SafetyBeltRealDataMapper, SafetyBeltRealData> implements ISafetyBeltRealDataService {
}