diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/MockFrontierProtectionDevCurrentDataConfigController.java b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/MockFrontierProtectionDevCurrentDataConfigController.java new file mode 100644 index 000000000..72504fef6 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/MockFrontierProtectionDevCurrentDataConfigController.java @@ -0,0 +1,157 @@ +package com.zhgd.xmgl.modules.frontier.controller; + +import com.alibaba.fastjson.JSONObject; +import com.zhgd.annotation.OperLog; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiImplicitParams; + +import java.util.HashMap; + +import springfox.documentation.annotations.ApiIgnore; + +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 org.apache.commons.collections.MapUtils; +import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig; +import com.zhgd.xmgl.modules.frontier.service.IMockFrontierProtectionDevCurrentDataConfigService; + +import org.simpleframework.xml.core.Validate; +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.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; + + +/** + * @Title: Controller + * @Description: 模拟临边防护设备实时数据配置 + * @author: pds + * @date: 2025-05-13 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/mockFrontierProtectionDevCurrentDataConfig") +@Slf4j +@Api(tags = "模拟临边防护设备实时数据配置相关Api") +public class MockFrontierProtectionDevCurrentDataConfigController { + @Autowired + private IMockFrontierProtectionDevCurrentDataConfigService mockFrontierProtectionDevCurrentDataConfigService; + + /** + * 分页列表查询 + * + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "分页查询", operDesc = "分页列表查询模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "分页列表查询模拟临边防护设备实时数据配置信息", notes = "分页列表查询模拟临边防护设备实时数据配置信息", httpMethod = "GET") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNo", value = "第几页", paramType = "query", required = true, dataType = "Integer"), + @ApiImplicitParam(name = "pageSize", value = "每页显示条数", paramType = "query", required = true, dataType = "Integer"), + }) + @GetMapping(value = "/page") + public Result> queryPageList(@ApiIgnore @RequestParam HashMap param) { + return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryPageList(param)); + } + + /** + * 列表查询 + * + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "列表查询", operDesc = "列表查询模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "列表查询模拟临边防护设备实时数据配置信息", notes = "列表查询模拟临边防护设备实时数据配置信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(@ApiIgnore @RequestParam HashMap param) { + return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryList(param)); + } + + /** + * 添加 + * + * @param mockFrontierProtectionDevCurrentDataConfig + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "添加", operDesc = "添加模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "添加模拟临边防护设备实时数据配置信息", notes = "添加模拟临边防护设备实时数据配置信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody @Validate MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) { + mockFrontierProtectionDevCurrentDataConfigService.add(mockFrontierProtectionDevCurrentDataConfig); + return Result.ok(); + } + + /** + * 编辑 + * + * @param mockFrontierProtectionDevCurrentDataConfig + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "编辑", operDesc = "编辑模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "编辑模拟临边防护设备实时数据配置信息", notes = "编辑模拟临边防护设备实时数据配置信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) { + mockFrontierProtectionDevCurrentDataConfigService.edit(mockFrontierProtectionDevCurrentDataConfig); + return Result.ok(); + } + + /** + * 通过id删除 + * + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "删除", operDesc = "删除模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "删除模拟临边防护设备实时数据配置信息", notes = "删除模拟临边防护设备实时数据配置信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "模拟临边防护设备实时数据配置ID", paramType = "body", required = true, dataType = "String", example = "{\"id\":\"1\"}") + @PostMapping(value = "/delete") + public Result delete(@ApiIgnore @RequestBody HashMap map) { + mockFrontierProtectionDevCurrentDataConfigService.delete(MapUtils.getString(map, "id")); + return Result.ok(); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "通过id查询", operDesc = "通过id查询模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "通过id查询模拟临边防护设备实时数据配置信息", notes = "通过id查询模拟临边防护设备实时数据配置信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "模拟临边防护设备实时数据配置ID", paramType = "query", required = true, dataType = "Integer") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + return Result.success(mockFrontierProtectionDevCurrentDataConfigService.queryById(id)); + } + + @OperLog(operModul = "模拟临边防护设备实时数据配置管理", operType = "保存", operDesc = "保存模拟临边防护设备实时数据配置信息") + @ApiOperation(value = "保存模拟临边防护设备实时数据配置信息", notes = "保存模拟临边防护设备实时数据配置信息", httpMethod = "POST") + @PostMapping(value = "/save") + public Result saveEntity(@RequestBody MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) { + mockFrontierProtectionDevCurrentDataConfigService.saveEntity(mockFrontierProtectionDevCurrentDataConfig); + return Result.ok(); + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/entity/MockFrontierProtectionDevCurrentDataConfig.java b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/MockFrontierProtectionDevCurrentDataConfig.java new file mode 100644 index 000000000..5763d4f1a --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/entity/MockFrontierProtectionDevCurrentDataConfig.java @@ -0,0 +1,117 @@ +package com.zhgd.xmgl.modules.frontier.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: pds + * @date: 2025-05-13 + * @version: V1.0 + */ +@Data +@TableName("mock_frontier_protection_dev_current_data_config") +@ApiModel(value = "MockFrontierProtectionDevCurrentDataConfig实体类", description = "MockFrontierProtectionDevCurrentDataConfig") +public class MockFrontierProtectionDevCurrentDataConfig implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.Long id; + /** + * 所属项目SN + */ + @ApiModelProperty(value = "所属项目SN") + private java.lang.String projectSn; + /** + * 设备sn(多个,分隔) + */ + @ApiModelProperty(value = "设备sn(多个,分隔)") + private java.lang.String devSns; + /** + * 每个设备随机生成数量 + */ + @ApiModelProperty(value = "每个设备随机生成数量") + private java.lang.Integer devGenerateNum; + /** + * 开始时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "开始时间") + private java.util.Date startTime; + /** + * 结束时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "结束时间") + private java.util.Date endTime; + /** + * 创建时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建时间") + private java.util.Date createDate; + /** + * 更新时间 + */ + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新时间") + private java.util.Date updateDate; + /** + * 剩余电量百分比(0-100)开始 + */ + @ApiModelProperty(value = "剩余电量百分比(0-100)开始") + private java.lang.Float batteryBegin; + /** + * 剩余电量百分比(0-100)结束 + */ + @ApiModelProperty(value = "剩余电量百分比(0-100)结束") + private java.lang.Float batteryEnd; + /** + * 线锁1 状态 1-正常;2-断开;3-正常断开(多个数字,分割) + */ + @ApiModelProperty(value = "线锁1 状态 1-正常;2-断开;3-正常断开(多个数字,分割)") + private java.lang.String portStatus1s; + /** + * 线锁2 状态 1-正常;2-断开;3-正常断开(多个数字,分割) + */ + @ApiModelProperty(value = "线锁2 状态 1-正常;2-断开;3-正常断开(多个数字,分割)") + private java.lang.String portStatus2s; + /** + * 磁锁1 状态 1-正常;2-报警;3-失效(多个数字,分割) + */ + @ApiModelProperty(value = "磁锁1 状态 1-正常;2-报警;3-失效(多个数字,分割)") + private java.lang.String magStatus1s; + /** + * 磁锁2 状态 1-正常;2-报警;3-失效(多个数字,分割) + */ + @ApiModelProperty(value = "磁锁2 状态 1-正常;2-报警;3-失效(多个数字,分割)") + private java.lang.String magStatus2s; + /** + * 防翻越 1-正常;2-报警;3-失效(多个数字,分割) + */ + @ApiModelProperty(value = "防翻越 1-正常;2-报警;3-失效(多个数字,分割)") + private java.lang.String antiCrosses; + /** + * 人员靠近 1-正常;2-入侵;3-正常入侵(多个数字,分割) + */ + @ApiModelProperty(value = "人员靠近 1-正常;2-入侵;3-正常入侵(多个数字,分割)") + private java.lang.String proximitys; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/MockFrontierProtectionDevCurrentDataConfigMapper.java b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/MockFrontierProtectionDevCurrentDataConfigMapper.java new file mode 100644 index 000000000..781b22698 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/MockFrontierProtectionDevCurrentDataConfigMapper.java @@ -0,0 +1,51 @@ +package com.zhgd.xmgl.modules.frontier.mapper; + +import java.util.List; +import java.util.HashMap; + +import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 模拟临边防护设备实时数据配置 + * @author: pds + * @date: 2025-05-13 + * @version: V1.0 + */ +@Mapper +public interface MockFrontierProtectionDevCurrentDataConfigMapper extends BaseMapper { + + /** + * 分页列表查询模拟临边防护设备实时数据配置信息 + * + * @param page + * @param queryWrapper + * @param param + * @return + */ + IPage queryList(Page page, @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("param") HashMap param); + + /** + * 列表查询模拟临边防护设备实时数据配置信息 + * + * @param queryWrapper + * @param param + * @return + */ + List queryList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("param") HashMap param); + + + /** + * 通过id查询模拟临边防护设备实时数据配置信息 + * + * @param id + * @return + */ + MockFrontierProtectionDevCurrentDataConfig queryById(String id); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/MockFrontierProtectionDevCurrentDataConfigMapper.xml b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/MockFrontierProtectionDevCurrentDataConfigMapper.xml new file mode 100644 index 000000000..ca20196de --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/mapper/xml/MockFrontierProtectionDevCurrentDataConfigMapper.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/IMockFrontierProtectionDevCurrentDataConfigService.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/IMockFrontierProtectionDevCurrentDataConfigService.java new file mode 100644 index 000000000..36d8839e5 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/IMockFrontierProtectionDevCurrentDataConfigService.java @@ -0,0 +1,66 @@ +package com.zhgd.xmgl.modules.frontier.service; + +import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.core.metadata.IPage; + +import java.util.HashMap; +import java.util.List; + +/** + * @Description: 模拟临边防护设备实时数据配置 + * @author: pds + * @date: 2025-05-13 + * @version: V1.0 + */ +public interface IMockFrontierProtectionDevCurrentDataConfigService extends IService { + /** + * 分页列表查询模拟临边防护设备实时数据配置信息 + * + * @param param 参数map + * @return + */ + IPage queryPageList(HashMap param); + + /** + * 列表查询模拟临边防护设备实时数据配置信息 + * + * @param param 参数map + * @return + */ + List queryList(HashMap param); + + /** + * 添加模拟临边防护设备实时数据配置信息 + * + * @param mockFrontierProtectionDevCurrentDataConfig 模拟临边防护设备实时数据配置 + * @return + */ + void add(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig); + + /** + * 编辑模拟临边防护设备实时数据配置信息 + * + * @param mockFrontierProtectionDevCurrentDataConfig 模拟临边防护设备实时数据配置 + * @return + */ + void edit(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig); + + /** + * 根据id删除模拟临边防护设备实时数据配置信息 + * + * @param id 模拟临边防护设备实时数据配置的id + * @return + */ + void delete(String id); + + /** + * 根据id查询模拟临边防护设备实时数据配置信息 + * + * @param id 模拟临边防护设备实时数据配置的id + * @return + */ + MockFrontierProtectionDevCurrentDataConfig queryById(String id); + + void saveEntity(MockFrontierProtectionDevCurrentDataConfig config); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/MockFrontierProtectionDevCurrentDataConfigServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/MockFrontierProtectionDevCurrentDataConfigServiceImpl.java new file mode 100644 index 000000000..a11930baf --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/service/impl/MockFrontierProtectionDevCurrentDataConfigServiceImpl.java @@ -0,0 +1,103 @@ +package com.zhgd.xmgl.modules.frontier.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.zhgd.jeecg.common.execption.OpenAlertException; +import com.zhgd.xmgl.modules.frontier.entity.MockFrontierProtectionDevCurrentDataConfig; +import com.zhgd.xmgl.modules.frontier.mapper.MockFrontierProtectionDevCurrentDataConfigMapper; +import com.zhgd.xmgl.modules.frontier.service.IMockFrontierProtectionDevCurrentDataConfigService; +import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.xmgl.util.PageUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import java.util.HashMap; +import java.util.List; + +import com.zhgd.xmgl.util.RefUtil; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description: 模拟临边防护设备实时数据配置 + * @author: pds + * @date: 2025-05-13 + * @version: V1.0 + */ +@Service +public class MockFrontierProtectionDevCurrentDataConfigServiceImpl extends ServiceImpl implements IMockFrontierProtectionDevCurrentDataConfigService { + @Autowired + private MockFrontierProtectionDevCurrentDataConfigMapper mockFrontierProtectionDevCurrentDataConfigMapper; + + @Override + public IPage queryPageList(HashMap param) { + QueryWrapper queryWrapper = this.getQueryWrapper(param); + Page page = PageUtil.getPage(param); + IPage pageList = baseMapper.queryList(page, queryWrapper, param); + pageList.setRecords(this.dealList(pageList.getRecords())); + return pageList; + } + + @Override + public List queryList(HashMap param) { + QueryWrapper queryWrapper = getQueryWrapper(param); + return dealList(baseMapper.queryList(queryWrapper, param)); + } + + private QueryWrapper getQueryWrapper(HashMap param) { + QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(MockFrontierProtectionDevCurrentDataConfig.class, param, true); + queryWrapper.orderByDesc(RefUtil.fieldNameUlc(MockFrontierProtectionDevCurrentDataConfig::getId)); + return queryWrapper; + } + + private List dealList(List list) { + return list; + } + + @Override + public void add(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) { + mockFrontierProtectionDevCurrentDataConfig.setId(null); + baseMapper.insert(mockFrontierProtectionDevCurrentDataConfig); + } + + @Override + public void edit(MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig) { + MockFrontierProtectionDevCurrentDataConfig oldMockFrontierProtectionDevCurrentDataConfig = baseMapper.selectById(mockFrontierProtectionDevCurrentDataConfig.getId()); + if (oldMockFrontierProtectionDevCurrentDataConfig == null) { + throw new OpenAlertException("未找到对应实体"); + } + baseMapper.updateById(mockFrontierProtectionDevCurrentDataConfig); + } + + @Override + public void delete(String id) { + MockFrontierProtectionDevCurrentDataConfig mockFrontierProtectionDevCurrentDataConfig = baseMapper.selectById(id); + if (mockFrontierProtectionDevCurrentDataConfig == null) { + throw new OpenAlertException("未找到对应实体"); + } + baseMapper.deleteById(id); + } + + @Override + public MockFrontierProtectionDevCurrentDataConfig queryById(String id) { + MockFrontierProtectionDevCurrentDataConfig entity = baseMapper.queryById(id); + if (entity == null) { + throw new OpenAlertException("未找到对应实体"); + } + return entity; + } + + @Override + public void saveEntity(MockFrontierProtectionDevCurrentDataConfig config) { + MockFrontierProtectionDevCurrentDataConfig dbConfig = this.getOne(new LambdaQueryWrapper() + .eq(MockFrontierProtectionDevCurrentDataConfig::getProjectSn, config.getProjectSn())); + if (dbConfig == null) { + this.add(config); + } else { + config.setId(dbConfig.getId()); + this.edit(config); + } + + } +}