bug修复

This commit is contained in:
guo 2024-01-19 16:18:03 +08:00
parent 2447883c03
commit ceea73541e
18 changed files with 437 additions and 291 deletions

View File

@ -54,22 +54,20 @@ public class AntiPressureFoldDev implements Serializable {
*/ */
@Excel(name = "厂家名称", width = 15) @Excel(name = "厂家名称", width = 15)
@ApiModelProperty(value = "厂家名称") @ApiModelProperty(value = "厂家名称")
private java.lang.String manufacturerName; private java.lang.String manufacturerName;
/** /**
* 进场时间 * 进场时间
*/ */
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd") @Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "进场时间") @ApiModelProperty(value = "进场时间")
private java.util.Date entryTime; private java.util.Date entryTime;
/** @ApiModelProperty(value = "负责人")
* 负责人 private java.lang.Long dutyUserId;
*/ @ApiModelProperty(value = "负责人名称")
@Excel(name = "负责人", width = 15) private java.lang.String dutyUserName;
@ApiModelProperty(value = "负责人") /**
private java.lang.String personInCharge;
/**
* 所属试验室 * 所属试验室
*/ */
@Excel(name = "所属试验室", width = 15) @Excel(name = "所属试验室", width = 15)

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -155,14 +156,20 @@ public class AntiPressureFoldManage implements Serializable {
* 更新时间 yyyy-MM-dd HH:mm:ss * 更新时间 yyyy-MM-dd HH:mm:ss
*/ */
@Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss") @Excel(name = "更新时间 yyyy-MM-dd HH:mm:ss", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "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") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
private java.util.Date updateDate; private java.util.Date updateDate;
/** /**
* 项目sn * 项目sn
*/ */
@Excel(name = "项目sn", width = 15) @Excel(name = "项目sn", width = 15)
@ApiModelProperty(value = "项目sn") @ApiModelProperty(value = "项目sn")
private java.lang.String projectSn; private java.lang.String projectSn;
@TableField(exist = false)
@ApiModelProperty(value = "所属试验室")
private java.lang.String affiliatedLaboratory;
@TableField(exist = false)
@ApiModelProperty(value = "设备名称")
private java.lang.String deviceName;
} }

View File

@ -1,8 +1,15 @@
package com.zhgd.xmgl.modules.antipressurefold.mapper; package com.zhgd.xmgl.modules.antipressurefold.mapper;
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 com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage; import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @Description: 抗压抗折一体机-管理 * @Description: 抗压抗折一体机-管理
@ -13,4 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper @Mapper
public interface AntiPressureFoldManageMapper extends BaseMapper<AntiPressureFoldManage> { public interface AntiPressureFoldManageMapper extends BaseMapper<AntiPressureFoldManage> {
IPage<AntiPressureFoldManage> queryList(Page<AntiPressureFoldManage> page, @Param(Constants.WRAPPER) QueryWrapper<AntiPressureFoldManage> queryWrapper);
List<AntiPressureFoldManage> queryList(@Param(Constants.WRAPPER) QueryWrapper<AntiPressureFoldManage> queryWrapper);
} }

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper"> <mapper namespace="com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper">
<select id="queryList" resultType="com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage">
select apfm.*,apfd.device_name,apfd.affiliated_laboratory from anti_pressure_fold_manage apfm
join anti_pressure_fold_dev apfd on apfd.dev_sn=apfm.dev_sn
${ew.customSqlSegment}
</select>
</mapper> </mapper>

View File

@ -1,21 +1,20 @@
package com.zhgd.xmgl.modules.antipressurefold.service.impl; package com.zhgd.xmgl.modules.antipressurefold.service.impl;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper;
import com.zhgd.xmgl.modules.antipressurefold.service.IAntiPressureFoldManageService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManage;
import com.zhgd.xmgl.modules.antipressurefold.mapper.AntiPressureFoldManageMapper;
import com.zhgd.xmgl.modules.antipressurefold.service.IAntiPressureFoldManageService;
import com.zhgd.xmgl.util.PageUtil;
import com.zhgd.xmgl.util.RefUtil;
import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.zhgd.xmgl.util.RefUtil;
/** /**
* @Description: 抗压抗折一体机-管理 * @Description: 抗压抗折一体机-管理
* @author pds * @author pds
@ -28,7 +27,7 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
public IPage<AntiPressureFoldManage> queryPageList(HashMap<String, Object> paramMap) { public IPage<AntiPressureFoldManage> queryPageList(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap); QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap);
Page<AntiPressureFoldManage> page = PageUtil.getPage(paramMap); Page<AntiPressureFoldManage> page = PageUtil.getPage(paramMap);
IPage<AntiPressureFoldManage> pageList = this.page(page, queryWrapper); IPage<AntiPressureFoldManage> pageList = baseMapper.queryList(page, queryWrapper);
pageList.setRecords(dealList(pageList.getRecords())); pageList.setRecords(dealList(pageList.getRecords()));
return pageList; return pageList;
} }
@ -36,12 +35,13 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
@Override @Override
public List<AntiPressureFoldManage> queryList(HashMap<String, Object> paramMap) { public List<AntiPressureFoldManage> queryList(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap); QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap);
return dealList(this.list(queryWrapper)); return dealList(baseMapper.queryList(queryWrapper));
} }
private QueryWrapper<AntiPressureFoldManage> getQueryWrapper(HashMap<String, Object> paramMap) { private QueryWrapper<AntiPressureFoldManage> getQueryWrapper(HashMap<String, Object> paramMap) {
QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap); String alias = "apfm.";
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(AntiPressureFoldManage::getId)); QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap, alias);
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(AntiPressureFoldManage::getId));
return queryWrapper; return queryWrapper;
} }

View File

@ -13,12 +13,14 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.IOUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -27,8 +29,11 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -46,194 +51,210 @@ import java.util.Map;
@Slf4j @Slf4j
@Api(tags = "材料进场记录相关Api") @Api(tags = "材料进场记录相关Api")
public class MaterialApproachRecordController { public class MaterialApproachRecordController {
@Autowired @Autowired
private IMaterialApproachRecordService materialApproachRecordService; private IMaterialApproachRecordService materialApproachRecordService;
/** /**
* 分页列表查询 * 分页列表查询
* *
* @param materialApproachRecord * @param materialApproachRecord
* @param pageNo 页码 * @param pageNo 页码
* @param pageSize 条数 * @param pageSize 条数
* @param req * @param req
* @return * @return
*/ */
@ApiOperation(value = "分页列表查询材料进场记录 信息", notes = "分页列表查询材料进场记录 信息", httpMethod = "GET") @ApiOperation(value = "分页列表查询材料进场记录 信息", notes = "分页列表查询材料进场记录 信息", httpMethod = "GET")
@GetMapping(value = "/page") @GetMapping(value = "/page")
public Result<IPage<MaterialApproachRecord>> queryPageList(MaterialApproachRecord materialApproachRecord, public Result<IPage<MaterialApproachRecord>> queryPageList(MaterialApproachRecord materialApproachRecord,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap()); QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime); queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
Page<MaterialApproachRecord> page = new Page<MaterialApproachRecord>(pageNo, pageSize); Page<MaterialApproachRecord> page = new Page<MaterialApproachRecord>(pageNo, pageSize);
IPage<MaterialApproachRecord> pageList = materialApproachRecordService.page(page, queryWrapper); IPage<MaterialApproachRecord> pageList = materialApproachRecordService.page(page, queryWrapper);
return Result.success(pageList); return Result.success(pageList);
} }
/** /**
* 列表查询 * 列表查询
* *
* @param materialApproachRecord * @param materialApproachRecord
* @param pageNo 页码 * @param pageNo 页码
* @param pageSize 条数 * @param pageSize 条数
* @param req * @param req
* @return * @return
*/ */
@ApiOperation(value = "列表查询材料进场记录 信息", notes = "列表查询材料进场记录 信息", httpMethod = "GET") @ApiOperation(value = "列表查询材料进场记录 信息", notes = "列表查询材料进场记录 信息", httpMethod = "GET")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<List<MaterialApproachRecord>> queryList(MaterialApproachRecord materialApproachRecord, public Result<List<MaterialApproachRecord>> queryList(MaterialApproachRecord materialApproachRecord,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) { HttpServletRequest req) {
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap()); QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime); queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
return Result.success(materialApproachRecordService.list(queryWrapper)); return Result.success(materialApproachRecordService.list(queryWrapper));
} }
/** /**
* 添加 * 添加
* *
* @param materialApproachRecord * @param materialApproachRecord
* @return * @return
*/ */
@ApiOperation(value = "添加材料进场记录 信息", notes = "添加材料进场记录 信息", httpMethod = "POST") @ApiOperation(value = "添加材料进场记录 信息", notes = "添加材料进场记录 信息", httpMethod = "POST")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<MaterialApproachRecord> add(@RequestBody MaterialApproachRecord materialApproachRecord) { public Result<MaterialApproachRecord> add(@RequestBody MaterialApproachRecord materialApproachRecord) {
materialApproachRecordService.save(materialApproachRecord); materialApproachRecordService.save(materialApproachRecord);
return Result.ok(); return Result.ok();
} }
/** /**
* 编辑 * 编辑
* *
* @param materialApproachRecord * @param materialApproachRecord
* @return * @return
*/ */
@ApiOperation(value = "编辑材料进场记录 信息", notes = "编辑材料进场记录 信息", httpMethod = "POST") @ApiOperation(value = "编辑材料进场记录 信息", notes = "编辑材料进场记录 信息", httpMethod = "POST")
@PostMapping(value = "/edit") @PostMapping(value = "/edit")
public Result<MaterialApproachRecord> edit(@RequestBody MaterialApproachRecord materialApproachRecord) { public Result<MaterialApproachRecord> edit(@RequestBody MaterialApproachRecord materialApproachRecord) {
materialApproachRecordService.updateById(materialApproachRecord); materialApproachRecordService.updateById(materialApproachRecord);
return Result.ok(); return Result.ok();
} }
/** /**
* 通过id删除 * 通过id删除
* *
* @param id * @param id
* @return * @return
*/ */
@ApiOperation(value = "删除材料进场记录 信息", notes = "删除材料进场记录 信息", httpMethod = "POST") @ApiOperation(value = "删除材料进场记录 信息", notes = "删除材料进场记录 信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "body", required = true, dataType = "Integer") @ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/delete") @PostMapping(value = "/delete")
public Result<MaterialApproachRecord> delete(@RequestBody String id) { public Result<MaterialApproachRecord> delete(@RequestBody String id) {
materialApproachRecordService.removeById(JSON.parseObject(id).get("id").toString()); materialApproachRecordService.removeById(JSON.parseObject(id).get("id").toString());
return Result.ok(); return Result.ok();
} }
/** /**
* 批量删除 * 批量删除
* *
* @param ids * @param ids
* @return * @return
*/ */
@ApiOperation(value = "批量删除材料进场记录 信息", notes = "批量删除材料进场记录 信息", httpMethod = "DELETE") @ApiOperation(value = "批量删除材料进场记录 信息", notes = "批量删除材料进场记录 信息", httpMethod = "DELETE")
@ApiImplicitParam(name = "id", value = "材料进场记录 ID字符串", paramType = "query", required = true, dataType = "String") @ApiImplicitParam(name = "id", value = "材料进场记录 ID字符串", paramType = "query", required = true, dataType = "String")
@DeleteMapping(value = "/deleteBatch") @DeleteMapping(value = "/deleteBatch")
public Result<MaterialApproachRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<MaterialApproachRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
if (ids == null || "".equals(ids.trim())) { if (ids == null || "".equals(ids.trim())) {
throw new IllegalArgumentException("参数不识别!"); throw new IllegalArgumentException("参数不识别!");
} else { } else {
this.materialApproachRecordService.removeByIds(Arrays.asList(ids.split(","))); this.materialApproachRecordService.removeByIds(Arrays.asList(ids.split(",")));
} }
return Result.ok(); return Result.ok();
} }
/** /**
* 通过id查询 * 通过id查询
* *
* @param id * @param id
* @return * @return
*/ */
@ApiOperation(value = "通过id查询材料进场记录 信息", notes = "通过id查询材料进场记录 信息", httpMethod = "GET") @ApiOperation(value = "通过id查询材料进场记录 信息", notes = "通过id查询材料进场记录 信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "query", required = true, dataType = "Integer") @ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById") @GetMapping(value = "/queryById")
public Result<MaterialApproachRecord> queryById(@RequestParam(name = "id", required = true) String id) { public Result<MaterialApproachRecord> queryById(@RequestParam(name = "id", required = true) String id) {
MaterialApproachRecord materialApproachRecord = materialApproachRecordService.getById(id); MaterialApproachRecord materialApproachRecord = materialApproachRecordService.getById(id);
return Result.success(materialApproachRecord); return Result.success(materialApproachRecord);
} }
/** /**
* 导出excel * 导出excel
* *
* @param request * @param request
* @param response * @param response
*/ */
@ApiOperation(value = "导出excel材料进场记录 信息", notes = "导出excel材料进场记录 信息", httpMethod = "POST") @ApiOperation(value = "导出excel材料进场记录 信息", notes = "导出excel材料进场记录 信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件 // Step.1 组装查询条件
QueryWrapper<MaterialApproachRecord> queryWrapper = null; QueryWrapper<MaterialApproachRecord> queryWrapper = null;
try { try {
String paramsStr = request.getParameter("paramsStr"); String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) { if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8"); String deString = URLDecoder.decode(paramsStr, "UTF-8");
MaterialApproachRecord materialApproachRecord = JSON.parseObject(deString, MaterialApproachRecord.class); MaterialApproachRecord materialApproachRecord = JSON.parseObject(deString, MaterialApproachRecord.class);
queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, request.getParameterMap()); queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, request.getParameterMap());
} }
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<MaterialApproachRecord> pageList = materialApproachRecordService.list(queryWrapper); List<MaterialApproachRecord> pageList = materialApproachRecordService.list(queryWrapper);
//导出文件名称 //导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "材料进场记录 列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "材料进场记录 列表");
mv.addObject(NormalExcelConstants.CLASS, MaterialApproachRecord.class); mv.addObject(NormalExcelConstants.CLASS, MaterialApproachRecord.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("材料进场记录 列表数据", "导出人:Jeecg", "导出信息")); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(null, "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv; return mv;
} }
/** /**
* 通过excel导入数据 * 通过excel导入数据
* *
* @param request * @param request
* @param response * @param response
* @return * @return
*/ */
@ApiOperation(value = "通过excel导入材料进场记录 信息", notes = "通过excel导入材料进场记录 信息", httpMethod = "POST") @ApiOperation(value = "通过excel导入材料进场记录 信息", notes = "通过excel导入材料进场记录 信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
params.setTitleRows(2); params.setTitleRows(0);
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<MaterialApproachRecord> listMaterialApproachRecords = ExcelImportUtil.importExcel(file.getInputStream(), MaterialApproachRecord.class, params); List<MaterialApproachRecord> listMaterialApproachRecords = ExcelImportUtil.importExcel(file.getInputStream(), MaterialApproachRecord.class, params);
for (MaterialApproachRecord materialApproachRecordExcel : listMaterialApproachRecords) { for (MaterialApproachRecord materialApproachRecordExcel : listMaterialApproachRecords) {
materialApproachRecordService.save(materialApproachRecordExcel); materialApproachRecordService.save(materialApproachRecordExcel);
} }
return Result.ok("文件导入成功!数据行数:" + listMaterialApproachRecords.size()); return Result.ok("文件导入成功!数据行数:" + listMaterialApproachRecords.size());
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
return Result.error("文件导入失败!"); return Result.error("文件导入失败!");
} finally { } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
return Result.ok("文件导入失败!"); return Result.ok("文件导入失败!");
} }
@GetMapping(value = "/downloadTemplate")
@ApiOperation(value = "下载导入模板")
public void downloadTemplate(HttpServletResponse response) {
try {
OutputStream out = response.getOutputStream();
response.setCharacterEncoding("UTF-8");
response.setContentType("application/vnd.ms-project");
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("材料进场记录导入模板.xlsx", "UTF-8"));
InputStream fis = new ClassPathResource("template/材料进场记录导入模板.xlsx").getInputStream();
IOUtils.copy(fis, out);
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} }

View File

@ -34,8 +34,8 @@ public class MaterialApproachRecord implements Serializable {
/** /**
* 进场时间 * 进场时间
*/ */
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd") @Excel(name = "进场时间(格式yyyy-MM-dd)", width = 15, format = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "进场时间") @ApiModelProperty(value = "进场时间")
private Date entryTime; private Date entryTime;
@ -63,8 +63,10 @@ public class MaterialApproachRecord implements Serializable {
@Excel(name = "进场量", width = 15) @Excel(name = "进场量", width = 15)
@ApiModelProperty(value = "进场量") @ApiModelProperty(value = "进场量")
private Double approachVolume; private Double approachVolume;
@Excel(name = "出场重量", width = 15)
@ApiModelProperty(value = "出场量") @ApiModelProperty(value = "出场量")
private Double appearanceVolume; private Double appearanceVolume;
@Excel(name = "净重量", width = 15)
@ApiModelProperty(value = "净重量") @ApiModelProperty(value = "净重量")
private Double netWeightVolume; private Double netWeightVolume;

View File

@ -138,6 +138,8 @@ public class PressureTestMachineManage implements Serializable {
@Excel(name = "公称直径(mm)", width = 15) @Excel(name = "公称直径(mm)", width = 15)
@ApiModelProperty(value = "公称直径(mm)") @ApiModelProperty(value = "公称直径(mm)")
private java.lang.Double nominalDiameter; private java.lang.Double nominalDiameter;
@ApiModelProperty(value = "施工部位")
private String constructionPart;
/** /**
* 创建时间 yyyy-MM-dd HH:mm:ss * 创建时间 yyyy-MM-dd HH:mm:ss
*/ */

View File

@ -1,7 +1,9 @@
package com.zhgd.xmgl.modules.standard.controller; package com.zhgd.xmgl.modules.standard.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.antipressurefold.entity.AntiPressureFoldManageBlockNumber;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm; import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService; import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -10,11 +12,10 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody; import springfox.documentation.annotations.ApiIgnore;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -23,25 +24,40 @@ import java.util.Map;
* @Title: Controller * @Title: Controller
* @Description: 标养室报警记录 * @Description: 标养室报警记录
* @author pds * @author pds
* @date 2020-12-02 * @date 2020-12-02
* @version V1.0 * @version V1.0
*/ */
@RestController @RestController
@RequestMapping("/xmgl/standardAlarm") @RequestMapping("/xmgl/standardAlarm")
@Slf4j @Slf4j
@Api(tags = "标养室报警记录") @Api(tags = "标养室报警记录")
public class StandardAlarmController { public class StandardAlarmController {
@Autowired @Autowired
private IStandardAlarmService standardAlarmService; private IStandardAlarmService standardAlarmService;
/**
* 分页列表查询
*
* @return
*/
@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"),
@ApiImplicitParam(name = "type", value = "1当天", paramType = "query", required = false, dataType = "Integer"),
})
@GetMapping(value = "/page")
public Result<IPage<StandardAlarm>> queryPageList(@ApiIgnore @RequestParam HashMap<String, Object> paramMap) {
return Result.success(standardAlarmService.queryPageList(paramMap));
}
@ApiOperation(value = "标养室报警统计", notes = "标养室报警统计", httpMethod = "POST") @ApiOperation(value = "标养室报警统计", notes = "标养室报警统计", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
}) })
@PostMapping(value = "/getStandardAlarmStatistics") @PostMapping(value = "/getStandardAlarmStatistics")
public Result<Map<String,Object>> getStandardAlarmStatistics(@RequestBody Map<String,Object> map) { public Result<Map<String, Object>> getStandardAlarmStatistics(@RequestBody Map<String, Object> map) {
return Result.success(standardAlarmService.getStandardAlarmStatistics(map)); return Result.success(standardAlarmService.getStandardAlarmStatistics(map));
} }

View File

@ -66,7 +66,6 @@ public class StandardCurrentDataController {
*/ */
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST") @ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
//@PostMapping(value = "/add",produces = {"application/json;charset=UTF-8"})
@PostMapping(value = "/saveStandardCurrentData", produces = {"application/json;charset=UTF-8"}) @PostMapping(value = "/saveStandardCurrentData", produces = {"application/json;charset=UTF-8"})
public Result saveStandardCurrentData(@RequestBody final JSONObject json) { public Result saveStandardCurrentData(@RequestBody final JSONObject json) {
log.info("saveStandardCurrentData:{}", JSON.toJSONString(json)); log.info("saveStandardCurrentData:{}", JSON.toJSONString(json));
@ -81,7 +80,6 @@ public class StandardCurrentDataController {
* @return * @return
*/ */
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST") @ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
//@PostMapping(value = "/saveStandardCurrentData")
@PostMapping(value = "/addCurrentData") @PostMapping(value = "/addCurrentData")
public Result<StandardCurrentData> addCurrentData(@RequestBody StandardCurrentData standardCurrentData) { public Result<StandardCurrentData> addCurrentData(@RequestBody StandardCurrentData standardCurrentData) {
log.info("addCurrentData:{}", JSON.toJSONString(standardCurrentData)); log.info("addCurrentData:{}", JSON.toJSONString(standardCurrentData));
@ -129,8 +127,8 @@ public class StandardCurrentDataController {
@ApiOperation(value = "查询设备最新一条实时数据", notes = "查询设备最新一条实时数据", httpMethod = "POST") @ApiOperation(value = "查询设备最新一条实时数据", notes = "查询设备最新一条实时数据", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "type", value = "1当天", paramType = "body", required = false, dataType = "Integer"), @ApiImplicitParam(name = "type", value = "1当天", paramType = "body", required = false, dataType = "Integer"),
}) })
@PostMapping(value = "/selectNewCurrentData") @PostMapping(value = "/selectNewCurrentData")
@ -194,7 +192,7 @@ public class StandardCurrentDataController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"), @ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"),
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", dataType = "String", paramType = "body", required = false), @ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", dataType = "String", paramType = "body", required = false),
@ApiImplicitParam(name = "type", value = "查询类型1过去24小时 ", dataType = "Integer", paramType = "body", required = true), @ApiImplicitParam(name = "type", value = "查询类型1过去24小时 2今天", dataType = "Integer", paramType = "body", required = true),
}) })
@PostMapping(value = "/countStandardCurrentData") @PostMapping(value = "/countStandardCurrentData")
public Result<List<StandardCurrentDataExt>> countStandardCurrentData(@RequestBody @ApiIgnore Map<String, Object> map) { public Result<List<StandardCurrentDataExt>> countStandardCurrentData(@RequestBody @ApiIgnore Map<String, Object> map) {

View File

@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.standard.entity;
import java.io.Serializable; import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@ -41,14 +42,22 @@ public class StandardAlarm implements Serializable {
private java.lang.String alarmType ; private java.lang.String alarmType ;
/**报警值*/ /**报警值*/
@Excel(name = "报警值", width = 15) @Excel(name = "报警值", width = 15)
@ApiModelProperty(value="报警值") @ApiModelProperty(value = "报警值")
private java.lang.String alarmValue ; private java.lang.String alarmValue;
/**报警时间*/ /**
@Excel(name = "报警时间", width = 15) * 报警时间
@ApiModelProperty(value="报警时间") */
private java.lang.String alarmTime ; @Excel(name = "报警时间", width = 15)
/**阀值*/ @ApiModelProperty(value = "报警时间")
@Excel(name = "阀值", width = 15) private java.lang.String alarmTime;
@ApiModelProperty(value="阀值") /**
private java.lang.String thresholdValue ; * 阀值
*/
@Excel(name = "阀值", width = 15)
@ApiModelProperty(value = "阀值")
private java.lang.String thresholdValue;
@TableField(exist = false)
@ApiModelProperty(value = "实验室名称(设备名称)")
private java.lang.String laboratoryName;
} }

View File

@ -1,12 +1,17 @@
package com.zhgd.xmgl.modules.standard.mapper; package com.zhgd.xmgl.modules.standard.mapper;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm; import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
/** /**
* @Description: 标养室报警记录 * @Description: 标养室报警记录
@ -28,4 +33,6 @@ public interface StandardAlarmMapper extends BaseMapper<StandardAlarm> {
List<Map<String, Object>> selectDevAlarmList(Map<String, Object> map); List<Map<String, Object>> selectDevAlarmList(Map<String, Object> map);
List<EntityMap> selectExcelStandardDevAlarmList(Map<String, Object> map); List<EntityMap> selectExcelStandardDevAlarmList(Map<String, Object> map);
IPage<StandardAlarm> queryPageList(Page page, @Param("p") HashMap<String, Object> paramMap);
} }

View File

@ -5,14 +5,26 @@
<select id="selectStandardAlarmList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap" parameterType="map"> <select id="selectStandardAlarmList" resultType="com.zhgd.jeecg.common.mybatis.EntityMap" parameterType="map">
SELECT a.*,b.business_name,b.laboratory_addr,b.laboratory_name,b.laboratory_director,b.lx_phone SELECT a.*,b.business_name,b.laboratory_addr,b.laboratory_name,b.laboratory_director,b.lx_phone
from standard_alarm a LEFT JOIN standard_dev b ON (a.dev_sn=b.dev_sn and a.project_sn=b.project_sn) from standard_alarm a LEFT JOIN standard_dev b ON (a.dev_sn=b.dev_sn and a.project_sn=b.project_sn)
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn} WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
ORDER BY a.alarm_time DESC ORDER BY a.alarm_time DESC
LIMIT 10 LIMIT 10
</select> </select>
<select id="getCurrentDayStandardAlarmCount" resultType="java.lang.Integer" parameterType="map"> <select id="getCurrentDayStandardAlarmCount" resultType="java.lang.Integer" parameterType="map">
SELECT count(1) SELECT count(1)
from standard_alarm a from standard_alarm a
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn} WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
and a.alarm_time>=CONCAT(DATE_FORMAT(now(),"%Y-%m-%d"),' 00:00:00') and a.alarm_time>=CONCAT(DATE_FORMAT(now(),"%Y-%m-%d"),' 00:00:00')
</select> </select>
<select id="selectStandardAlarmListByTime" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm"> <select id="selectStandardAlarmListByTime" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm">
@ -89,4 +101,20 @@
</if> </if>
ORDER BY w1.alarm_time desc ORDER BY w1.alarm_time desc
</select> </select>
<select id="queryPageList" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm">
select * from standard_alarm sa
join standard_dev sd on sa.dev_sn = sd.dev_sn
where 1=1
<if test="p.projectSn != null and p.projectSn != ''">
and sa.project_sn = #{p.projectSn}
</if>
<if test="p.devSn != null and p.devSn != ''">
and sa.dev_sn = #{p.devSn}
</if>
<if test="p.type == '1'.toString()">
and sa.alarm_time >= current_date
</if>
order by sa.alarm_time desc
</select>
</mapper> </mapper>

View File

@ -6,7 +6,13 @@
parameterType="map"> parameterType="map">
SELECT a.* SELECT a.*
from standard_current_data a from standard_current_data a
WHERE a.dev_sn=#{devSn} AND a.project_sn=#{projectSn} WHERE 1=1
<if test="devSn != null and devSn != ''">
and a.dev_sn=#{devSn}
</if>
<if test="projectSn != null and projectSn != ''">
AND a.project_sn=#{projectSn}
</if>
<if test="type == '1'.toString()"> <if test="type == '1'.toString()">
and a.receive_time > current_date and a.receive_time > current_date
</if> </if>
@ -129,6 +135,9 @@
<if test="type == '1'.toString()"> <if test="type == '1'.toString()">
and receive_time>=CONCAT(date_sub(curdate(),INTERVAL 2 DAY),' 00:00:00') and receive_time>=CONCAT(date_sub(curdate(),INTERVAL 2 DAY),' 00:00:00')
</if> </if>
<if test="type == '2'.toString()">
and receive_time>=current_date
</if>
GROUP BY time GROUP BY time
</select> </select>
</mapper> </mapper>

View File

@ -1,11 +1,13 @@
package com.zhgd.xmgl.modules.standard.service; package com.zhgd.xmgl.modules.standard.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm; import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData; import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
import com.zhgd.xmgl.modules.standard.entity.StandardDev; import com.zhgd.xmgl.modules.standard.entity.StandardDev;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -29,4 +31,5 @@ public interface IStandardAlarmService extends IService<StandardAlarm> {
void exporExcelStandardDevAlarm(HttpServletResponse response, Map<String, Object> map); void exporExcelStandardDevAlarm(HttpServletResponse response, Map<String, Object> map);
IPage<StandardAlarm> queryPageList(HashMap<String, Object> paramMap);
} }

View File

@ -1,6 +1,8 @@
package com.zhgd.xmgl.modules.standard.service.impl; package com.zhgd.xmgl.modules.standard.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.modules.basicdata.service.ICompanyService; import com.zhgd.xmgl.modules.basicdata.service.ICompanyService;
@ -13,6 +15,7 @@ import com.zhgd.xmgl.modules.standard.mapper.StandardWarningMapper;
import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService; import com.zhgd.xmgl.modules.standard.service.IStandardAlarmService;
import com.zhgd.xmgl.util.DateUtils; import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.JxlExcelUtils; import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.PageUtil;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -144,6 +147,12 @@ public class StandardAlarmServiceImpl extends ServiceImpl<StandardAlarmMapper, S
} }
} }
@Override
public IPage<StandardAlarm> queryPageList(HashMap<String, Object> paramMap) {
Page page = PageUtil.getPage(paramMap);
return standardAlarmMapper.queryPageList(page, paramMap);
}
@Override @Override
public void addStandardAlarmData(StandardCurrentData standardCurrentData, StandardDev standardDev) { public void addStandardAlarmData(StandardCurrentData standardCurrentData, StandardDev standardDev) {
QueryWrapper<StandardWarning> queryWrapper = new QueryWrapper<>(); QueryWrapper<StandardWarning> queryWrapper = new QueryWrapper<>();

View File

@ -19,6 +19,7 @@ import com.zhgd.xmgl.modules.standard.service.IStandardCurrentDataService;
import com.zhgd.xmgl.util.DateUtils; import com.zhgd.xmgl.util.DateUtils;
import com.zhgd.xmgl.util.JxlExcelUtils; import com.zhgd.xmgl.util.JxlExcelUtils;
import com.zhgd.xmgl.util.MessageUtil; import com.zhgd.xmgl.util.MessageUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,7 +34,7 @@ import java.util.stream.Collectors;
/** /**
* @Description: 标养室实时数据 * @Description: 标养室实时数据
* @author pds * @author pds
* @date 2020-11-30 * @date 2020-11-30
* @version V1.0 * @version V1.0
*/ */
@Service @Service
@ -58,10 +59,10 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
@Override @Override
public void addCurrentData(StandardCurrentData standardCurrentData) { public void addCurrentData(StandardCurrentData standardCurrentData) {
QueryWrapper<StandardDev> queryWrapper=new QueryWrapper<>(); QueryWrapper<StandardDev> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(StandardDev::getDevSn,standardCurrentData.getDevSn()); queryWrapper.lambda().eq(StandardDev::getDevSn, standardCurrentData.getDevSn());
StandardDev standardDev=standardDevMapper.selectOne(queryWrapper); StandardDev standardDev = standardDevMapper.selectOne(queryWrapper);
if(standardDev==null){ if (standardDev == null) {
throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr")); throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr"));
} }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -88,18 +89,18 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString()); int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString()); int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
Page<EntityMap> page = new Page<>(pageNo, pageSize); Page<EntityMap> page = new Page<>(pageNo, pageSize);
List<EntityMap> list=standardCurrentDataMapper.queryStandardCurrentDataPageList(page, map); List<EntityMap> list = standardCurrentDataMapper.queryStandardCurrentDataPageList(page, map);
return page.setRecords(list); return page.setRecords(list);
} }
@Override @Override
public void exportExcelStandardCurrentData(HttpServletResponse response, Map<String, Object> map) { public void exportExcelStandardCurrentData(HttpServletResponse response, Map<String, Object> map) {
try { try {
List<EntityMap> list=standardCurrentDataMapper.selectDownloadStandardCurrentDataList(map); List<EntityMap> list = standardCurrentDataMapper.selectDownloadStandardCurrentDataList(map);
String[] heads = { "实验室名称","温度","湿度","日期"}; String[] heads = {"实验室名称", "温度", "湿度", "日期"};
String[] headsStr = { "laboratoryName","temperature","humidity","receiveTime"}; String[] headsStr = {"laboratoryName", "temperature", "humidity", "receiveTime"};
JxlExcelUtils.excelExport("标养室历史数据",heads,headsStr,list,response); JxlExcelUtils.excelExport("标养室历史数据", heads, headsStr, list, response);
}catch (Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -111,39 +112,39 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
@Override @Override
public void saveStandardCurrentData(JSONObject json) { public void saveStandardCurrentData(JSONObject json) {
QueryWrapper<StandardDev> queryWrapper=new QueryWrapper<>(); QueryWrapper<StandardDev> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(StandardDev::getDevSn,json.getString("devSn")); queryWrapper.lambda().eq(StandardDev::getDevSn, json.getString("devSn"));
StandardDev standardDev=standardDevMapper.selectOne(queryWrapper); StandardDev standardDev = standardDevMapper.selectOne(queryWrapper);
if(standardDev==null){ if (standardDev == null) {
throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr")); throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr"));
} }
StandardCurrentData standardCurrentData=new StandardCurrentData(); StandardCurrentData standardCurrentData = new StandardCurrentData();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
standardCurrentData.setReceiveTime(sdf.format(new Date())); standardCurrentData.setReceiveTime(sdf.format(new Date()));
standardCurrentData.setProjectSn(standardDev.getProjectSn()); standardCurrentData.setProjectSn(standardDev.getProjectSn());
standardCurrentData.setDevSn(standardDev.getDevSn()); standardCurrentData.setDevSn(standardDev.getDevSn());
List<Double> temperatureList=new ArrayList<>(); List<Double> temperatureList = new ArrayList<>();
List<Double> humidityList=new ArrayList<>(); List<Double> humidityList = new ArrayList<>();
JSONArray array=json.getJSONArray("data"); JSONArray array = json.getJSONArray("data");
if(array!=null&&array.size()>0){ if (array != null && array.size() > 0) {
for (int i=0;i<array.size();i++){ for (int i = 0; i < array.size(); i++) {
JSONObject obj=array.getJSONObject(i); JSONObject obj = array.getJSONObject(i);
String temperature=obj.getString("temperature"); String temperature = obj.getString("temperature");
if(StringUtils.isNotEmpty(temperature)){ if (StringUtils.isNotEmpty(temperature)) {
temperatureList.add(Double.valueOf(temperature)); temperatureList.add(Double.valueOf(temperature));
} }
String humidity=obj.getString("humidity"); String humidity = obj.getString("humidity");
if(StringUtils.isNotEmpty(humidity)){ if (StringUtils.isNotEmpty(humidity)) {
humidityList.add(Double.valueOf(humidity)); humidityList.add(Double.valueOf(humidity));
} }
} }
} }
if(temperatureList.size()>0){ if (temperatureList.size() > 0) {
//计算温度平均值 //计算温度平均值
double avg = temperatureList.stream().collect(Collectors.averagingDouble(n -> n)); double avg = temperatureList.stream().collect(Collectors.averagingDouble(n -> n));
standardCurrentData.setTemperature(String.valueOf(avg)); standardCurrentData.setTemperature(String.valueOf(avg));
} }
if(humidityList.size()>0){ if (humidityList.size() > 0) {
//计算湿度平均值 //计算湿度平均值
double avg = humidityList.stream().collect(Collectors.averagingDouble(n -> n)); double avg = humidityList.stream().collect(Collectors.averagingDouble(n -> n));
standardCurrentData.setHumidity(String.valueOf(avg)); standardCurrentData.setHumidity(String.valueOf(avg));
@ -159,22 +160,43 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
@Override @Override
public List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map) { public List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map) {
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map); Integer type = MapUtils.getInteger(map, "type");
List<String> dateStrList = DateUtils.getDateTimeStrList(20, "yyyy-MM-dd HH:00:00"); if (Objects.equals(type, 1)) {
List<StandardCurrentDataExt> rtList = new ArrayList<>(); List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
Map<String, StandardCurrentDataExt> m = standardCurrentDataExts.stream().collect(Collectors.toMap(StandardCurrentDataExt::getTime, Function.identity())); List<String> dateStrList = DateUtils.getDateTimeStrList(20, "yyyy-MM-dd HH:00:00");
for (String date : dateStrList) { List<StandardCurrentDataExt> rtList = new ArrayList<>();
StandardCurrentDataExt e = m.get(date); Map<String, StandardCurrentDataExt> m = standardCurrentDataExts.stream().collect(Collectors.toMap(StandardCurrentDataExt::getTime, Function.identity()));
if (e == null) { for (String date : dateStrList) {
e = new StandardCurrentDataExt(); StandardCurrentDataExt e = m.get(date);
e.setTime(date); if (e == null) {
e.setHumidity("0"); e = new StandardCurrentDataExt();
e.setTemperature("0"); e.setTime(date);
e.setHumidity("0");
e.setTemperature("0");
}
e.setTime(DateUtil.format(DateUtil.parse(e.getTime()), "HH:00"));
rtList.add(e);
} }
e.setTime(DateUtil.format(DateUtil.parse(e.getTime()), "HH:00")); return rtList;
rtList.add(e); } else if (Objects.equals(type, 2)) {
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
List<String> dateStrList = DateUtils.getDateTimeStrList(100, "yyyy-MM-dd HH:00:00");
List<StandardCurrentDataExt> rtList = new ArrayList<>();
Map<String, StandardCurrentDataExt> m = standardCurrentDataExts.stream().collect(Collectors.toMap(StandardCurrentDataExt::getTime, Function.identity()));
for (String date : dateStrList) {
StandardCurrentDataExt e = m.get(date);
if (e == null) {
e = new StandardCurrentDataExt();
e.setTime(date);
e.setHumidity("0");
e.setTemperature("0");
}
e.setTime(DateUtil.format(DateUtil.parse(e.getTime()), "HH:00"));
rtList.add(e);
}
return rtList;
} }
return rtList; return null;
} }