三江-形象进度接口

This commit is contained in:
Administrator 2023-04-12 10:00:47 +08:00
parent 9c8318eb4e
commit f295a4fea8
9 changed files with 450 additions and 6 deletions

View File

@ -32,6 +32,6 @@ public class RundeGroupServiceImpl extends ServiceImpl<RundeGroupMapper, RundeGr
sumNumber += Optional.ofNullable(rundeGroup.getSunNumber()).orElse(0);
onlineNumber += Optional.ofNullable(rundeGroup.getOnlineNumber()).orElse(0);
}
return new SumAndOnlineNumberVO(sumNumber, onlineNumber, sumNumber == 0 ? sumNumber : NumberUtil.div(NumberUtil.mul(onlineNumber, 100f), sumNumber, 2));
return new SumAndOnlineNumberVO(sumNumber, onlineNumber, sumNumber == 0 ? sumNumber : NumberUtil.div(onlineNumber, sumNumber, 4));
}
}

View File

@ -0,0 +1,274 @@
package com.zhgd.xmgl.modules.sanjiang.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
import com.zhgd.xmgl.modules.sanjiang.service.ISjImageProgressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
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 javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Title: Controller
* @Description: 三江形象进度
* @author pds
* @date 2023-04-12
* @version V1.0
*/
@RestController
@RequestMapping("/xmgl/sjImageProgress")
@Slf4j
@Api(tags = "sjImageProgressController相关Api")
public class SjImageProgressController {
@Autowired
private ISjImageProgressService sjImageProgressService;
/**
* 分页列表查询
*
* @param sjImageProgress
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value = " 分页列表查询三江形象进度信息", notes = "分页列表查询三江形象进度信息", httpMethod = "GET")
@GetMapping(value = "/page")
public Result<IPage<SjImageProgress>> queryPageList(SjImageProgress sjImageProgress,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
Result<IPage<SjImageProgress>> result = new Result<IPage<SjImageProgress>>();
QueryWrapper<SjImageProgress> queryWrapper = QueryGenerator.initQueryWrapper(sjImageProgress, req.getParameterMap());
Page<SjImageProgress> page = new Page<SjImageProgress>(pageNo, pageSize);
IPage<SjImageProgress> pageList = sjImageProgressService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
/**
* 列表查询
*
* @param sjImageProgress
* @param pageNo 页码
* @param pageSize 条数
* @param req
* @return
*/
@ApiOperation(value = " 列表查询三江形象进度信息", notes = "列表查询三江形象进度信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<List<SjImageProgress>> queryList(SjImageProgress sjImageProgress,
HttpServletRequest req) {
QueryWrapper<SjImageProgress> queryWrapper = QueryGenerator.initQueryWrapper(sjImageProgress, req.getParameterMap());
return Result.success(sjImageProgressService.list(queryWrapper));
}
/**
* 添加
*
* @param sjImageProgress
* @return
*/
@ApiOperation(value = " 添加三江形象进度信息", notes = "添加三江形象进度信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<SjImageProgress> add(@RequestBody SjImageProgress sjImageProgress) {
Result<SjImageProgress> result = new Result<SjImageProgress>();
try {
sjImageProgressService.save(sjImageProgress);
Result.success("添加成功!");
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
result.error500("操作失败");
}
return result;
}
/**
* 编辑
*
* @param sjImageProgress
* @return
*/
@ApiOperation(value = "编辑三江形象进度信息", notes = "编辑三江形象进度信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<SjImageProgress> edit(@RequestBody SjImageProgress sjImageProgress) {
Result<SjImageProgress> result = new Result<SjImageProgress>();
SjImageProgress sjImageProgressEntity = sjImageProgressService.getById(sjImageProgress.getId());
if (sjImageProgressEntity == null) {
result.error500("未找到对应实体");
} else {
sjImageProgressService.updateById(sjImageProgress);
Result.success("修改成功!");
}
return result;
}
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "删除三江形象进度信息", notes = "删除三江形象进度信息", httpMethod = "POST")
@PostMapping(value = "/delete")
public Result<SjImageProgress> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<SjImageProgress> result = new Result<SjImageProgress>();
SjImageProgress sjImageProgress = sjImageProgressService.getById(id);
if (sjImageProgress == null) {
result.error500("未找到对应实体");
} else {
boolean ok = sjImageProgressService.removeById(id);
if (ok) {
Result.success("删除成功!");
}
}
return result;
}
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "批量删除三江形象进度信息", notes = "批量删除三江形象进度信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "三江形象进度ID字符串", paramType = "query", required = true, dataType = "String")
@PostMapping(value = "/deleteBatch")
public Result<SjImageProgress> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
Result<SjImageProgress> result = new Result<SjImageProgress>();
if (ids == null || "".equals(ids.trim())) {
result.error500("参数不识别!");
} else {
this.sjImageProgressService.removeByIds(Arrays.asList(ids.split(",")));
Result.success("删除成功!");
}
return result;
}
/**
* 通过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<SjImageProgress> queryById(@RequestParam(name = "id", required = true) String id) {
Result<SjImageProgress> result = new Result<SjImageProgress>();
SjImageProgress sjImageProgress = sjImageProgressService.getById(id);
if (sjImageProgress == null) {
result.error500("未找到对应实体");
} else {
result.setResult(sjImageProgress);
result.setSuccess(true);
}
return result;
}
/**
* 导出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<SjImageProgress> queryWrapper = null;
try {
String paramsStr = request.getParameter("paramsStr");
if (oConvertUtils.isNotEmpty(paramsStr)) {
String deString = URLDecoder.decode(paramsStr, "UTF-8");
SjImageProgress sjImageProgress = JSON.parseObject(deString, SjImageProgress.class);
queryWrapper = QueryGenerator.initQueryWrapper(sjImageProgress, request.getParameterMap());
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<SjImageProgress> pageList = sjImageProgressService.list(queryWrapper);
//导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "三江形象进度列表");
mv.addObject(NormalExcelConstants.CLASS, SjImageProgress.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("三江形象进度列表数据", "导出人:Jeecg", "导出信息"));
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<SjImageProgress> listsjImageProgressses = ExcelImportUtil.importExcel(file.getInputStream(), SjImageProgress.class, params);
for (SjImageProgress sjImageProgressExcel : listsjImageProgressses) {
sjImageProgressService.save(sjImageProgressExcel);
}
return Result.ok("文件导入成功!数据行数:" + listsjImageProgressses.size());
} catch (Exception e) {
log.error(e.getMessage());
return Result.error("文件导入失败!");
} finally {
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return Result.ok("文件导入失败!");
}
}

View File

@ -0,0 +1,117 @@
package com.zhgd.xmgl.modules.sanjiang.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 三江形象进度
* @author pds
* @date 2023-04-12
* @version V1.0
*/
@Data
@TableName("sj_image_progress")
@ApiModel(value = "sjImageProgress实体类", description = "SjImageProgress")
public class SjImageProgress implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value = "主键id")
private java.lang.Long id;
/**
* 经办人
*/
@Excel(name = "经办人", width = 15)
@ApiModelProperty(value = "经办人")
private java.lang.String operator;
/**
* 经办时间
*/
@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 processingTime;
/**
* 上报单位
*/
@Excel(name = "上报单位", width = 15)
@ApiModelProperty(value = "上报单位")
private java.lang.String reportingUnit;
/**
* 项目编号
*/
@Excel(name = "项目编号", width = 15)
@ApiModelProperty(value = "项目编号")
private java.lang.String projectNumber;
/**
* 项目进度
*/
@Excel(name = "项目进度", width = 15)
@ApiModelProperty(value = "项目进度")
private java.lang.Integer projectProgress;
/**
* 项目名称
*/
@Excel(name = "项目名称", width = 15)
@ApiModelProperty(value = "项目名称")
private java.lang.String projectName;
/**
* 当前形象进度
*/
@Excel(name = "当前形象进度", width = 15)
@ApiModelProperty(value = "当前形象进度")
private java.lang.String currentImageProgress;
/**
* 存在主要困难和问题
*/
@Excel(name = "存在主要困难和问题", width = 15)
@ApiModelProperty(value = "存在主要困难和问题")
private java.lang.String majorDifficultyAndProblem;
/**
* 需协调解决主要事项
*/
@Excel(name = "需协调解决主要事项", width = 15)
@ApiModelProperty(value = "需协调解决主要事项")
private java.lang.String majorMatter;
/**
* 附件url多个分隔
*/
@Excel(name = "附件url多个分隔", width = 15)
@ApiModelProperty(value = "附件url多个分隔")
private java.lang.String attachmentUrl;
/**
* 项目sn
*/
@Excel(name = "项目sn", width = 15)
@ApiModelProperty(value = "项目sn")
private java.lang.String projectSn;
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**
* 更新时间
*/
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private java.util.Date updateTime;
}

View File

@ -0,0 +1,16 @@
package com.zhgd.xmgl.modules.sanjiang.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
import org.apache.ibatis.annotations.Mapper;
/**
* @Description: 三江形象进度
* @author pds
* @date 2023-04-12
* @version V1.0
*/
@Mapper
public interface SjImageProgressMapper extends BaseMapper<SjImageProgress> {
}

View File

@ -0,0 +1,5 @@
<?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.xxx.mapper.sjImageProgressMapper">
</mapper>

View File

@ -0,0 +1,14 @@
package com.zhgd.xmgl.modules.sanjiang.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
/**
* @Description: 三江形象进度
* @author pds
* @date 2023-04-12
* @version V1.0
*/
public interface ISjImageProgressService extends IService<SjImageProgress> {
}

View File

@ -0,0 +1,18 @@
package com.zhgd.xmgl.modules.sanjiang.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.modules.sanjiang.entity.SjImageProgress;
import com.zhgd.xmgl.modules.sanjiang.mapper.SjImageProgressMapper;
import com.zhgd.xmgl.modules.sanjiang.service.ISjImageProgressService;
import org.springframework.stereotype.Service;
/**
* @Description: 三江形象进度
* @author pds
* @date 2023-04-12
* @version V1.0
*/
@Service
public class SjImageProgressServiceImpl extends ServiceImpl<SjImageProgressMapper, SjImageProgress> implements ISjImageProgressService {
}

View File

@ -1,11 +1,11 @@
#mysql
diver_name=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/wisdomsite?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url=jdbc:mysql://127.0.0.1:3306/wisdomsite_sj?useUnicode=true&characterEncoding=UTF-8&useSSL=false
#url=jdbc:mysql://127.0.0.1:3306/itbgp_bank?useUnicode=true&characterEncoding=UTF-8
#url=jdbc:mysql://139.9.66.234:3306/dev_manage?useUnicode=true&characterEncoding=UTF-8
username=root
password=root
database_name=wisdomsite
database_name=wisdomsite_sj
#database_name=dev_manage
#oracle