feb9c216 张雷

项目整理

1 个父辈 cc2fa85f
正在显示 28 个修改的文件 包含 1 行增加1625 行删除
package com.skua.modules.custom.controller;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.core.api.vo.Result;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.custom.entity.FReportItemCustom;
import com.skua.modules.custom.service.IFReportShowCustomService;
import com.skua.modules.custom.vo.FReportShowCustomVO;
......
package com.skua.modules.custom.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.skua.core.aspect.annotation.Dict;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 运营日报自定义项管理
*/
@Data
@TableName("f_report_item_custom")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="f_report_item_custom对象", description="运营日报自定义项管理")
public class FReportItemCustom {
/**主键*/
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
@ApiModelProperty(value = "父ID")
private java.lang.String pid;
@ApiModelProperty(value = "节点路径")
private java.lang.String treePath;
/**药剂类型【污泥、污水、消毒药剂】*/
@Dict(dicCode = "yjlx")
@Excel(name = "药剂类型【污泥、污水、消毒药剂】", width = 15)
@ApiModelProperty(value = "药剂类型【污泥、污水、消毒药剂】")
private java.lang.String itemType;
/**指标编码*/
@Excel(name = "指标编码", width = 15)
@ApiModelProperty(value = "指标编码")
private java.lang.String itemCode;
/**指标名称*/
@Excel(name = "指标名称", width = 15)
@ApiModelProperty(value = "指标名称")
private java.lang.String itemName;
/**排序*/
@Excel(name = "排序", width = 15)
@ApiModelProperty(value = "排序")
private java.lang.Integer itemSort;
/**片区id*/
@Excel(name = "片区id", width = 15)
@ApiModelProperty(value = "片区id")
private java.lang.String areaId;
/**总价*/
@Excel(name = "总价", width = 15)
@ApiModelProperty(value = "总价")
private java.lang.String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**创建时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private java.util.Date updateTime;
}
package com.skua.modules.custom.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.custom.entity.FReportItemCustom;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 运营日报自定义项管理
*/
public interface FReportItemCustomMapper extends BaseMapper<FReportItemCustom> {
}
<?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.skua.modules.custom.mapper.FReportItemCustomMapper">
</mapper>
\ No newline at end of file
package com.skua.modules.custom.service;
import com.skua.core.api.vo.TreeData;
import com.skua.modules.custom.entity.FReportItemCustom;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 运营日报自定义项管理
*/
public interface IFReportItemCustomService extends IService<FReportItemCustom> {
/**
* <pre>
* 构造树
* </pre>
* @param pid
* @return
* @author Li Yuanyuan, 2021年1月28日 上午9:43:30
*/
List<TreeData> tree(String pid);
}
package com.skua.modules.custom.service.impl;
import com.skua.core.api.vo.TransTreeModel;
import com.skua.core.api.vo.TreeData;
import com.skua.core.util.TreeUtils;
import com.skua.modules.custom.entity.FReportItemCustom;
import com.skua.modules.custom.mapper.FReportItemCustomMapper;
import com.skua.modules.custom.service.IFReportItemCustomService;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* 运营日报自定义项管理
*/
@Service
public class FReportItemCustomServiceImpl extends ServiceImpl<FReportItemCustomMapper, FReportItemCustom> implements IFReportItemCustomService {
@Autowired
private FReportItemCustomMapper reportItemCustomMapper;
@Override
public List<TreeData> tree(String pid) {
//获取数据列表
QueryWrapper<FReportItemCustom> queryWrapper = new QueryWrapper<FReportItemCustom>();
List<FReportItemCustom> list= reportItemCustomMapper.selectList(queryWrapper);
//将业务数据转换为构造树所需的数据结构
List<TransTreeModel> transTreeModels = list.stream().map(bo -> convertToTreeModel(bo)).collect(Collectors.toList());
if(StringUtils.isEmpty(pid)) {
List<TreeData> treeList=TreeUtils.buildTreeByRootId(transTreeModels, "");
return treeList;
}else {
List<TreeData> treeList=TreeUtils.buildTree(transTreeModels, pid);
return treeList;
}
}
/**
* 将FReportItemCustom对象数据填充到TransTreeModel中
* @param reportItemCustom
* @return
*/
private TransTreeModel convertToTreeModel(FReportItemCustom reportItemCustom) {
TransTreeModel transTreeModel = new TransTreeModel();
transTreeModel.setId(reportItemCustom.getId());
transTreeModel.setPid(reportItemCustom.getPid());
transTreeModel.setTitle(reportItemCustom.getItemName());
Map<String,String> map=new HashMap<String,String>();
//map.put("code", reportItemCustom.getCode());
transTreeModel.setMap(map);
return transTreeModel;
}
}
package com.skua.modules.equip.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.equip.entity.SysElectricDraw;
import com.skua.modules.equip.service.ISysElectricDrawService;
import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 电气图纸配置功能
*/
@Slf4j
@Api(tags="电气图纸配置功能")
@RestController
@RequestMapping("/equip/sysElectricDraw")
public class SysElectricDrawController {
@Autowired
private ISysElectricDrawService sysElectricDrawService;
/**
* 分页列表查询
* @param sysElectricDraw
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "电气图纸配置功能-分页列表查询")
@ApiOperation(value="电气图纸配置功能-分页列表查询", notes="电气图纸配置功能-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SysElectricDraw>> queryPageList(SysElectricDraw sysElectricDraw,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<SysElectricDraw>> result = new Result<IPage<SysElectricDraw>>();
QueryWrapper<SysElectricDraw> queryWrapper = QueryGenerator.initQueryWrapper(sysElectricDraw, req.getParameterMap());
Page<SysElectricDraw> page = new Page<SysElectricDraw>(pageNo, pageSize);
IPage<SysElectricDraw> pageList = sysElectricDrawService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 添加
* @param sysElectricDraw
* @return
*/
@AutoLog(value = "电气图纸配置功能-添加")
@ApiOperation(value="电气图纸配置功能-添加", notes="电气图纸配置功能-添加")
@PostMapping(value = "/add")
public Result<SysElectricDraw> add(@RequestBody SysElectricDraw sysElectricDraw) {
Result<SysElectricDraw> result = new Result<SysElectricDraw>();
try {
sysElectricDrawService.save(sysElectricDraw);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
* @param sysElectricDraw
* @return
*/
@AutoLog(value = "电气图纸配置功能-编辑")
@ApiOperation(value="电气图纸配置功能-编辑", notes="电气图纸配置功能-编辑")
@PutMapping(value = "/edit")
public Result<SysElectricDraw> edit(@RequestBody SysElectricDraw sysElectricDraw) {
Result<SysElectricDraw> result = new Result<SysElectricDraw>();
SysElectricDraw sysElectricDrawEntity = sysElectricDrawService.getById(sysElectricDraw.getId());
if(sysElectricDrawEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = sysElectricDrawService.updateById(sysElectricDraw);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
* @param id
* @return
*/
@AutoLog(value = "电气图纸配置功能-通过id删除")
@ApiOperation(value="电气图纸配置功能-通过id删除", notes="电气图纸配置功能-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
sysElectricDrawService.removeById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@AutoLog(value = "电气图纸配置功能-批量删除")
@ApiOperation(value="电气图纸配置功能-批量删除", notes="电气图纸配置功能-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<SysElectricDraw> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<SysElectricDraw> result = new Result<SysElectricDraw>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.sysElectricDrawService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* 通过id查询
* @param id
* @return
*/
@AutoLog(value = "电气图纸配置功能-通过id查询")
@ApiOperation(value="电气图纸配置功能-通过id查询", notes="电气图纸配置功能-通过id查询")
@GetMapping(value = "/queryById")
public Result<SysElectricDraw> queryById(@RequestParam(name="id",required=true) String id) {
Result<SysElectricDraw> result = new Result<SysElectricDraw>();
SysElectricDraw sysElectricDraw = sysElectricDrawService.getById(id);
if(sysElectricDraw==null) {
result.error500("未找到对应实体");
}else {
result.setResult(sysElectricDraw);
result.setSuccess(true);
}
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SysElectricDraw> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SysElectricDraw sysElectricDraw = JSON.parseObject(deString, SysElectricDraw.class);
queryWrapper = QueryGenerator.initQueryWrapper(sysElectricDraw, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysElectricDraw> pageList = sysElectricDrawService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "电气图纸配置功能列表");
mv.addObject(NormalExcelConstants.CLASS, SysElectricDraw.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("电气图纸配置功能列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@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<SysElectricDraw> listSysElectricDraws = ExcelImportUtil.importExcel(file.getInputStream(), SysElectricDraw.class, params);
sysElectricDrawService.saveBatch(listSysElectricDraws);
return Result.ok("文件导入成功!数据行数:" + listSysElectricDraws.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
@GetMapping(value = "/getByEquipId")
public Result<SysElectricDraw> getByEquipId(String equipId) {
Result<SysElectricDraw> result = new Result<SysElectricDraw>();
try {
SysElectricDraw electricDraw = sysElectricDrawService.getByEquipId(equipId);
result.setResult(electricDraw);
result.success("查询成功!");
} catch (Exception e) {
result.error500("操作失败");
}
return result;
}
}
package com.skua.modules.equip.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 电气图纸配置功能
*/
@Data
@TableName("sys_electric_draw")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="sys_electric_draw对象", description="电气图纸配置功能")
public class SysElectricDraw {
/**主键ID*/
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键ID")
private java.lang.String id;
/**设备ID*/
@Excel(name = "设备ID", width = 15)
@ApiModelProperty(value = "设备ID")
private java.lang.String equipId;
/**配电回路*/
@Excel(name = "配电回路", width = 15)
@ApiModelProperty(value = "配电回路")
private java.lang.String powerCircuit;
/**配电回路图纸*/
@Excel(name = "配电回路图纸", width = 15)
@ApiModelProperty(value = "配电回路图纸")
private java.lang.String powerCircuitCad;
/**控制回路图纸*/
@Excel(name = "控制回路图纸", width = 15)
@ApiModelProperty(value = "控制回路图纸")
private java.lang.String controlCircuitCad;
/**设备面板*/
@Excel(name = "设备面板", width = 15)
@ApiModelProperty(value = "设备面板")
private java.lang.String controlMsg1;
/**PLC面板*/
@Excel(name = "PLC面板", width = 15)
@ApiModelProperty(value = "PLC面板")
private java.lang.String controlMsg2;
/**电路图*/
@Excel(name = "电路图", width = 15)
@ApiModelProperty(value = "电路图")
private java.lang.String controlMsg3;
/**厂区id*/
@Excel(name = "厂区id", width = 15)
@ApiModelProperty(value = "厂区id")
private java.lang.String factoryId;
/**创建人id*/
@Excel(name = "创建人id", width = 15)
@ApiModelProperty(value = "创建人id")
private java.lang.String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**修改人id*/
@Excel(name = "修改人id", width = 15)
@ApiModelProperty(value = "修改人id")
private java.lang.String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private java.util.Date updateTime;
/**所属部门*/
@Excel(name = "所属部门", width = 15)
@ApiModelProperty(value = "所属部门")
private java.lang.String createDept;
/**所属公司*/
@Excel(name = "所属公司", width = 15)
@ApiModelProperty(value = "所属公司")
private java.lang.String createCmpy;
/**删除标识*/
@Excel(name = "删除标识", width = 15)
@ApiModelProperty(value = "删除标识")
private java.lang.Integer delFlag;
}
package com.skua.modules.equip.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.equip.entity.SysElectricDraw;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 电气图纸配置功能
*/
public interface SysElectricDrawMapper extends BaseMapper<SysElectricDraw> {
}
<?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.skua.modules.equip.mapper.SysElectricDrawMapper">
</mapper>
\ No newline at end of file
package com.skua.modules.equip.service;
import com.skua.modules.equip.entity.SysElectricDraw;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 电气图纸配置功能
*/
public interface ISysElectricDrawService extends IService<SysElectricDraw> {
SysElectricDraw getByEquipId(String equipId);
}
package com.skua.modules.equip.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.skua.modules.equip.entity.SysElectricDraw;
import com.skua.modules.equip.entity.SysEquipInfo;
import com.skua.modules.equip.mapper.SysElectricDrawMapper;
import com.skua.modules.equip.service.ISysElectricDrawService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 电气图纸配置功能
*/
@Service
public class SysElectricDrawServiceImpl extends ServiceImpl<SysElectricDrawMapper, SysElectricDraw> implements ISysElectricDrawService {
@Autowired
private SysElectricDrawMapper sysElectricDrawMapper;
@Override
public SysElectricDraw getByEquipId(String equipId) {
SysElectricDraw electricDraw = new SysElectricDraw();
List<SysElectricDraw> list = new ArrayList<>();
LambdaQueryWrapper<SysElectricDraw> queryWrapper = new LambdaQueryWrapper<SysElectricDraw>();
queryWrapper.eq(SysElectricDraw::getEquipId, equipId);
list = sysElectricDrawMapper.selectList(queryWrapper);
if(list.size()>0){
electricDraw = list.get(0);
String[] idArr = electricDraw.getPowerCircuit().split(",");
Map<String,Object> map = new HashMap<>();
for(int i = 0;i < idArr.length;i++){
}
}
return electricDraw;
}
}
package com.skua.modules.monitor.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.monitor.entity.SysMonthData;
import com.skua.modules.monitor.service.ISysMonthDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 月度数据信息管理
*/
@Slf4j
@Api(tags="月度数据信息管理")
@RestController
@RequestMapping("/monitor/sysMonthData")
public class SysMonthDataController {
@Autowired
private ISysMonthDataService sysMonthDataService;
/**
* 分页列表查询
* @param sysMonthData
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "月度数据信息管理-分页列表查询")
@ApiOperation(value="月度数据信息管理-分页列表查询", notes="月度数据信息管理-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SysMonthData>> queryPageList(SysMonthData sysMonthData,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<SysMonthData>> result = new Result<IPage<SysMonthData>>();
QueryWrapper<SysMonthData> queryWrapper = QueryGenerator.initQueryWrapper(sysMonthData, req.getParameterMap());
Page<SysMonthData> page = new Page<SysMonthData>(pageNo, pageSize);
IPage<SysMonthData> pageList = sysMonthDataService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 添加
* @param sysMonthData
* @return
*/
@AutoLog(value = "月度数据信息管理-添加")
@ApiOperation(value="月度数据信息管理-添加", notes="月度数据信息管理-添加")
@PostMapping(value = "/add")
public Result<SysMonthData> add(@RequestBody SysMonthData sysMonthData) {
Result<SysMonthData> result = new Result<SysMonthData>();
try {
sysMonthDataService.save(sysMonthData);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
* @param sysMonthData
* @return
*/
@AutoLog(value = "月度数据信息管理-编辑")
@ApiOperation(value="月度数据信息管理-编辑", notes="月度数据信息管理-编辑")
@PutMapping(value = "/edit")
public Result<SysMonthData> edit(@RequestBody SysMonthData sysMonthData) {
Result<SysMonthData> result = new Result<SysMonthData>();
SysMonthData sysMonthDataEntity = sysMonthDataService.getById(sysMonthData.getId());
if(sysMonthDataEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = sysMonthDataService.updateById(sysMonthData);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
* @param id
* @return
*/
@AutoLog(value = "月度数据信息管理-通过id删除")
@ApiOperation(value="月度数据信息管理-通过id删除", notes="月度数据信息管理-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
sysMonthDataService.removeById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@AutoLog(value = "月度数据信息管理-批量删除")
@ApiOperation(value="月度数据信息管理-批量删除", notes="月度数据信息管理-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<SysMonthData> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<SysMonthData> result = new Result<SysMonthData>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.sysMonthDataService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* 通过id查询
* @param id
* @return
*/
@AutoLog(value = "月度数据信息管理-通过id查询")
@ApiOperation(value="月度数据信息管理-通过id查询", notes="月度数据信息管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<SysMonthData> queryById(@RequestParam(name="id",required=true) String id) {
Result<SysMonthData> result = new Result<SysMonthData>();
SysMonthData sysMonthData = sysMonthDataService.getById(id);
if(sysMonthData==null) {
result.error500("未找到对应实体");
}else {
result.setResult(sysMonthData);
result.setSuccess(true);
}
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SysMonthData> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SysMonthData sysMonthData = JSON.parseObject(deString, SysMonthData.class);
queryWrapper = QueryGenerator.initQueryWrapper(sysMonthData, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysMonthData> pageList = sysMonthDataService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "月度数据信息管理列表");
mv.addObject(NormalExcelConstants.CLASS, SysMonthData.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("月度数据信息管理列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@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<SysMonthData> listSysMonthDatas = ExcelImportUtil.importExcel(file.getInputStream(), SysMonthData.class, params);
sysMonthDataService.saveBatch(listSysMonthDatas);
return Result.ok("文件导入成功!数据行数:" + listSysMonthDatas.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}
package com.skua.modules.monitor.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* 月度数据信息管理
*/
@Data
@TableName("sys_month_data")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="sys_month_data对象", description="月度数据信息管理")
public class SysMonthData {
/**主键id*/
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键id")
private java.lang.String id;
/**月份*/
@Excel(name = "月份", width = 15)
@ApiModelProperty(value = "月份")
private java.lang.String month;
/**处理水量*/
@Excel(name = "处理水量", width = 15)
@ApiModelProperty(value = "处理水量")
private java.lang.String clsl;
/**COD消减量*/
@Excel(name = "COD消减量", width = 15)
@ApiModelProperty(value = "COD消减量")
private java.lang.String codXjl;
/**氨氮消减量*/
@Excel(name = "氨氮消减量", width = 15)
@ApiModelProperty(value = "氨氮消减量")
private java.lang.String adXjl;
/**总磷消减量*/
@Excel(name = "总磷消减量", width = 15)
@ApiModelProperty(value = "总磷消减量")
private java.lang.String tpXjl;
/**总氮消减量*/
@Excel(name = "总氮消减量", width = 15)
@ApiModelProperty(value = "总氮消减量")
private java.lang.String tnXjl;
/**SS消减量*/
@Excel(name = "SS消减量", width = 15)
@ApiModelProperty(value = "SS消减量")
private java.lang.String ssXjl;
/**COD消减率*/
@Excel(name = "COD消减率", width = 15)
@ApiModelProperty(value = "COD消减率")
private java.lang.String codXjlv;
/**氨氮消减率*/
@Excel(name = "氨氮消减率", width = 15)
@ApiModelProperty(value = "氨氮消减率")
private java.lang.String adXjlv;
/**总磷消减率*/
@Excel(name = "总磷消减率", width = 15)
@ApiModelProperty(value = "总磷消减率")
private java.lang.String tpXjlv;
/**总氮消减率*/
@Excel(name = "总氮消减率", width = 15)
@ApiModelProperty(value = "总氮消减率")
private java.lang.String tnXjlv;
/**SS消减率*/
@Excel(name = "SS消减率", width = 15)
@ApiModelProperty(value = "SS消减率")
private java.lang.String ssXjlv;
/**产泥量*/
@Excel(name = "产泥量", width = 15)
@ApiModelProperty(value = "产泥量")
private java.lang.String cnl;
/**含水率*/
@Excel(name = "含水率", width = 15)
@ApiModelProperty(value = "含水率")
private java.lang.String hsl;
/**药费*/
@Excel(name = "药费", width = 15)
@ApiModelProperty(value = "药费")
private java.lang.String yf;
/**耗药量*/
@Excel(name = "耗药量", width = 15)
@ApiModelProperty(value = "耗药量")
private java.lang.String hyl;
/**电费*/
@Excel(name = "电费", width = 15)
@ApiModelProperty(value = "电费")
private java.lang.String df;
/**耗电量*/
@Excel(name = "耗电量", width = 15)
@ApiModelProperty(value = "耗电量")
private java.lang.String hdl;
/**设备完好率*/
@Excel(name = "设备完好率", width = 15)
@ApiModelProperty(value = "设备完好率")
private java.lang.String sbwhl;
/**出水达标率*/
@Excel(name = "出水达标率", width = 15)
@ApiModelProperty(value = "出水达标率")
private java.lang.String csdbl;
/**所属厂区*/
@Excel(name = "所属厂区", width = 15)
@ApiModelProperty(value = "所属厂区")
private java.lang.String factoryId;
/**创建人Id*/
@Excel(name = "创建人Id", width = 15)
@ApiModelProperty(value = "创建人Id")
private java.lang.String createBy;
/**创建时间*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**修改人Id*/
@Excel(name = "修改人Id", width = 15)
@ApiModelProperty(value = "修改人Id")
private java.lang.String updateBy;
/**修改时间*/
@Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private java.util.Date updateTime;
/**所属部门*/
@Excel(name = "所属部门", width = 15)
@ApiModelProperty(value = "所属部门")
private java.lang.String createDept;
/**所属公司*/
@Excel(name = "所属公司", width = 15)
@ApiModelProperty(value = "所属公司")
private java.lang.String createCmpy;
/**删除标识,1有效,0删除*/
@Excel(name = "删除标识,1有效,0删除", width = 15)
@ApiModelProperty(value = "删除标识,1有效,0删除")
private java.lang.Integer delFlag;
}
package com.skua.modules.monitor.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.monitor.entity.SysMonthData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 月度数据信息管理
*/
public interface SysMonthDataMapper extends BaseMapper<SysMonthData> {
SysMonthData getConfigInfoByMonth(@Param("factoryId") String factoryId, @Param("month") String month);
List<SysMonthData> getDataByYear(@Param("factoryId") String factoryId, @Param("year") String year);
}
<?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.skua.modules.monitor.mapper.SysMonthDataMapper">
<select id="getConfigInfoByMonth" resultType="com.skua.modules.monitor.entity.SysMonthData">
select * from sys_month_data
where factory_id = #{factoryId} and month = #{month} and del_flag = 0
limit 1
</select>
<select id="getDataByYear" resultType="com.skua.modules.monitor.entity.SysMonthData">
select * from sys_month_data
where factory_id = #{factoryId} and month like concat(#{year}, '%') and del_flag = 0
order by `month`
</select>
</mapper>
\ No newline at end of file
package com.skua.modules.monitor.service;
import com.skua.modules.monitor.entity.SysMonthData;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.system.vo.ResultDataVO;
import com.skua.modules.system.vo.ResultXjlDataVO;
import java.util.List;
import java.util.Map;
/**
* 月度数据信息管理
*/
public interface ISysMonthDataService extends IService<SysMonthData> {
SysMonthData getConfigInfo(String factoryId, String month);
List<ResultXjlDataVO> getMonthlyDataPollutant(String factoryId, String month);
Map<String, Object> getMonthlyDataUseMedical(String factoryId, String month);
Map<String, Object> getMonthlyDataUseElectricity(String factoryId, String month);
Map<String, Object> getMonthlyDataMadeMud(String factoryId, String month);
List<ResultDataVO> getMonthlyDataTotal(String factoryId, String month);
Map<String, Object> getDigitalSignageData(String factoryId, String structId);
}
package com.skua.modules.system.controller;
import java.util.*;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.system.entity.SysAppDownload;
import com.skua.modules.system.service.ISysAppDownloadService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* APP下载
*/
@Slf4j
@Api(tags="APP下载")
@RestController
@RequestMapping("/system/sysAppDownload")
public class SysAppDownloadController {
@Autowired
private ISysAppDownloadService sysAppDownloadService;
/**
* 分页列表查询
* @param sysAppDownload
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "APP下载-分页列表查询")
@ApiOperation(value="APP下载-分页列表查询", notes="APP下载-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<SysAppDownload>> queryPageList(SysAppDownload sysAppDownload,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<SysAppDownload>> result = new Result<IPage<SysAppDownload>>();
QueryWrapper<SysAppDownload> queryWrapper = QueryGenerator.initQueryWrapper(sysAppDownload, req.getParameterMap());
queryWrapper.eq("org_id", BaseContextHandler.getOrgCode());
queryWrapper.eq("is_used", 0);
Page<SysAppDownload> page = new Page<SysAppDownload>(pageNo, pageSize);
IPage<SysAppDownload> pageList = sysAppDownloadService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 添加
* @param sysAppDownload
* @return
*/
@AutoLog(value = "APP下载-添加")
@ApiOperation(value="APP下载-添加", notes="APP下载-添加")
@PostMapping(value = "/add")
public Result<SysAppDownload> add(@RequestBody SysAppDownload sysAppDownload) {
Result<SysAppDownload> result = new Result<SysAppDownload>();
try {
sysAppDownloadService.save(sysAppDownload);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
result.error500("操作失败");
}
return result;
}
/**
* 编辑
* @param sysAppDownload
* @return
*/
@AutoLog(value = "APP下载-编辑")
@ApiOperation(value="APP下载-编辑", notes="APP下载-编辑")
@PutMapping(value = "/edit")
public Result<SysAppDownload> edit(@RequestBody SysAppDownload sysAppDownload) {
Result<SysAppDownload> result = new Result<SysAppDownload>();
SysAppDownload sysAppDownloadEntity = sysAppDownloadService.getById(sysAppDownload.getId());
if(sysAppDownloadEntity==null) {
result.error500("未找到对应实体");
}else {
boolean ok = sysAppDownloadService.updateById(sysAppDownload);
//TODO 返回false说明什么?
if(ok) {
result.success("修改成功!");
}
}
return result;
}
/**
* 通过id删除
* @param id
* @return
*/
@AutoLog(value = "APP下载-通过id删除")
@ApiOperation(value="APP下载-通过id删除", notes="APP下载-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
sysAppDownloadService.removeById(id);
} catch (Exception e) {
log.error("删除失败",e.getMessage());
return Result.error("删除失败!");
}
return Result.ok("删除成功!");
}
/**
* 批量删除
* @param ids
* @return
*/
@AutoLog(value = "APP下载-批量删除")
@ApiOperation(value="APP下载-批量删除", notes="APP下载-批量删除")
@DeleteMapping(value = "/deleteBatch")
public Result<SysAppDownload> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
Result<SysAppDownload> result = new Result<SysAppDownload>();
if(ids==null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
this.sysAppDownloadService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
return result;
}
/**
* 通过id查询
* @param id
* @return
*/
@AutoLog(value = "APP下载-通过id查询")
@ApiOperation(value="APP下载-通过id查询", notes="APP下载-通过id查询")
@GetMapping(value = "/queryById")
public Result<SysAppDownload> queryById(@RequestParam(name="id",required=true) String id) {
Result<SysAppDownload> result = new Result<SysAppDownload>();
SysAppDownload sysAppDownload = sysAppDownloadService.getById(id);
if(sysAppDownload==null) {
result.error500("未找到对应实体");
}else {
result.setResult(sysAppDownload);
result.setSuccess(true);
}
return result;
}
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
QueryWrapper<SysAppDownload> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (ConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SysAppDownload sysAppDownload = JSON.parseObject(deString, SysAppDownload.class);
queryWrapper = QueryGenerator.initQueryWrapper(sysAppDownload, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SysAppDownload> pageList = sysAppDownloadService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "APP下载列表");
mv.addObject(NormalExcelConstants.CLASS, SysAppDownload.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("APP下载列表数据", "导出人:", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
return mv;
}
/**
* 通过excel导入数据
*
* @param request
* @param response
* @return
*/
@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<SysAppDownload> list = new ArrayList<>();
List<SysAppDownload> listSysAppDownloads = ExcelImportUtil.importExcel(file.getInputStream(), SysAppDownload.class, params);
for (int i = 0; i < listSysAppDownloads.size(); i++) {
SysAppDownload sysAppDownload = listSysAppDownloads.get(i);
sysAppDownload.setOrgId(BaseContextHandler.getOrgCode());
sysAppDownload.setIsUsed(0);
list.add(sysAppDownload);
}
sysAppDownloadService.saveBatch(list);
return Result.ok("文件导入成功!数据行数:" + listSysAppDownloads.size());
} catch (Exception e) {
log.error(e.getMessage(),e);
return Result.error("文件导入失败:"+e.getMessage());
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
@AutoLog(value = "获取安卓APP下载二维码")
@ApiOperation(value="获取安卓APP下载二维码", notes="获取安卓APP下载二维码")
@GetMapping(value = "/getAndroidQRCode")
public Result<SysAppDownload> getAndroidQRCode() {
Result<SysAppDownload> result = new Result<SysAppDownload>();
SysAppDownload sysAppDownload = new SysAppDownload();
sysAppDownload = sysAppDownloadService.getAndroidQRCode();
if(sysAppDownload!=null){
result.setSuccess(true);
result.setResult(sysAppDownload);
}else{
result.setSuccess(false);
}
return result;
}
@AutoLog(value = "获取苹果APP下载二维码")
@ApiOperation(value="获取苹果APP下载二维码", notes="获取苹果APP下载二维码")
@GetMapping(value = "/getIOSQRCode")
public Result<SysAppDownload> getIOSQRCode() {
Result<SysAppDownload> result = new Result<SysAppDownload>();
SysAppDownload sysAppDownload = new SysAppDownload();
sysAppDownload = sysAppDownloadService.getIOSQRCode();
if(sysAppDownload!=null){
result.setSuccess(true);
result.setResult(sysAppDownload);
}else{
result.setSuccess(false);
}
return result;
}
}
......@@ -47,9 +47,6 @@ import lombok.extern.slf4j.Slf4j;
/**
* <p>
* 字典表 前端控制器
* </p>
*
* @Author zhangweijian
* @since 2018-12-28
*/
@Api(tags="数据字典")
......@@ -416,48 +413,4 @@ public class SysDictController {
result.setResult(ls);
return result;
}
@AutoLog(value = "廊坊药剂数据字典")
@ApiOperation(value = "廊坊药剂数据字典", notes = "廊坊药剂数据字典")
@GetMapping(value = "/leadmedict")
public Result<Map<String, Object>> leadmedict() {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> resMap = new LinkedHashMap<>();
List<SysDictItem> itemList = sysDictItemService.list(new QueryWrapper<SysDictItem>().eq("dict_id","df239b44161f9206803ca8901a63feef"));
SysDictItem thisItem = new SysDictItem();
List<Map<String,String>> item = new ArrayList<>();
for(int i=0;i<itemList.size();i++){
thisItem = itemList.get(i);
HashMap<String,String> map = new HashMap<>();
map.put("name",thisItem.getItemText());
map.put("value",thisItem.getItemValue());
item.add(map);
}
resMap.put("dictList",item.toArray());
result.setResult(resMap);
result.setSuccess(true);
return result;
}
@AutoLog(value = "廊坊数据字典")
@ApiOperation(value = "廊坊数据字典", notes = "廊坊数据字典")
@GetMapping(value = "/leaddict")
public Result<Map<String, Object>> leaddict( @RequestParam(name="dictId") String dictId) {
Result<Map<String, Object>> result = new Result<Map<String, Object>>();
Map<String, Object> resMap = new LinkedHashMap<>();
// 电耗类别 524e55c7b2ec9a33f9c0e4016b9afe6f
List<SysDictItem> itemList = sysDictItemService.list(new QueryWrapper<SysDictItem>().eq("dict_id",dictId));
SysDictItem thisItem = new SysDictItem();
List<Map<String,String>> item = new ArrayList<>();
for(int i=0;i<itemList.size();i++){
thisItem = itemList.get(i);
HashMap<String,String> map = new HashMap<>();
map.put("name",thisItem.getItemText());
map.put("value",thisItem.getItemValue());
item.add(map);
}
resMap.put("dictList",item.toArray());
result.setResult(resMap);
result.setSuccess(true);
return result;
}
}
......
package com.skua.modules.system.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
/**
* APP下载
*/
@Data
@TableName("sys_app_download")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="sys_app_download对象", description="APP下载")
public class SysAppDownload {
/**主键*/
@TableId(type = IdType.UUID)
@ApiModelProperty(value = "主键")
private java.lang.String id;
/**集团ID*/
@ApiModelProperty(value = "集团ID")
private java.lang.String orgId;
/**APP类型*/
@Excel(name = "类型", width = 15)
@ApiModelProperty(value = "APP类型")
private java.lang.String appType;
/**兑换码地址*/
@Excel(name = "兑换码地址", width = 15)
@ApiModelProperty(value = "兑换码地址")
private java.lang.String appUrl;
/**是否被使用*/
@ApiModelProperty(value = "是否被使用")
private java.lang.Integer isUsed;
/**创建人员*/
@ApiModelProperty(value = "创建人员")
private java.lang.String createBy;
/**创建时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**修改人员*/
@ApiModelProperty(value = "修改人员")
private java.lang.String updateBy;
/**修改时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "修改时间")
private java.util.Date updateTime;
/**创建机构*/
@ApiModelProperty(value = "创建机构")
private java.lang.String createDept;
/**创建集团*/
@ApiModelProperty(value = "创建集团")
private java.lang.String createCmpy;
/**标识*/
@ApiModelProperty(value = "标识")
private java.lang.Integer delFlag;
}
package com.skua.modules.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.skua.modules.system.entity.SysAppDownload;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* APP下载
*/
public interface SysAppDownloadMapper extends BaseMapper<SysAppDownload> {
List<SysAppDownload> getAndroidQRCode();
List<SysAppDownload> getIOSQRCode();
}
<?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.skua.modules.system.mapper.SysAppDownloadMapper">
<select id="getAndroidQRCode" resultType="com.skua.modules.system.entity.SysAppDownload">
select * from sys_app_download
where app_type = 'android' limit 1
</select>
<select id="getIOSQRCode" resultType="com.skua.modules.system.entity.SysAppDownload">
select * from sys_app_download
where app_type = 'ios' and is_used = 0 limit 1
</select>
</mapper>
package com.skua.modules.system.service;
import com.skua.modules.system.entity.SysAppDownload;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
/**
* APP下载
*/
public interface ISysAppDownloadService extends IService<SysAppDownload> {
SysAppDownload getAndroidQRCode();
SysAppDownload getIOSQRCode();
}
package com.skua.modules.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.system.entity.SysAppDownload;
import com.skua.modules.system.entity.SysArea;
public interface ISysAreaService extends IService<SysArea> {
......
package com.skua.modules.system.service.impl;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.util.zxing.QRCodeUtil;
import com.skua.modules.system.entity.SysAppDownload;
import com.skua.modules.system.mapper.SysAppDownloadMapper;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.modules.system.service.ISysAppDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* APP下载
*/
@Service
public class SysAppDownloadServiceImpl extends ServiceImpl<SysAppDownloadMapper, SysAppDownload> implements ISysAppDownloadService {
@Autowired
private SysAppDownloadMapper sysAppDownloadMapper;
@Value("${skua.path.upload}")
private String uploadpath;
/**
* 安卓二维码
* @return
*/
@Override
public SysAppDownload getAndroidQRCode() {
List<SysAppDownload> list = new ArrayList<>();
list = sysAppDownloadMapper.getAndroidQRCode();
if(list.size() == 1){
SysAppDownload sysAppDownload = changeURLtoQR(list.get(0));
return sysAppDownload;
}else{
return null;
}
}
/**
* 苹果二维码
* @return
*/
@Override
public SysAppDownload getIOSQRCode() {
List<SysAppDownload> list = new ArrayList<>();
list = sysAppDownloadMapper.getIOSQRCode();
if(list.size() == 1){
SysAppDownload oldAppDownload = list.get(0);
//将二维码标记为已使用
oldAppDownload.setIsUsed(1);
sysAppDownloadMapper.updateById(oldAppDownload);
//返回二维码
SysAppDownload sysAppDownload = changeURLtoQR(list.get(0));
return sysAppDownload;
}else{
return null;
}
}
/**
* url转换为二维码
* @param sysAppDownload
* @return
*/
private SysAppDownload changeURLtoQR(SysAppDownload sysAppDownload) {
String qrCodePath = "files"+ File.separator+"qrcode"+File.separator+sysAppDownload.getId()+".png";
try {
QRCodeUtil.encode(sysAppDownload.getAppUrl(), "", uploadpath+File.separator+qrCodePath, true);
sysAppDownload.setAppUrl(qrCodePath);
} catch (Exception e) {
sysAppDownload.setAppUrl("");
}
return sysAppDownload;
}
}
......@@ -43,7 +43,6 @@ import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService
import com.skua.modules.system.datestandard.service.ISysStructDictService;
import com.skua.modules.system.entity.SysAnnouncement;
import com.skua.modules.system.entity.SysAnnouncementSend;
import com.skua.modules.system.entity.SysAppDownload;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.entity.SysDict;
import com.skua.modules.system.entity.SysFactoryInfo;
......@@ -54,7 +53,6 @@ import com.skua.modules.system.entity.SysUser;
import com.skua.modules.system.entity.SysUserDepart;
import com.skua.modules.system.mapper.SysAnnouncementMapper;
import com.skua.modules.system.mapper.SysAnnouncementSendMapper;
import com.skua.modules.system.mapper.SysAppDownloadMapper;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.modules.system.mapper.SysPermissionMapper;
import com.skua.modules.system.mapper.SysRoleMapper;
......@@ -110,8 +108,6 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Autowired
private ISysMonitorManageService iSysMonitorManageService;
@Autowired
private SysAppDownloadMapper sysAppDownloadMapper;
@Autowired
private SysRolePermissionMapper sysRolePermissionMapper;
@Autowired
private ISequenceService sequenceService;
......@@ -494,19 +490,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
@Override
public Map<String, Object> getIOSAppDownLoad() {
Map<String, Object> map = new HashMap<>();
List<SysAppDownload> list = new ArrayList<>();
list = sysAppDownloadMapper.getIOSQRCode();
if(list.size() == 1){
SysAppDownload oldAppDownload = list.get(0);
//将二维码标记为已使用
oldAppDownload.setIsUsed(1);
sysAppDownloadMapper.updateById(oldAppDownload);
map.put("qrcode",oldAppDownload.getAppUrl());
}else{
map.put("qrcode","");
}
return map;
return new HashMap<>();
}
@Override
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!