diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/controller/QualityInspectionRecordController.java b/src/main/java/com/zhgd/xmgl/modules/quality/controller/QualityInspectionRecordController.java index d5fe994b0..f684c88db 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/controller/QualityInspectionRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/quality/controller/QualityInspectionRecordController.java @@ -4,9 +4,11 @@ import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; +import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndTodayDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndWeekDataVO; +import com.zhgd.xmgl.modules.quality.entity.vo.DepartmentRectifiedRankVo; import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService; import com.zhgd.xmgl.util.MessageUtil; import io.swagger.annotations.Api; @@ -16,6 +18,7 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.MapUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -256,4 +259,10 @@ public class QualityInspectionRecordController { public Result> selectPersonChargeQualityInspectionCountList(@RequestBody Map map) { return Result.success(qualityInspectionRecordService.selectPersonChargeQualityInspectionCountList(map)); } + + @ApiOperation(value = "PC端按部门进行整改排名(已整改数量)", notes = "PC端按部门进行整改排名(已整改数量)", httpMethod = "GET") + @GetMapping(value = "/department/rectified/rank") + public Result> getDepartmentRectifiedRank(@Validated DepartmentRectifiedRankDto rectifiedRank) { + return qualityInspectionRecordService.getDepartmentRectifiedRank(rectifiedRank); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/entity/dto/DepartmentRectifiedRankDto.java b/src/main/java/com/zhgd/xmgl/modules/quality/entity/dto/DepartmentRectifiedRankDto.java new file mode 100644 index 000000000..9307e7310 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/quality/entity/dto/DepartmentRectifiedRankDto.java @@ -0,0 +1,15 @@ +package com.zhgd.xmgl.modules.quality.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +@ApiModel(value = "DepartmentRectifiedRankDto") +public class DepartmentRectifiedRankDto { + @ApiModelProperty(value = "项目sn") + @NotBlank + private String projectSn; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/entity/vo/DepartmentRectifiedRankVo.java b/src/main/java/com/zhgd/xmgl/modules/quality/entity/vo/DepartmentRectifiedRankVo.java new file mode 100644 index 000000000..ad2beabce --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/quality/entity/vo/DepartmentRectifiedRankVo.java @@ -0,0 +1,15 @@ +package com.zhgd.xmgl.modules.quality.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(value = "DepartmentRectifiedRankVo") +public class DepartmentRectifiedRankVo { + + @ApiModelProperty(value = "部门名称") + private java.lang.String departmentName; + @ApiModelProperty(value = "已整改数量") + private Integer rectifiedNumber; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/QualityInspectionRecordMapper.java b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/QualityInspectionRecordMapper.java index e92d20b7a..6d05fa33c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/QualityInspectionRecordMapper.java +++ b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/QualityInspectionRecordMapper.java @@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; +import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndTodayDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndWeekDataVO; +import com.zhgd.xmgl.modules.quality.entity.vo.DepartmentRectifiedRankVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -43,4 +45,6 @@ public interface QualityInspectionRecordMapper extends BaseMapper getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank); } diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml index 3a8076ba9..7662a6ef1 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/quality/mapper/xml/QualityInspectionRecordMapper.xml @@ -116,17 +116,19 @@ - \ No newline at end of file + + diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/service/IQualityInspectionRecordService.java b/src/main/java/com/zhgd/xmgl/modules/quality/service/IQualityInspectionRecordService.java index b3380f974..783f9511a 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/service/IQualityInspectionRecordService.java +++ b/src/main/java/com/zhgd/xmgl/modules/quality/service/IQualityInspectionRecordService.java @@ -1,11 +1,14 @@ package com.zhgd.xmgl.modules.quality.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; +import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndTodayDataVO; import com.zhgd.xmgl.modules.quality.entity.vo.AllAndWeekDataVO; +import com.zhgd.xmgl.modules.quality.entity.vo.DepartmentRectifiedRankVo; import javax.servlet.http.HttpServletResponse; import java.util.List; @@ -44,4 +47,6 @@ public interface IQualityInspectionRecordService extends IService limitListBySubdivision(String projectSn, Long subsectionId, Long subentryId, Integer size); + + Result> getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank); } diff --git a/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java index 67ae7ba95..a5f25c813 100644 --- a/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/quality/service/impl/QualityInspectionRecordServiceImpl.java @@ -7,15 +7,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.jeecg.common.mybatis.EntityMap; import com.zhgd.xmgl.call.SanjiangDataCall; import com.zhgd.xmgl.modules.basicdata.service.INoticeService; import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord; import com.zhgd.xmgl.modules.quality.entity.QualityRectifyRecord; -import com.zhgd.xmgl.modules.quality.entity.vo.AllAndThisWeekDataVO; -import com.zhgd.xmgl.modules.quality.entity.vo.AllAndTodayDataVO; -import com.zhgd.xmgl.modules.quality.entity.vo.AllAndWeekDataVO; -import com.zhgd.xmgl.modules.quality.entity.vo.AllDataVO; +import com.zhgd.xmgl.modules.quality.entity.dto.DepartmentRectifiedRankDto; +import com.zhgd.xmgl.modules.quality.entity.vo.*; import com.zhgd.xmgl.modules.quality.mapper.QualityInspectionRecordMapper; import com.zhgd.xmgl.modules.quality.mapper.QualityRectifyRecordMapper; import com.zhgd.xmgl.modules.quality.service.IQualityInspectionRecordService; @@ -243,6 +242,12 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl(1, size), wrapper).getRecords(); } + @Override + public Result> getDepartmentRectifiedRank(DepartmentRectifiedRankDto rectifiedRank) { + List voList = qualityInspectionRecordMapper.getDepartmentRectifiedRank(rectifiedRank); + return Result.success(voList); + } + private void setWeekRatioData(AllAndWeekDataVO allAndWeekDataVO) { long weekClose = allAndWeekDataVO.getWeekClose(); long weekNoClose = allAndWeekDataVO.getWeekNoClose(); diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileController.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileController.java new file mode 100644 index 000000000..3b4d8da42 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileController.java @@ -0,0 +1,276 @@ +package com.zhgd.xmgl.modules.sanjiang.controller; + +import com.alibaba.fastjson.JSONObject; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFile; +import com.zhgd.xmgl.modules.sanjiang.service.ISjSafeEnvironmentFileService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; + + +/** + * @Title: Controller + * @Description: 三江安全环保资料中心 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/sjSafeEnvironmentFile") +@Slf4j +@Api(tags = "三江安全环保资料中心Controller") +public class SjSafeEnvironmentFileController { + @Autowired + private ISjSafeEnvironmentFileService sjSafeEnvironmentFileService; + + /** + * 分页列表查询 + * + * @param sjSafeEnvironmentFile + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = " 分页列表查询三江安全环保资料中心信息", notes = "分页列表查询三江安全环保资料中心信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(SjSafeEnvironmentFile sjSafeEnvironmentFile, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFile, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = sjSafeEnvironmentFileService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 列表查询 + * + * @param sjSafeEnvironmentFile + * @param req + * @return + */ + @ApiOperation(value = " 列表查询三江安全环保资料中心信息", notes = "列表查询三江安全环保资料中心信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(SjSafeEnvironmentFile sjSafeEnvironmentFile, + HttpServletRequest req) { + + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFile, req.getParameterMap()); + return Result.success(sjSafeEnvironmentFileService.list(queryWrapper)); + } + + /** + * 添加 + * + * @param sjSafeEnvironmentFile + * @return + */ + @ApiOperation(value = " 添加三江安全环保资料中心信息", notes = "添加三江安全环保资料中心信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody SjSafeEnvironmentFile sjSafeEnvironmentFile) { + Result result = new Result(); + try { + sjSafeEnvironmentFileService.save(sjSafeEnvironmentFile); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑 + * + * @param sjSafeEnvironmentFile + * @return + */ + @ApiOperation(value = "编辑三江安全环保资料中心信息", notes = "编辑三江安全环保资料中心信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SjSafeEnvironmentFile sjSafeEnvironmentFile) { + Result result = new Result(); + SjSafeEnvironmentFile sjSafeEnvironmentFileEntity = sjSafeEnvironmentFileService.getById(sjSafeEnvironmentFile.getId()); + if (sjSafeEnvironmentFileEntity == null) { + result.error500("未找到对应实体"); + } else { + sjSafeEnvironmentFileService.updateById(sjSafeEnvironmentFile); + result.success("修改成功!"); + } + + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除三江安全环保资料中心信息", notes = "删除三江安全环保资料中心信息", httpMethod = "POST") + @PostMapping(value = "/delete") + public Result delete(@RequestBody String id) { + JSONObject jsonObject = JSON.parseObject(id, JSONObject.class); + id = String.valueOf(jsonObject.get("id")); + Result result = new Result(); + SjSafeEnvironmentFile sjSafeEnvironmentFile = sjSafeEnvironmentFileService.getById(id); + if (sjSafeEnvironmentFile == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = sjSafeEnvironmentFileService.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 deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.sjSafeEnvironmentFileService.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 queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + SjSafeEnvironmentFile sjSafeEnvironmentFile = sjSafeEnvironmentFileService.getById(id); + if (sjSafeEnvironmentFile == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(sjSafeEnvironmentFile); + 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 queryWrapper = null; + try { + String paramsStr = request.getParameter("paramsStr"); + if (oConvertUtils.isNotEmpty(paramsStr)) { + String deString = URLDecoder.decode(paramsStr, "UTF-8"); + SjSafeEnvironmentFile sjSafeEnvironmentFile = JSON.parseObject(deString, SjSafeEnvironmentFile.class); + queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFile, request.getParameterMap()); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List pageList = sjSafeEnvironmentFileService.list(queryWrapper); + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "三江安全环保资料中心列表"); + mv.addObject(NormalExcelConstants.CLASS, SjSafeEnvironmentFile.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 fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List listSjSafeEnvironmentFiles = ExcelImportUtil.importExcel(file.getInputStream(), SjSafeEnvironmentFile.class, params); + for (SjSafeEnvironmentFile sjSafeEnvironmentFileExcel : listSjSafeEnvironmentFiles) { + sjSafeEnvironmentFileService.save(sjSafeEnvironmentFileExcel); + } + return Result.ok("文件导入成功!数据行数:" + listSjSafeEnvironmentFiles.size()); + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("文件导入失败!"); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.ok("文件导入失败!"); + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileTypeController.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileTypeController.java new file mode 100644 index 000000000..6f8fcf103 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/controller/SjSafeEnvironmentFileTypeController.java @@ -0,0 +1,276 @@ +package com.zhgd.xmgl.modules.sanjiang.controller; + +import com.alibaba.fastjson.JSONObject; +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFileType; +import com.zhgd.xmgl.modules.sanjiang.service.ISjSafeEnvironmentFileTypeService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.jeecg.common.system.query.QueryGenerator; +import com.zhgd.jeecg.common.util.oConvertUtils; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; + + +/** + * @Title: Controller + * @Description: 三江安全环保资料中心文件类型 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@RestController +@RequestMapping("/xmgl/sjSafeEnvironmentFileType") +@Slf4j +@Api(tags = "SjSafeEnvironmentFileTypeController相关Api") +public class SjSafeEnvironmentFileTypeController { + @Autowired + private ISjSafeEnvironmentFileTypeService sjSafeEnvironmentFileTypeService; + + /** + * 分页列表查询 + * + * @param sjSafeEnvironmentFileType + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @ApiOperation(value = " 分页列表查询三江安全环保资料中心文件类型信息", notes = "分页列表查询三江安全环保资料中心文件类型信息", httpMethod = "GET") + @GetMapping(value = "/page") + public Result> queryPageList(SjSafeEnvironmentFileType sjSafeEnvironmentFileType, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + Result> result = new Result>(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFileType, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = sjSafeEnvironmentFileTypeService.page(page, queryWrapper); + result.setSuccess(true); + result.setResult(pageList); + return result; + } + + /** + * 列表查询 + * + * @param sjSafeEnvironmentFileType + * @param req + * @return + */ + @ApiOperation(value = " 列表查询三江安全环保资料中心文件类型信息", notes = "列表查询三江安全环保资料中心文件类型信息", httpMethod = "GET") + @GetMapping(value = "/list") + public Result> queryList(SjSafeEnvironmentFileType sjSafeEnvironmentFileType, + HttpServletRequest req) { + + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFileType, req.getParameterMap()); + return Result.success(sjSafeEnvironmentFileTypeService.list(queryWrapper)); + } + + /** + * 添加 + * + * @param sjSafeEnvironmentFileType + * @return + */ + @ApiOperation(value = " 添加三江安全环保资料中心文件类型信息", notes = "添加三江安全环保资料中心文件类型信息", httpMethod = "POST") + @PostMapping(value = "/add") + public Result add(@RequestBody SjSafeEnvironmentFileType sjSafeEnvironmentFileType) { + Result result = new Result(); + try { + sjSafeEnvironmentFileTypeService.save(sjSafeEnvironmentFileType); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } + + /** + * 编辑 + * + * @param sjSafeEnvironmentFileType + * @return + */ + @ApiOperation(value = "编辑三江安全环保资料中心文件类型信息", notes = "编辑三江安全环保资料中心文件类型信息", httpMethod = "POST") + @PostMapping(value = "/edit") + public Result edit(@RequestBody SjSafeEnvironmentFileType sjSafeEnvironmentFileType) { + Result result = new Result(); + SjSafeEnvironmentFileType sjSafeEnvironmentFileTypeEntity = sjSafeEnvironmentFileTypeService.getById(sjSafeEnvironmentFileType.getId()); + if (sjSafeEnvironmentFileTypeEntity == null) { + result.error500("未找到对应实体"); + } else { + sjSafeEnvironmentFileTypeService.updateById(sjSafeEnvironmentFileType); + result.success("修改成功!"); + } + + return result; + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @ApiOperation(value = "删除三江安全环保资料中心文件类型信息", notes = "删除三江安全环保资料中心文件类型信息", httpMethod = "POST") + @PostMapping(value = "/delete") + public Result delete(@RequestBody String id) { + JSONObject jsonObject = JSON.parseObject(id, JSONObject.class); + id = String.valueOf(jsonObject.get("id")); + Result result = new Result(); + SjSafeEnvironmentFileType sjSafeEnvironmentFileType = sjSafeEnvironmentFileTypeService.getById(id); + if (sjSafeEnvironmentFileType == null) { + result.error500("未找到对应实体"); + } else { + boolean ok = sjSafeEnvironmentFileTypeService.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 deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + Result result = new Result(); + if (ids == null || "".equals(ids.trim())) { + result.error500("参数不识别!"); + } else { + this.sjSafeEnvironmentFileTypeService.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 queryById(@RequestParam(name = "id", required = true) String id) { + Result result = new Result(); + SjSafeEnvironmentFileType sjSafeEnvironmentFileType = sjSafeEnvironmentFileTypeService.getById(id); + if (sjSafeEnvironmentFileType == null) { + result.error500("未找到对应实体"); + } else { + result.setResult(sjSafeEnvironmentFileType); + 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 queryWrapper = null; + try { + String paramsStr = request.getParameter("paramsStr"); + if (oConvertUtils.isNotEmpty(paramsStr)) { + String deString = URLDecoder.decode(paramsStr, "UTF-8"); + SjSafeEnvironmentFileType sjSafeEnvironmentFileType = JSON.parseObject(deString, SjSafeEnvironmentFileType.class); + queryWrapper = QueryGenerator.initQueryWrapper(sjSafeEnvironmentFileType, request.getParameterMap()); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + //Step.2 AutoPoi 导出Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List pageList = sjSafeEnvironmentFileTypeService.list(queryWrapper); + //导出文件名称 + mv.addObject(NormalExcelConstants.FILE_NAME, "三江安全环保资料中心文件类型列表"); + mv.addObject(NormalExcelConstants.CLASS, SjSafeEnvironmentFileType.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 fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List listSjSafeEnvironmentFileTypes = ExcelImportUtil.importExcel(file.getInputStream(), SjSafeEnvironmentFileType.class, params); + for (SjSafeEnvironmentFileType sjSafeEnvironmentFileTypeExcel : listSjSafeEnvironmentFileTypes) { + sjSafeEnvironmentFileTypeService.save(sjSafeEnvironmentFileTypeExcel); + } + return Result.ok("文件导入成功!数据行数:" + listSjSafeEnvironmentFileTypes.size()); + } catch (Exception e) { + log.error(e.getMessage()); + return Result.error("文件导入失败!"); + } finally { + try { + file.getInputStream().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return Result.ok("文件导入失败!"); + } + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFile.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFile.java new file mode 100644 index 000000000..477353299 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFile.java @@ -0,0 +1,83 @@ +package com.zhgd.xmgl.modules.sanjiang.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 三江安全环保资料中心 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Data +@TableName("sj_safe_environment_file") +@ApiModel(value = "SjSafeEnvironmentFile实体类", description = "SjSafeEnvironmentFile") +public class SjSafeEnvironmentFile implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * fileId + */ + @Excel(name = "fileId", width = 15) + @ApiModelProperty(value = "id") + private java.lang.Long id; + /** + * 项目SN + */ + @Excel(name = "项目SN", width = 15) + @ApiModelProperty(value = "项目SN") + private java.lang.String projectSn; + /** + * 文件名 + */ + @Excel(name = "文件名", width = 15) + @ApiModelProperty(value = "文件名") + private java.lang.String fileName; + /** + * 文件路径 + */ + @Excel(name = "文件路径", width = 15) + @ApiModelProperty(value = "文件路径") + private java.lang.String filePath; + /** + * 扩展名 + */ + @Excel(name = "扩展名", width = 15) + @ApiModelProperty(value = "扩展名") + private java.lang.String extendName; + /** + * 是否是目录 0-否, 1-是 + */ + @Excel(name = "是否是目录 0-否, 1-是", width = 15) + @ApiModelProperty(value = "是否是目录 0-否, 1-是") + private java.lang.Integer isDir; + /** + * 文件url + */ + @Excel(name = "文件url", width = 15) + @ApiModelProperty(value = "文件url") + private java.lang.String fileUrl; + /** + * 上传时间 + */ + @Excel(name = "上传时间", width = 15) + @ApiModelProperty(value = "上传时间") + private java.lang.String uploadTime; + /** + * 父级ID + */ + @Excel(name = "父级ID", width = 15) + @ApiModelProperty(value = "父级ID") + private java.lang.Long parentId; + /** + * 文件大小 + */ + @Excel(name = "文件大小", width = 15) + @ApiModelProperty(value = "文件大小") + private java.lang.String fileSize; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFileType.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFileType.java new file mode 100644 index 000000000..06525cfa2 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/entity/SjSafeEnvironmentFileType.java @@ -0,0 +1,40 @@ +package com.zhgd.xmgl.modules.sanjiang.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 lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * @Description: 三江安全环保资料中心文件类型 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Data +@TableName("sj_safe_environment_file_type") +@ApiModel(value = "SjSafeEnvironmentFileType实体类", description = "SjSafeEnvironmentFileType") +public class SjSafeEnvironmentFileType implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "id") + private java.lang.Integer id; + /** + * 类型名称 + */ + @Excel(name = "类型名称", width = 15) + @ApiModelProperty(value = "类型名称") + private java.lang.String name; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileMapper.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileMapper.java new file mode 100644 index 000000000..4f2fe3ee1 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.sanjiang.mapper; + +import org.apache.ibatis.annotations.Mapper; +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFile; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 三江安全环保资料中心 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Mapper +public interface SjSafeEnvironmentFileMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileTypeMapper.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileTypeMapper.java new file mode 100644 index 000000000..81d265642 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/SjSafeEnvironmentFileTypeMapper.java @@ -0,0 +1,16 @@ +package com.zhgd.xmgl.modules.sanjiang.mapper; + +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFileType; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 三江安全环保资料中心文件类型 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Mapper +public interface SjSafeEnvironmentFileTypeMapper extends BaseMapper { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileMapper.xml b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileMapper.xml new file mode 100644 index 000000000..fa2f750ee --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileTypeMapper.xml b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileTypeMapper.xml new file mode 100644 index 000000000..6a0b27178 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/mapper/xml/SjSafeEnvironmentFileTypeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileService.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileService.java new file mode 100644 index 000000000..88da192af --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileService.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.modules.sanjiang.service; + +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFile; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 三江安全环保资料中心 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +public interface ISjSafeEnvironmentFileService extends IService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileTypeService.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileTypeService.java new file mode 100644 index 000000000..b095477e1 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/ISjSafeEnvironmentFileTypeService.java @@ -0,0 +1,14 @@ +package com.zhgd.xmgl.modules.sanjiang.service; + +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFileType; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 三江安全环保资料中心文件类型 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +public interface ISjSafeEnvironmentFileTypeService extends IService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileServiceImpl.java new file mode 100644 index 000000000..8ea66a404 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileServiceImpl.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.sanjiang.service.impl; + +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFile; +import com.zhgd.xmgl.modules.sanjiang.mapper.SjSafeEnvironmentFileMapper; +import com.zhgd.xmgl.modules.sanjiang.service.ISjSafeEnvironmentFileService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 三江安全环保资料中心 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Service +public class SjSafeEnvironmentFileServiceImpl extends ServiceImpl implements ISjSafeEnvironmentFileService { + +} diff --git a/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileTypeServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileTypeServiceImpl.java new file mode 100644 index 000000000..6c80729c4 --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/sanjiang/service/impl/SjSafeEnvironmentFileTypeServiceImpl.java @@ -0,0 +1,19 @@ +package com.zhgd.xmgl.modules.sanjiang.service.impl; + +import com.zhgd.xmgl.modules.sanjiang.entity.SjSafeEnvironmentFileType; +import com.zhgd.xmgl.modules.sanjiang.mapper.SjSafeEnvironmentFileTypeMapper; +import com.zhgd.xmgl.modules.sanjiang.service.ISjSafeEnvironmentFileTypeService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 三江安全环保资料中心文件类型 + * @author: pds + * @date: 2023-04-20 + * @version: V1.0 + */ +@Service +public class SjSafeEnvironmentFileTypeServiceImpl extends ServiceImpl implements ISjSafeEnvironmentFileTypeService { + +} diff --git a/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai b/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai index e3e26be83..67d94a940 100644 --- a/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai +++ b/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai @@ -51,7 +51,7 @@ import com.alibaba.fastjson.JSON; public class ${entityName}Controller { @Autowired private I${entityName}Service ${entityName?uncap_first}Service; - + /** * 分页列表查询 * @param ${entityName?uncap_first} @@ -78,8 +78,6 @@ public class ${entityName}Controller { /** * 列表查询 * @param ${entityName?uncap_first} - * @param pageNo 页码 - * @param pageSize 条数 * @param req * @return */ @@ -111,7 +109,7 @@ public class ${entityName}Controller { } return result; } - + /** * 编辑 * @param ${entityName?uncap_first} @@ -128,10 +126,10 @@ public class ${entityName}Controller { ${entityName?uncap_first}Service.updateById(${entityName?uncap_first}); result.success("修改成功!"); } - + return result; } - + /** * 通过id删除 * @param id @@ -152,10 +150,10 @@ public class ${entityName}Controller { result.success("删除成功!"); } } - + return result; } - + /** * 批量删除 * @param ids @@ -174,7 +172,7 @@ public class ${entityName}Controller { } return result; } - + /** * 通过id查询 * @param id diff --git a/src/main/resources/jeecg/jeecg_database.properties b/src/main/resources/jeecg/jeecg_database.properties index dee0ec4ba..07e0efcde 100644 --- a/src/main/resources/jeecg/jeecg_database.properties +++ b/src/main/resources/jeecg/jeecg_database.properties @@ -1,11 +1,11 @@ #mysql diver_name=com.mysql.jdbc.Driver -url=jdbc:mysql://127.0.0.1:3306/wisdomsite_yanshi?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_yanshi +database_name=wisdomsite_sj #database_name=dev_manage #oracle