bug修复
This commit is contained in:
parent
2447883c03
commit
ceea73541e
@ -54,22 +54,20 @@ public class AntiPressureFoldDev implements Serializable {
|
||||
*/
|
||||
@Excel(name = "厂家名称", width = 15)
|
||||
@ApiModelProperty(value = "厂家名称")
|
||||
private java.lang.String manufacturerName;
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "进场时间")
|
||||
private java.util.Date entryTime;
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
@Excel(name = "负责人", width = 15)
|
||||
@ApiModelProperty(value = "负责人")
|
||||
private java.lang.String personInCharge;
|
||||
/**
|
||||
private java.lang.String manufacturerName;
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "进场时间")
|
||||
private java.util.Date entryTime;
|
||||
@ApiModelProperty(value = "负责人")
|
||||
private java.lang.Long dutyUserId;
|
||||
@ApiModelProperty(value = "负责人名称")
|
||||
private java.lang.String dutyUserName;
|
||||
/**
|
||||
* 所属试验室
|
||||
*/
|
||||
@Excel(name = "所属试验室", width = 15)
|
||||
|
||||
@ -4,6 +4,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
@ -155,14 +156,20 @@ public class AntiPressureFoldManage implements Serializable {
|
||||
* 更新时间 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")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
private java.lang.String projectSn;
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新时间 yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateDate;
|
||||
/**
|
||||
* 项目sn
|
||||
*/
|
||||
@Excel(name = "项目sn", width = 15)
|
||||
@ApiModelProperty(value = "项目sn")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1,8 +1,15 @@
|
||||
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 org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 抗压抗折一体机-管理
|
||||
@ -13,4 +20,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@Mapper
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1,4 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.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>
|
||||
|
||||
@ -1,21 +1,20 @@
|
||||
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.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 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.List;
|
||||
|
||||
import com.zhgd.xmgl.util.RefUtil;
|
||||
|
||||
/**
|
||||
* @Description: 抗压抗折一体机-管理
|
||||
* @author: pds
|
||||
@ -28,7 +27,7 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
|
||||
public IPage<AntiPressureFoldManage> queryPageList(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(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()));
|
||||
return pageList;
|
||||
}
|
||||
@ -36,12 +35,13 @@ public class AntiPressureFoldManageServiceImpl extends ServiceImpl<AntiPressureF
|
||||
@Override
|
||||
public List<AntiPressureFoldManage> queryList(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<AntiPressureFoldManage> queryWrapper = getQueryWrapper(paramMap);
|
||||
return dealList(this.list(queryWrapper));
|
||||
return dealList(baseMapper.queryList(queryWrapper));
|
||||
}
|
||||
|
||||
private QueryWrapper<AntiPressureFoldManage> getQueryWrapper(HashMap<String, Object> paramMap) {
|
||||
QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap);
|
||||
queryWrapper.orderByDesc(RefUtil.fieldNameUlc(AntiPressureFoldManage::getId));
|
||||
String alias = "apfm.";
|
||||
QueryWrapper<AntiPressureFoldManage> queryWrapper = QueryGenerator.initPageQueryWrapper(AntiPressureFoldManage.class, paramMap, alias);
|
||||
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(AntiPressureFoldManage::getId));
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
@ -13,12 +13,14 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
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.core.io.ClassPathResource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
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.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -46,194 +51,210 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Api(tags = "材料进场记录相关Api")
|
||||
public class MaterialApproachRecordController {
|
||||
@Autowired
|
||||
private IMaterialApproachRecordService materialApproachRecordService;
|
||||
@Autowired
|
||||
private IMaterialApproachRecordService materialApproachRecordService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询材料进场记录 信息", notes = "分页列表查询材料进场记录 信息", httpMethod = "GET")
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表查询材料进场记录 信息", notes = "分页列表查询材料进场记录 信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<IPage<MaterialApproachRecord>> queryPageList(MaterialApproachRecord materialApproachRecord,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Result<IPage<MaterialApproachRecord>> queryPageList(MaterialApproachRecord materialApproachRecord,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
|
||||
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
|
||||
Page<MaterialApproachRecord> page = new Page<MaterialApproachRecord>(pageNo, pageSize);
|
||||
IPage<MaterialApproachRecord> pageList = materialApproachRecordService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
|
||||
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
|
||||
Page<MaterialApproachRecord> page = new Page<MaterialApproachRecord>(pageNo, pageSize);
|
||||
IPage<MaterialApproachRecord> pageList = materialApproachRecordService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @param pageNo 页码
|
||||
* @param pageSize 条数
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "列表查询材料进场记录 信息", notes = "列表查询材料进场记录 信息", httpMethod = "GET")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<MaterialApproachRecord>> queryList(MaterialApproachRecord materialApproachRecord,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
public Result<List<MaterialApproachRecord>> queryList(MaterialApproachRecord materialApproachRecord,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
|
||||
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
|
||||
return Result.success(materialApproachRecordService.list(queryWrapper));
|
||||
}
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, req.getParameterMap());
|
||||
queryWrapper.lambda().orderByDesc(MaterialApproachRecord::getEntryTime);
|
||||
return Result.success(materialApproachRecordService.list(queryWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @return
|
||||
*/
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加材料进场记录 信息", notes = "添加材料进场记录 信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<MaterialApproachRecord> add(@RequestBody MaterialApproachRecord materialApproachRecord) {
|
||||
materialApproachRecordService.save(materialApproachRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
public Result<MaterialApproachRecord> add(@RequestBody MaterialApproachRecord materialApproachRecord) {
|
||||
materialApproachRecordService.save(materialApproachRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑材料进场记录 信息", notes = "编辑材料进场记录 信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<MaterialApproachRecord> edit(@RequestBody MaterialApproachRecord materialApproachRecord) {
|
||||
materialApproachRecordService.updateById(materialApproachRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param materialApproachRecord
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "编辑材料进场记录 信息", notes = "编辑材料进场记录 信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<MaterialApproachRecord> edit(@RequestBody MaterialApproachRecord materialApproachRecord) {
|
||||
materialApproachRecordService.updateById(materialApproachRecord);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除材料进场记录 信息", notes = "删除材料进场记录 信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<MaterialApproachRecord> delete(@RequestBody String id) {
|
||||
materialApproachRecordService.removeById(JSON.parseObject(id).get("id").toString());
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除材料进场记录 信息", notes = "删除材料进场记录 信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<MaterialApproachRecord> delete(@RequestBody String id) {
|
||||
materialApproachRecordService.removeById(JSON.parseObject(id).get("id").toString());
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除材料进场记录 信息", notes = "批量删除材料进场记录 信息", httpMethod = "DELETE")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID字符串", paramType = "query", required = true, dataType = "String")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<MaterialApproachRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
throw new IllegalArgumentException("参数不识别!");
|
||||
} else {
|
||||
this.materialApproachRecordService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除材料进场记录 信息", notes = "批量删除材料进场记录 信息", httpMethod = "DELETE")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID字符串", paramType = "query", required = true, dataType = "String")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<MaterialApproachRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
throw new IllegalArgumentException("参数不识别!");
|
||||
} else {
|
||||
this.materialApproachRecordService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
}
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询材料进场记录 信息", notes = "通过id查询材料进场记录 信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MaterialApproachRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MaterialApproachRecord materialApproachRecord = materialApproachRecordService.getById(id);
|
||||
return Result.success(materialApproachRecord);
|
||||
}
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询材料进场记录 信息", notes = "通过id查询材料进场记录 信息", httpMethod = "GET")
|
||||
@ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "query", required = true, dataType = "Integer")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<MaterialApproachRecord> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
MaterialApproachRecord materialApproachRecord = materialApproachRecordService.getById(id);
|
||||
return Result.success(materialApproachRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@ApiOperation(value = "导出excel材料进场记录 信息", notes = "导出excel材料进场记录 信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = null;
|
||||
try {
|
||||
String paramsStr = request.getParameter("paramsStr");
|
||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
MaterialApproachRecord materialApproachRecord = JSON.parseObject(deString, MaterialApproachRecord.class);
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@ApiOperation(value = "导出excel材料进场记录 信息", notes = "导出excel材料进场记录 信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<MaterialApproachRecord> queryWrapper = null;
|
||||
try {
|
||||
String paramsStr = request.getParameter("paramsStr");
|
||||
if (oConvertUtils.isNotEmpty(paramsStr)) {
|
||||
String deString = URLDecoder.decode(paramsStr, "UTF-8");
|
||||
MaterialApproachRecord materialApproachRecord = JSON.parseObject(deString, MaterialApproachRecord.class);
|
||||
queryWrapper = QueryGenerator.initQueryWrapper(materialApproachRecord, request.getParameterMap());
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<MaterialApproachRecord> pageList = materialApproachRecordService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "材料进场记录 列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, MaterialApproachRecord.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("材料进场记录 列表数据", "导出人:Jeecg", "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
List<MaterialApproachRecord> pageList = materialApproachRecordService.list(queryWrapper);
|
||||
//导出文件名称
|
||||
mv.addObject(NormalExcelConstants.FILE_NAME, "材料进场记录 列表");
|
||||
mv.addObject(NormalExcelConstants.CLASS, MaterialApproachRecord.class);
|
||||
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams(null, "导出信息"));
|
||||
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
|
||||
return mv;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过excel导入材料进场记录 信息", notes = "通过excel导入材料进场记录 信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MaterialApproachRecord> listMaterialApproachRecords = ExcelImportUtil.importExcel(file.getInputStream(), MaterialApproachRecord.class, params);
|
||||
for (MaterialApproachRecord materialApproachRecordExcel : listMaterialApproachRecords) {
|
||||
materialApproachRecordService.save(materialApproachRecordExcel);
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listMaterialApproachRecords.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.ok("文件导入失败!");
|
||||
}
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "通过excel导入材料进场记录 信息", notes = "通过excel导入材料进场记录 信息", httpMethod = "POST")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(0);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MaterialApproachRecord> listMaterialApproachRecords = ExcelImportUtil.importExcel(file.getInputStream(), MaterialApproachRecord.class, params);
|
||||
for (MaterialApproachRecord materialApproachRecordExcel : listMaterialApproachRecords) {
|
||||
materialApproachRecordService.save(materialApproachRecordExcel);
|
||||
}
|
||||
return Result.ok("文件导入成功!数据行数:" + listMaterialApproachRecords.size());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return Result.error("文件导入失败!");
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@ public class MaterialApproachRecord implements Serializable {
|
||||
/**
|
||||
* 进场时间
|
||||
*/
|
||||
@Excel(name = "进场时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "进场时间(格式:yyyy-MM-dd)", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "进场时间")
|
||||
private Date entryTime;
|
||||
@ -63,8 +63,10 @@ public class MaterialApproachRecord implements Serializable {
|
||||
@Excel(name = "进场量", width = 15)
|
||||
@ApiModelProperty(value = "进场量")
|
||||
private Double approachVolume;
|
||||
@Excel(name = "出场重量", width = 15)
|
||||
@ApiModelProperty(value = "出场量")
|
||||
private Double appearanceVolume;
|
||||
@Excel(name = "净重量", width = 15)
|
||||
@ApiModelProperty(value = "净重量")
|
||||
private Double netWeightVolume;
|
||||
|
||||
|
||||
@ -138,6 +138,8 @@ public class PressureTestMachineManage implements Serializable {
|
||||
@Excel(name = "公称直径(mm)", width = 15)
|
||||
@ApiModelProperty(value = "公称直径(mm)")
|
||||
private java.lang.Double nominalDiameter;
|
||||
@ApiModelProperty(value = "施工部位")
|
||||
private String constructionPart;
|
||||
/**
|
||||
* 创建时间 yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
package com.zhgd.xmgl.modules.standard.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
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.service.IStandardAlarmService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -10,11 +12,10 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,25 +24,40 @@ import java.util.Map;
|
||||
* @Title: Controller
|
||||
* @Description: 标养室报警记录
|
||||
* @author: pds
|
||||
* @date: 2020-12-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/standardAlarm")
|
||||
@Slf4j
|
||||
@Api(tags = "标养室报警记录")
|
||||
public class StandardAlarmController {
|
||||
@Autowired
|
||||
private IStandardAlarmService standardAlarmService;
|
||||
* @date: 2020-12-02
|
||||
* @version: V1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/standardAlarm")
|
||||
@Slf4j
|
||||
@Api(tags = "标养室报警记录")
|
||||
public class StandardAlarmController {
|
||||
@Autowired
|
||||
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")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
|
||||
})
|
||||
@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));
|
||||
}
|
||||
|
||||
|
||||
@ -66,7 +66,6 @@ public class StandardCurrentDataController {
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
|
||||
//@PostMapping(value = "/add",produces = {"application/json;charset=UTF-8"})
|
||||
@PostMapping(value = "/saveStandardCurrentData", produces = {"application/json;charset=UTF-8"})
|
||||
public Result saveStandardCurrentData(@RequestBody final JSONObject json) {
|
||||
log.info("saveStandardCurrentData:{}", JSON.toJSONString(json));
|
||||
@ -81,7 +80,6 @@ public class StandardCurrentDataController {
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加标养室实时数据信息", notes = "添加标养室实时数据信息", httpMethod = "POST")
|
||||
//@PostMapping(value = "/saveStandardCurrentData")
|
||||
@PostMapping(value = "/addCurrentData")
|
||||
public Result<StandardCurrentData> addCurrentData(@RequestBody StandardCurrentData standardCurrentData) {
|
||||
log.info("addCurrentData:{}", JSON.toJSONString(standardCurrentData));
|
||||
@ -129,8 +127,8 @@ public class StandardCurrentDataController {
|
||||
|
||||
@ApiOperation(value = "查询设备最新一条实时数据", notes = "查询设备最新一条实时数据", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "devSn", value = "标养室设备唯一标识", paramType = "body", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "type", value = "1当天", paramType = "body", required = false, dataType = "Integer"),
|
||||
})
|
||||
@PostMapping(value = "/selectNewCurrentData")
|
||||
@ -194,7 +192,7 @@ public class StandardCurrentDataController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = false, dataType = "String"),
|
||||
@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")
|
||||
public Result<List<StandardCurrentDataExt>> countStandardCurrentData(@RequestBody @ApiIgnore Map<String, Object> map) {
|
||||
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.standard.entity;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
@ -22,7 +23,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@ApiModel(value="StandardAlarm实体类",description="StandardAlarm")
|
||||
public class StandardAlarm implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value="id")
|
||||
@ -41,14 +42,22 @@ public class StandardAlarm implements Serializable {
|
||||
private java.lang.String alarmType ;
|
||||
/**报警值*/
|
||||
@Excel(name = "报警值", width = 15)
|
||||
@ApiModelProperty(value="报警值")
|
||||
private java.lang.String alarmValue ;
|
||||
/**报警时间*/
|
||||
@Excel(name = "报警时间", width = 15)
|
||||
@ApiModelProperty(value="报警时间")
|
||||
private java.lang.String alarmTime ;
|
||||
/**阀值*/
|
||||
@Excel(name = "阀值", width = 15)
|
||||
@ApiModelProperty(value="阀值")
|
||||
private java.lang.String thresholdValue ;
|
||||
@ApiModelProperty(value = "报警值")
|
||||
private java.lang.String alarmValue;
|
||||
/**
|
||||
* 报警时间
|
||||
*/
|
||||
@Excel(name = "报警时间", width = 15)
|
||||
@ApiModelProperty(value = "报警时间")
|
||||
private java.lang.String alarmTime;
|
||||
/**
|
||||
* 阀值
|
||||
*/
|
||||
@Excel(name = "阀值", width = 15)
|
||||
@ApiModelProperty(value = "阀值")
|
||||
private java.lang.String thresholdValue;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "实验室名称(设备名称)")
|
||||
private java.lang.String laboratoryName;
|
||||
}
|
||||
|
||||
@ -1,12 +1,17 @@
|
||||
package com.zhgd.xmgl.modules.standard.mapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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 org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @Description: 标养室报警记录
|
||||
@ -28,4 +33,6 @@ public interface StandardAlarmMapper extends BaseMapper<StandardAlarm> {
|
||||
List<Map<String, Object>> selectDevAlarmList(Map<String, Object> map);
|
||||
|
||||
List<EntityMap> selectExcelStandardDevAlarmList(Map<String, Object> map);
|
||||
|
||||
IPage<StandardAlarm> queryPageList(Page page, @Param("p") HashMap<String, Object> paramMap);
|
||||
}
|
||||
|
||||
@ -5,14 +5,26 @@
|
||||
<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
|
||||
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
|
||||
LIMIT 10
|
||||
</select>
|
||||
<select id="getCurrentDayStandardAlarmCount" resultType="java.lang.Integer" parameterType="map">
|
||||
SELECT count(1)
|
||||
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')
|
||||
</select>
|
||||
<select id="selectStandardAlarmListByTime" resultType="com.zhgd.xmgl.modules.standard.entity.StandardAlarm">
|
||||
@ -89,4 +101,20 @@
|
||||
</if>
|
||||
ORDER BY w1.alarm_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
<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>
|
||||
|
||||
@ -6,7 +6,13 @@
|
||||
parameterType="map">
|
||||
SELECT 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()">
|
||||
and a.receive_time > current_date
|
||||
</if>
|
||||
@ -129,6 +135,9 @@
|
||||
<if test="type == '1'.toString()">
|
||||
and receive_time>=CONCAT(date_sub(curdate(),INTERVAL 2 DAY),' 00:00:00')
|
||||
</if>
|
||||
<if test="type == '2'.toString()">
|
||||
and receive_time>=current_date
|
||||
</if>
|
||||
GROUP BY time
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -1,11 +1,13 @@
|
||||
package com.zhgd.xmgl.modules.standard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardAlarm;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardCurrentData;
|
||||
import com.zhgd.xmgl.modules.standard.entity.StandardDev;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -29,4 +31,5 @@ public interface IStandardAlarmService extends IService<StandardAlarm> {
|
||||
|
||||
void exporExcelStandardDevAlarm(HttpServletResponse response, Map<String, Object> map);
|
||||
|
||||
IPage<StandardAlarm> queryPageList(HashMap<String, Object> paramMap);
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.standard.service.impl;
|
||||
|
||||
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.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
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.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.JxlExcelUtils;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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
|
||||
public void addStandardAlarmData(StandardCurrentData standardCurrentData, StandardDev standardDev) {
|
||||
QueryWrapper<StandardWarning> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
@ -19,6 +19,7 @@ import com.zhgd.xmgl.modules.standard.service.IStandardCurrentDataService;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
import com.zhgd.xmgl.util.JxlExcelUtils;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -33,7 +34,7 @@ import java.util.stream.Collectors;
|
||||
/**
|
||||
* @Description: 标养室实时数据
|
||||
* @author: pds
|
||||
* @date: 2020-11-30
|
||||
* @date: 2020-11-30
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@ -58,10 +59,10 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
|
||||
|
||||
@Override
|
||||
public void addCurrentData(StandardCurrentData standardCurrentData) {
|
||||
QueryWrapper<StandardDev> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(StandardDev::getDevSn,standardCurrentData.getDevSn());
|
||||
StandardDev standardDev=standardDevMapper.selectOne(queryWrapper);
|
||||
if(standardDev==null){
|
||||
QueryWrapper<StandardDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(StandardDev::getDevSn, standardCurrentData.getDevSn());
|
||||
StandardDev standardDev = standardDevMapper.selectOne(queryWrapper);
|
||||
if (standardDev == null) {
|
||||
throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr"));
|
||||
}
|
||||
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 pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportExcelStandardCurrentData(HttpServletResponse response, Map<String, Object> map) {
|
||||
try {
|
||||
List<EntityMap> list=standardCurrentDataMapper.selectDownloadStandardCurrentDataList(map);
|
||||
String[] heads = { "实验室名称","温度","湿度","日期"};
|
||||
String[] headsStr = { "laboratoryName","temperature","humidity","receiveTime"};
|
||||
JxlExcelUtils.excelExport("标养室历史数据",heads,headsStr,list,response);
|
||||
}catch (Exception e){
|
||||
List<EntityMap> list = standardCurrentDataMapper.selectDownloadStandardCurrentDataList(map);
|
||||
String[] heads = {"实验室名称", "温度", "湿度", "日期"};
|
||||
String[] headsStr = {"laboratoryName", "temperature", "humidity", "receiveTime"};
|
||||
JxlExcelUtils.excelExport("标养室历史数据", heads, headsStr, list, response);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -111,39 +112,39 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
|
||||
|
||||
@Override
|
||||
public void saveStandardCurrentData(JSONObject json) {
|
||||
QueryWrapper<StandardDev> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(StandardDev::getDevSn,json.getString("devSn"));
|
||||
StandardDev standardDev=standardDevMapper.selectOne(queryWrapper);
|
||||
if(standardDev==null){
|
||||
QueryWrapper<StandardDev> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(StandardDev::getDevSn, json.getString("devSn"));
|
||||
StandardDev standardDev = standardDevMapper.selectOne(queryWrapper);
|
||||
if (standardDev == null) {
|
||||
throw new OpenAlertException(MessageUtil.get("EquipmentNumIncorrectErr"));
|
||||
}
|
||||
StandardCurrentData standardCurrentData=new StandardCurrentData();
|
||||
StandardCurrentData standardCurrentData = new StandardCurrentData();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
standardCurrentData.setReceiveTime(sdf.format(new Date()));
|
||||
standardCurrentData.setProjectSn(standardDev.getProjectSn());
|
||||
standardCurrentData.setDevSn(standardDev.getDevSn());
|
||||
List<Double> temperatureList=new ArrayList<>();
|
||||
List<Double> humidityList=new ArrayList<>();
|
||||
JSONArray array=json.getJSONArray("data");
|
||||
if(array!=null&&array.size()>0){
|
||||
for (int i=0;i<array.size();i++){
|
||||
JSONObject obj=array.getJSONObject(i);
|
||||
String temperature=obj.getString("temperature");
|
||||
if(StringUtils.isNotEmpty(temperature)){
|
||||
List<Double> temperatureList = new ArrayList<>();
|
||||
List<Double> humidityList = new ArrayList<>();
|
||||
JSONArray array = json.getJSONArray("data");
|
||||
if (array != null && array.size() > 0) {
|
||||
for (int i = 0; i < array.size(); i++) {
|
||||
JSONObject obj = array.getJSONObject(i);
|
||||
String temperature = obj.getString("temperature");
|
||||
if (StringUtils.isNotEmpty(temperature)) {
|
||||
temperatureList.add(Double.valueOf(temperature));
|
||||
}
|
||||
String humidity=obj.getString("humidity");
|
||||
if(StringUtils.isNotEmpty(humidity)){
|
||||
String humidity = obj.getString("humidity");
|
||||
if (StringUtils.isNotEmpty(humidity)) {
|
||||
humidityList.add(Double.valueOf(humidity));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(temperatureList.size()>0){
|
||||
if (temperatureList.size() > 0) {
|
||||
//计算温度平均值
|
||||
double avg = temperatureList.stream().collect(Collectors.averagingDouble(n -> n));
|
||||
standardCurrentData.setTemperature(String.valueOf(avg));
|
||||
}
|
||||
if(humidityList.size()>0){
|
||||
if (humidityList.size() > 0) {
|
||||
//计算湿度平均值
|
||||
double avg = humidityList.stream().collect(Collectors.averagingDouble(n -> n));
|
||||
standardCurrentData.setHumidity(String.valueOf(avg));
|
||||
@ -159,22 +160,43 @@ public class StandardCurrentDataServiceImpl extends ServiceImpl<StandardCurrentD
|
||||
|
||||
@Override
|
||||
public List<StandardCurrentDataExt> countStandardCurrentData(Map<String, Object> map) {
|
||||
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
|
||||
List<String> dateStrList = DateUtils.getDateTimeStrList(20, "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");
|
||||
Integer type = MapUtils.getInteger(map, "type");
|
||||
if (Objects.equals(type, 1)) {
|
||||
List<StandardCurrentDataExt> standardCurrentDataExts = baseMapper.countStandardCurrentData(map);
|
||||
List<String> dateStrList = DateUtils.getDateTimeStrList(20, "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);
|
||||
}
|
||||
e.setTime(DateUtil.format(DateUtil.parse(e.getTime()), "HH:00"));
|
||||
rtList.add(e);
|
||||
return rtList;
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BIN
src/main/resources/template/材料进场记录导入模板.xlsx
Normal file
BIN
src/main/resources/template/材料进场记录导入模板.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user