From 991cef191df8fd15ad0b87f790208ca087d87089 Mon Sep 17 00:00:00 2001 From: Administrator <1923636941@qq.com> Date: Wed, 24 May 2023 15:26:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=92=A2=E4=B8=9D=E7=BB=B3?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...MaterialPointCheckIntoWarehouseDetail.java | 2 +- .../gt/entity/GtMaterialWarehouseDetail.java | 3 +- .../GtMaterialWarehouseDetailServiceImpl.java | 5 +- ...eRopeInspectionDamageRecordController.java | 205 ++++++++++++++++++ ...ckwWireRopeInspectionRecordController.java | 197 +++++++++++++++++ .../TckwWireRopeInspectionDamageRecord.java | 97 +++++++++ .../entity/TckwWireRopeInspectionRecord.java | 126 +++++++++++ ...wWireRopeInspectionDamageRecordMapper.java | 16 ++ .../TckwWireRopeInspectionRecordMapper.java | 16 ++ ...kwWireRopeInspectionDamageRecordMapper.xml | 4 + .../TckwWireRopeInspectionRecordMapper.xml | 4 + ...WireRopeInspectionDamageRecordService.java | 14 ++ .../ITckwWireRopeInspectionRecordService.java | 17 ++ ...RopeInspectionDamageRecordServiceImpl.java | 19 ++ ...kwWireRopeInspectionRecordServiceImpl.java | 103 +++++++++ .../zhgd/xmgl/security/WebSecurityConfig.java | 1 + 16 files changed, 825 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionDamageRecordController.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionRecordController.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionDamageRecord.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionRecord.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionDamageRecordMapper.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionRecordMapper.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionDamageRecordMapper.xml create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionRecordMapper.xml create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionDamageRecordService.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionRecordService.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionDamageRecordServiceImpl.java create mode 100644 src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionRecordServiceImpl.java diff --git a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialPointCheckIntoWarehouseDetail.java b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialPointCheckIntoWarehouseDetail.java index 4da736b6f..ae6e97dbc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialPointCheckIntoWarehouseDetail.java +++ b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialPointCheckIntoWarehouseDetail.java @@ -72,7 +72,7 @@ public class GtMaterialPointCheckIntoWarehouseDetail implements Serializable { */ @Excel(name = "单价", width = 15) @ApiModelProperty(value = "单价") - private java.lang.String unitPrice; + private BigDecimal unitPrice; /** * 金额(元) */ diff --git a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialWarehouseDetail.java b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialWarehouseDetail.java index 3ac12464b..4e57ef5bc 100644 --- a/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialWarehouseDetail.java +++ b/src/main/java/com/zhgd/xmgl/modules/gt/entity/GtMaterialWarehouseDetail.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.gt.entity; import java.io.Serializable; +import java.math.BigDecimal; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; @@ -61,7 +62,7 @@ public class GtMaterialWarehouseDetail implements Serializable { */ @Excel(name = "单价", width = 15) @ApiModelProperty(value = "单价") - private java.lang.String unitPrice; + private BigDecimal unitPrice; /** * 库存 */ diff --git a/src/main/java/com/zhgd/xmgl/modules/gt/service/impl/GtMaterialWarehouseDetailServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/gt/service/impl/GtMaterialWarehouseDetailServiceImpl.java index 5dda8145a..453f73093 100644 --- a/src/main/java/com/zhgd/xmgl/modules/gt/service/impl/GtMaterialWarehouseDetailServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/gt/service/impl/GtMaterialWarehouseDetailServiceImpl.java @@ -1,5 +1,6 @@ package com.zhgd.xmgl.modules.gt.service.impl; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -30,8 +31,8 @@ public class GtMaterialWarehouseDetailServiceImpl extends ServiceImpl queryPageList(GtMaterialWarehouseDetail gtMaterialWarehouseDetail, Integer pageNo, Integer pageSize, HttpServletRequest req, String groupBy) { String defaultAlias = "wd."; QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(gtMaterialWarehouseDetail, req.getParameterMap(), null, - ReflectionUtil.getFieldNameList(GtMaterialWarehouseDetail::getName), defaultAlias); - queryWrapper.groupBy(StringUtils.isNotBlank(groupBy), defaultAlias + groupBy); + ReflectionUtil.getFieldNameList(GtMaterialWarehouseDetail::getName, GtMaterialWarehouseDetail::getSpecification, GtMaterialWarehouseDetail::getUnit), defaultAlias); + queryWrapper.groupBy(StringUtils.isNotBlank(groupBy), defaultAlias + StrUtil.toUnderlineCase(groupBy)); Page page = new Page(pageNo, pageSize); IPage pageList = gtMaterialWarehouseDetailMapper.queryPageList(page, queryWrapper, groupBy); return pageList; diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionDamageRecordController.java b/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionDamageRecordController.java new file mode 100644 index 000000000..4c9532fc4 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionDamageRecordController.java @@ -0,0 +1,205 @@ +package com.zhgd.xmgl.modules.tckw.controller; + +import com.alibaba.fastjson.JSONObject; +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionDamageRecord; +import com.zhgd.xmgl.modules.tckw.service.ITckwWireRopeInspectionDamageRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +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.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: TCK.W钢丝绳检测损伤记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/tckw/tckwWireRopeInspectionDamageRecord") +@Slf4j +@Api(tags = "TckwWireRopeInspectionDamageRecordController相关Api") +public class TckwWireRopeInspectionDamageRecordController { + @Autowired + private ITckwWireRopeInspectionDamageRecordService tckwWireRopeInspectionDamageRecordService; + + /** + * 分页列表查询 + * + * @param tckwWireRopeInspectionDamageRecord + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = " 分页列表查询TCK.W钢丝绳检测损伤记录信息", notes = "分页列表查询TCK.W钢丝绳检测损伤记录信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(tckwWireRopeInspectionDamageRecord, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = tckwWireRopeInspectionDamageRecordService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 列表查询 + * + * @param tckwWireRopeInspectionDamageRecord + * @param req + * @return + */ + @ApiOperation(value = " 列表查询TCK.W钢丝绳检测损伤记录信息", notes = "列表查询TCK.W钢丝绳检测损伤记录信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord, + HttpServletRequest req) { + + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(tckwWireRopeInspectionDamageRecord, req.getParameterMap()); + return Result.success(tckwWireRopeInspectionDamageRecordService.list(queryWrapper)); + } + + /** + * 添加 + * + * @param tckwWireRopeInspectionDamageRecord + * @return + */ + @ApiOperation(value = " 添加TCK.W钢丝绳检测损伤记录信息", notes = "添加TCK.W钢丝绳检测损伤记录信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord) { + Result result = new Result(); + try { + tckwWireRopeInspectionDamageRecordService.save(tckwWireRopeInspectionDamageRecord); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑 + * + * @param tckwWireRopeInspectionDamageRecord + * @return + */ + @ApiOperation(value = "编辑TCK.W钢丝绳检测损伤记录信息", notes = "编辑TCK.W钢丝绳检测损伤记录信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord) { + Result result = new Result(); + TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecordEntity = tckwWireRopeInspectionDamageRecordService.getById(tckwWireRopeInspectionDamageRecord.getId()); + if (tckwWireRopeInspectionDamageRecordEntity == null) { + result.error500("未找到对应实体"); + } else { + tckwWireRopeInspectionDamageRecordService.updateById(tckwWireRopeInspectionDamageRecord); + result.success("修改成功!"); + } + + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除TCK.W钢丝绳检测损伤记录信息", notes = "删除TCK.W钢丝绳检测损伤记录信息", httpMethod = "POST") + @PostMapping(value = "/delete") + public Result delete(@RequestBody String id) { + JSONObject jsonObject = JSON.parseObject(id, JSONObject.class); + id = String.valueOf(jsonObject.get("id")); + Result result = new Result(); + TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord = tckwWireRopeInspectionDamageRecordService.getById(id); + if (tckwWireRopeInspectionDamageRecord == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = tckwWireRopeInspectionDamageRecordService.removeById(id); + if (ok) { + result.success("删除成功!"); + } + } + + return result; + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "批量删除TCK.W钢丝绳检测损伤记录信息", notes = "批量删除TCK.W钢丝绳检测损伤记录信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "TCK.W钢丝绳检测损伤记录ID字符串", paramType = "query", required = true, dataType = "String") + @PostMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.tckwWireRopeInspectionDamageRecordService.removeByIds(Arrays.asList(ids.split(","))); + result.success("删除成功!"); + } + return result; + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @ApiOperation(value = "通过id查询TCK.W钢丝绳检测损伤记录信息", notes = "通过id查询TCK.W钢丝绳检测损伤记录信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "TCK.W钢丝绳检测损伤记录ID", paramType = "query", required = true, dataType = "Integer") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + TckwWireRopeInspectionDamageRecord tckwWireRopeInspectionDamageRecord = tckwWireRopeInspectionDamageRecordService.getById(id); + if (tckwWireRopeInspectionDamageRecord == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(tckwWireRopeInspectionDamageRecord); + result.setSuccess(true); + } + return result; + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionRecordController.java b/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionRecordController.java new file mode 100644 index 000000000..a59dddb5c --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/controller/TckwWireRopeInspectionRecordController.java @@ -0,0 +1,197 @@ +package com.zhgd.xmgl.modules.tckw.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +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.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionRecord; +import com.zhgd.xmgl.modules.tckw.service.ITckwWireRopeInspectionRecordService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + + +/** + * @Title: Controller + * @Description: TCK.W钢丝绳检测记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/tckw/tckwWireRopeInspectionRecord") +@Slf4j +@Api(tags = "TckwWireRopeInspectionRecordController相关Api") +public class TckwWireRopeInspectionRecordController { + @Autowired + private ITckwWireRopeInspectionRecordService tckwWireRopeInspectionRecordService; + + /** + * 分页列表查询 + * + * @param tckwWireRopeInspectionRecord + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = " 分页列表查询TCK.W钢丝绳检测记录信息", notes = "分页列表查询TCK.W钢丝绳检测记录信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(tckwWireRopeInspectionRecord, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = tckwWireRopeInspectionRecordService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 列表查询 + * + * @param tckwWireRopeInspectionRecord + * @param req + * @return + */ + @ApiOperation(value = " 列表查询TCK.W钢丝绳检测记录信息", notes = "列表查询TCK.W钢丝绳检测记录信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord, + HttpServletRequest req) { + + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(tckwWireRopeInspectionRecord, req.getParameterMap()); + return Result.success(tckwWireRopeInspectionRecordService.list(queryWrapper)); + } + + /** + * 添加 + * + * @param tckwWireRopeInspectionRecord + * @return + */ + @ApiOperation(value = " 添加TCK.W钢丝绳检测记录信息", notes = "添加TCK.W钢丝绳检测记录信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord) { + Result result = new Result(); + try { + tckwWireRopeInspectionRecordService.save(tckwWireRopeInspectionRecord); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑 + * + * @param tckwWireRopeInspectionRecord + * @return + */ + @ApiOperation(value = "编辑TCK.W钢丝绳检测记录信息", notes = "编辑TCK.W钢丝绳检测记录信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord) { + Result result = new Result(); + TckwWireRopeInspectionRecord tckwWireRopeInspectionRecordEntity = tckwWireRopeInspectionRecordService.getById(tckwWireRopeInspectionRecord.getId()); + if (tckwWireRopeInspectionRecordEntity == null) { + result.error500("未找到对应实体"); + } else { + tckwWireRopeInspectionRecordService.updateById(tckwWireRopeInspectionRecord); + result.success("修改成功!"); + } + + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除TCK.W钢丝绳检测记录信息", notes = "删除TCK.W钢丝绳检测记录信息", httpMethod = "POST") + @PostMapping(value = "/delete") + public Result delete(@RequestBody String id) { + JSONObject jsonObject = JSON.parseObject(id, JSONObject.class); + id = String.valueOf(jsonObject.get("id")); + Result result = new Result(); + TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord = tckwWireRopeInspectionRecordService.getById(id); + if (tckwWireRopeInspectionRecord == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = tckwWireRopeInspectionRecordService.removeById(id); + if (ok) { + result.success("删除成功!"); + } + } + + return result; + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @ApiOperation(value = "批量删除TCK.W钢丝绳检测记录信息", notes = "批量删除TCK.W钢丝绳检测记录信息", httpMethod = "POST") + @ApiImplicitParam(name = "id", value = "TCK.W钢丝绳检测记录ID字符串", paramType = "query", required = true, dataType = "String") + @PostMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.tckwWireRopeInspectionRecordService.removeByIds(Arrays.asList(ids.split(","))); + result.success("删除成功!"); + } + return result; + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @ApiOperation(value = "通过id查询TCK.W钢丝绳检测记录信息", notes = "通过id查询TCK.W钢丝绳检测记录信息", httpMethod = "GET") + @ApiImplicitParam(name = "id", value = "TCK.W钢丝绳检测记录ID", paramType = "query", required = true, dataType = "Integer") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord = tckwWireRopeInspectionRecordService.getById(id); + if (tckwWireRopeInspectionRecord == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(tckwWireRopeInspectionRecord); + result.setSuccess(true); + } + return result; + } + + /** + * 设备端添加TCK.W钢丝绳记录 + */ + @ApiOperation(value = " 设备端添加TCK.W钢丝绳记录", notes = "设备端添加TCK.W钢丝绳记录", httpMethod = "POST") + @PostMapping(value = "/addWithDamage") + public Result addWithDamage(@RequestBody HashMap map) { + tckwWireRopeInspectionRecordService.addWithDamage(map); + return Result.ok(); + } +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionDamageRecord.java b/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionDamageRecord.java new file mode 100644 index 000000000..f5258b471 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionDamageRecord.java @@ -0,0 +1,97 @@ +package com.zhgd.xmgl.modules.tckw.entity; + +import java.io.Serializable; + +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: TCK.W钢丝绳检测损伤记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Data +@TableName("tckw_wire_rope_inspection_damage_record") +@ApiModel(value = "TckwWireRopeInspectionDamageRecord实体类", description = "TckwWireRopeInspectionDamageRecord") +public class TckwWireRopeInspectionDamageRecord implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键id") + private java.lang.Long id; + /** + * TCK.W钢丝绳检测记录id + */ + @Excel(name = "TCK.W钢丝绳检测记录id", width = 15) + @ApiModelProperty(value = "TCK.W钢丝绳检测记录id") + private java.lang.Long tckwWireRopeInspectionRecordId; + /** + * 钢丝绳号(单绳总为1,多绳按1、2、3、4 … 区分) + */ + @Excel(name = "钢丝绳号(单绳总为1,多绳按1、2、3、4 … 区分)", width = 15) + @ApiModelProperty(value = "钢丝绳号(单绳总为1,多绳按1、2、3、4 … 区分)") + private java.lang.Integer wireRopeNumber; + /** + * 损伤位置,单位:m + */ + @Excel(name = "损伤位置,单位:m", width = 15) + @ApiModelProperty(value = "损伤位置,单位:m") + private java.lang.Double damageLocation; + /** + * 损伤起始位置,单位:m + */ + @Excel(name = "损伤起始位置,单位:m", width = 15) + @ApiModelProperty(value = "损伤起始位置,单位:m") + private java.lang.Double damageStartPosition; + /** + * 损伤结束位置,单位:m + */ + @Excel(name = "损伤结束位置,单位:m", width = 15) + @ApiModelProperty(value = "损伤结束位置,单位:m") + private java.lang.Double damageEndPosition; + /** + * 损伤量值(有效金属截面积损失率),单位:% + */ + @Excel(name = "损伤量值(有效金属截面积损失率),单位:%", width = 15) + @ApiModelProperty(value = "损伤量值(有效金属截面积损失率),单位:%") + private java.lang.Double damageValue; + /** + * 损伤程度(0=轻微,1=轻度,2=中度,3=较重,4=严重, 5=超限) + */ + @Excel(name = "损伤程度(0=轻微,1=轻度,2=中度,3=较重,4=严重, 5=超限)", width = 15) + @ApiModelProperty(value = "损伤程度(0=轻微,1=轻度,2=中度,3=较重,4=严重, 5=超限)") + private java.lang.Integer damageSeverity; + /** + * 项目sn + */ + @Excel(name = "项目sn", width = 15) + @ApiModelProperty(value = "项目sn") + private java.lang.String projectSn; + /** + * 创建时间 + */ + @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 java.util.Date createTime; + /** + * 更新时间 + */ + @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 java.util.Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionRecord.java b/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionRecord.java new file mode 100644 index 000000000..ab95ebf8d --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/entity/TckwWireRopeInspectionRecord.java @@ -0,0 +1,126 @@ +package com.zhgd.xmgl.modules.tckw.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: TCK.W钢丝绳检测记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Data +@TableName("tckw_wire_rope_inspection_record") +@ApiModel(value = "TckwWireRopeInspectionRecord实体类", description = "TckwWireRopeInspectionRecord") +public class TckwWireRopeInspectionRecord implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键id") + private java.lang.Long id; + /** + * TCK.W检测站点名称 + */ + @Excel(name = "TCK.W检测站点名称", width = 15) + @ApiModelProperty(value = "TCK.W检测站点名称") + private java.lang.String name; + /** + * 检测开始时间,格式:2023-05-22 18:00:00 + */ + @Excel(name = "检测开始时间,格式:2023-05-22 18:00:00", width = 15) + @ApiModelProperty(value = "检测开始时间,格式:2023-05-22 18:00:00") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date startTime; + /** + * 检测结束时间,格式:2023-05-22 18:00:00 + */ + @Excel(name = "检测结束时间,格式:2023-05-22 18:00:00", width = 15) + @ApiModelProperty(value = "检测结束时间,格式:2023-05-22 18:00:00") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date endTime; + /** + * 检测起始位置,单位:m + */ + @Excel(name = "检测起始位置,单位:m", width = 15) + @ApiModelProperty(value = "检测起始位置,单位:m") + private java.lang.Double startPos; + /** + * 检测结束位置,单位:m + */ + @Excel(name = "检测结束位置,单位:m", width = 15) + @ApiModelProperty(value = "检测结束位置,单位:m") + private java.lang.Double endPos; + /** + * 平均速度,单位:m/s + */ + @Excel(name = "平均速度,单位:m/s", width = 15) + @ApiModelProperty(value = "平均速度,单位:m/s") + private java.lang.Double avgSpeed; + /** + * 损伤数量 + */ + @Excel(name = "损伤数量", width = 15) + @ApiModelProperty(value = "损伤数量") + private java.lang.Integer flawCnt; + /** + * 钢丝绳直径,单位:mm + */ + @Excel(name = "钢丝绳直径,单位:mm", width = 15) + @ApiModelProperty(value = "钢丝绳直径,单位:mm") + private java.lang.Double ropeDm; + /** + * 钢丝绳规格型号 + */ + @Excel(name = "钢丝绳规格型号", width = 15) + @ApiModelProperty(value = "钢丝绳规格型号") + private java.lang.String ropeSpec; + /** + * 钢丝绳长度,单位:m + */ + @Excel(name = "钢丝绳长度,单位:m", width = 15) + @ApiModelProperty(value = "钢丝绳长度,单位:m") + private java.lang.Double ropeLen; + /** + * 钢丝绳根数 + */ + @Excel(name = "钢丝绳根数", width = 15) + @ApiModelProperty(value = "钢丝绳根数") + private java.lang.Integer ropeCnt; + /** + * 项目sn + */ + @Excel(name = "项目sn", width = 15) + @ApiModelProperty(value = "项目sn") + private java.lang.String projectSn; + /** + * 创建时间 + */ + @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 java.util.Date createTime; + /** + * 更新时间 + */ + @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 java.util.Date updateTime; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionDamageRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionDamageRecordMapper.java new file mode 100644 index 000000000..f6a95451b --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionDamageRecordMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.tckw.mapper; + +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionDamageRecord; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: TCK.W钢丝绳检测损伤记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Mapper +public interface TckwWireRopeInspectionDamageRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionRecordMapper.java new file mode 100644 index 000000000..ef72463aa --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/TckwWireRopeInspectionRecordMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.tckw.mapper; + +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionRecord; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: TCK.W钢丝绳检测记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Mapper +public interface TckwWireRopeInspectionRecordMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionDamageRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionDamageRecordMapper.xml new file mode 100644 index 000000000..420990ad5 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionDamageRecordMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionRecordMapper.xml new file mode 100644 index 000000000..f1031e1c9 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/mapper/xml/TckwWireRopeInspectionRecordMapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionDamageRecordService.java b/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionDamageRecordService.java new file mode 100644 index 000000000..637734bb1 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionDamageRecordService.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.modules.tckw.service; + +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionDamageRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: TCK.W钢丝绳检测损伤记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +public interface ITckwWireRopeInspectionDamageRecordService extends IService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionRecordService.java b/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionRecordService.java new file mode 100644 index 000000000..e097bbe52 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/service/ITckwWireRopeInspectionRecordService.java @@ -0,0 +1,17 @@ +package com.zhgd.xmgl.modules.tckw.service; + +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionRecord; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.HashMap; + +/** + * @Description: TCK.W钢丝绳检测记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +public interface ITckwWireRopeInspectionRecordService extends IService { + + void addWithDamage(HashMap map); +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionDamageRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionDamageRecordServiceImpl.java new file mode 100644 index 000000000..0483687b8 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionDamageRecordServiceImpl.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.tckw.service.impl; + +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionDamageRecord; +import com.zhgd.xmgl.modules.tckw.mapper.TckwWireRopeInspectionDamageRecordMapper; +import com.zhgd.xmgl.modules.tckw.service.ITckwWireRopeInspectionDamageRecordService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: TCK.W钢丝绳检测损伤记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Service +public class TckwWireRopeInspectionDamageRecordServiceImpl extends ServiceImpl implements ITckwWireRopeInspectionDamageRecordService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionRecordServiceImpl.java new file mode 100644 index 000000000..ffad10275 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/tckw/service/impl/TckwWireRopeInspectionRecordServiceImpl.java @@ -0,0 +1,103 @@ +package com.zhgd.xmgl.modules.tckw.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gexin.fastjson.JSON; +import com.gexin.fastjson.JSONArray; +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionDamageRecord; +import com.zhgd.xmgl.modules.tckw.entity.TckwWireRopeInspectionRecord; +import com.zhgd.xmgl.modules.tckw.mapper.TckwWireRopeInspectionDamageRecordMapper; +import com.zhgd.xmgl.modules.tckw.mapper.TckwWireRopeInspectionRecordMapper; +import com.zhgd.xmgl.modules.tckw.service.ITckwWireRopeInspectionRecordService; +import org.apache.commons.collections.MapUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.HashMap; + +/** + * @Description: TCK.W钢丝绳检测记录 + * @author: pds + * @date: 2023-05-24 + * @version: V1.0 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class TckwWireRopeInspectionRecordServiceImpl extends ServiceImpl implements ITckwWireRopeInspectionRecordService { + @Autowired + private TckwWireRopeInspectionDamageRecordMapper tckwWireRopeInspectionDamageRecordMapper; + + @Override + public void addWithDamage(HashMap map) { + /* + 请求例子: + { + “ID” : <整型>, 释义:TCK.W检测站点唯一ID号 + “name” : <字符串>, 释义:TCK.W检测站点名称 + “start_time” : <字符串>, 释义:检测开始时间,格式:2023-05-22 18:00:00 + “end_time” : <字符串>, 释义:检测结束时间,格式:2023-05-22 18:00:00 + “start_pos” : <浮点数>, 释义:检测起始位置,单位:m + “end_pos” : <浮点数>, 释义:检测结束位置,单位:m + “avg_speed” : <浮点数>, 释义:平均速度,单位:m/s + “flaw_cnt” : <整型>, 释义:损伤数量 + “flaw_list” : <数组>, 释义:损伤列表 + [ + [ + <整型>, 释义:钢丝绳号(单绳总为1,多绳按1、2、3、4 … 区分) + <浮点数>, 释义:损伤位置,单位:m + <浮点数>, 释义:损伤起始位置,单位:m + <浮点数>, 释义:损伤结束位置,单位:m + <浮点数>, 释义:损伤量值(有效金属截面积损失率),单位:% + <整型>, 释义:损伤程度(0=轻微,1=轻度,2=中度,3=较重,4=严重, 5=超限) + ], + . . . . . . + ], + “rope_dm” : <浮点数>, 释义:钢丝绳直径,单位:mm + “rope_spec” : <字符串>, 释义:钢丝绳规格型号 + “rope_len” : <浮点数>, 释义:钢丝绳长度,单位:m + “rope_cnt” : <整型>, 释义:钢丝绳根数 + } + */ + TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord = saveTckwWireRopeInspectionRecord(map); + saveTckwWireRopeInspectionDamageRecord(map, tckwWireRopeInspectionRecord); + + } + + private void saveTckwWireRopeInspectionDamageRecord(HashMap map, TckwWireRopeInspectionRecord tckwWireRopeInspectionRecord) { + String flawList = MapUtils.getString(map, "flaw_list"); + JSONArray array = JSON.parseArray(flawList); + for (Object one : array) { + JSONArray dataArr = JSON.parseArray(one.toString()); + TckwWireRopeInspectionDamageRecord r = new TckwWireRopeInspectionDamageRecord(); + r.setTckwWireRopeInspectionRecordId(tckwWireRopeInspectionRecord.getId()); + r.setWireRopeNumber(Integer.valueOf(dataArr.get(0).toString())); + r.setDamageLocation(Double.valueOf(dataArr.get(1).toString())); + r.setDamageStartPosition(Double.valueOf(dataArr.get(2).toString())); + r.setDamageEndPosition(Double.valueOf(dataArr.get(3).toString())); + r.setDamageValue(Double.valueOf(dataArr.get(4).toString())); + r.setDamageSeverity(Integer.valueOf(dataArr.get(5).toString())); + r.setProjectSn("todo"); + tckwWireRopeInspectionDamageRecordMapper.insert(r); + } + } + + private TckwWireRopeInspectionRecord saveTckwWireRopeInspectionRecord(HashMap map) { + TckwWireRopeInspectionRecord r = new TckwWireRopeInspectionRecord(); + r.setId(MapUtils.getLong(map, "ID")); + r.setName(MapUtils.getString(map, "name")); + r.setStartTime(DateUtil.parse(MapUtils.getString(map, "start_time"))); + r.setEndTime(DateUtil.parse(MapUtils.getString(map, "end_time"))); + r.setStartPos(MapUtils.getDouble(map, "start_pos")); + r.setEndPos(MapUtils.getDouble(map, "end_pos")); + r.setAvgSpeed(MapUtils.getDouble(map, "avg_speed")); + r.setFlawCnt(MapUtils.getInteger(map, "flaw_cnt")); + r.setRopeDm(MapUtils.getDouble(map, "rope_dm")); + r.setRopeSpec(MapUtils.getString(map, "rope_spec")); + r.setRopeLen(MapUtils.getDouble(map, "rope_len")); + r.setRopeCnt(MapUtils.getInteger(map, "rope_cnt")); + r.setProjectSn(MapUtils.getString(map, "todo")); + save(r); + return r; + } +} diff --git a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java index 68873b5e1..6000e70e2 100644 --- a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java +++ b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java @@ -226,6 +226,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/xmgl/weight/goodsName/list").permitAll() .antMatchers("/xmgl/weight/weighBookVehicleInfo/weighingType").permitAll() .antMatchers("/xmgl/weight/weighBookVehicleInfo/add").permitAll() + .antMatchers("/xmgl/tckw/tckwWireRopeInspectionRecord/addWithDamage").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .anyRequest().authenticated() // 剩下所有的验证都需要验证 .and()