From b0cfa75a98ce9e716e9d2e099fd1b57b9b42b2f6 Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 1 Aug 2024 20:18:10 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E7=AE=A1=E7=90=86=E4=BE=9D=E8=B5=96=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hzims-service/hzims-basic/pom.xml | 34 ++++++++++++++++++++++ .../controller/PresonManagementController.java | 8 +++-- .../hzims/basic/mapper/PersonManagemetMapper.java | 1 + 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/hzims-service/hzims-basic/pom.xml b/hzims-service/hzims-basic/pom.xml index 16958bf..265b0bc 100644 --- a/hzims-service/hzims-basic/pom.xml +++ b/hzims-service/hzims-basic/pom.xml @@ -49,6 +49,40 @@ hzims-operational-api + com.alibaba + easyexcel-core + 3.3.2 + + + org.apache.poi + poi-ooxml + + + org.apache.poi + poi + + + org.apache.poi + poi-ooxml-schemas + + + + + org.apache.poi + poi-ooxml + 5.2.3 + + + org.apache.poi + poi + 5.2.3 + + + org.apache.poi + poi-ooxml-schemas + 4.1.2 + + org.springframework.boot spring-boot-starter-data-redis diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java index 86a0dc7..ed3691e 100644 --- a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java @@ -97,7 +97,7 @@ public class PresonManagementController extends BladeController { @OperationAnnotation(moduleName = "档案管理",title = "档案管理",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,action = "档案管理") - public void exportPersonManagemetVo(HttpServletResponse response,PersonManagemetVo personManagemetVo) { + public void exportPersonManagemetVo(HttpServletResponse response,PersonManagemetVo personManagemetVo) throws IOException { try { response.setContentType("application/vnd.ms-excel"); response.setCharacterEncoding("UTF-8"); @@ -111,8 +111,9 @@ public class PresonManagementController extends BladeController { EasyExcel.write(response.getOutputStream(), PersonManagemetExportVo.class).autoCloseStream(Boolean.FALSE).sheet("档案管理报表") .doWrite(list); } + response.getOutputStream().close(); } catch (Exception e) { - System.out.println("exportExcel = " + e); + e.printStackTrace(); // 重置response response.reset(); response.setContentType("application/json"); @@ -122,9 +123,12 @@ public class PresonManagementController extends BladeController { map.put("msg", "档案管理报表导出失败" + e.getMessage()); try { response.getWriter().println(JSONUtil.toJsonStr(map)); + response.getOutputStream().close(); } catch (IOException e3) { + response.getOutputStream().close(); throw new ServiceException( "发生异常 :" + e); } + } } diff --git a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java index d2123bc..e849f96 100644 --- a/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java +++ b/hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java @@ -38,6 +38,7 @@ public interface PersonManagemetMapper extends UserDataScopeBaseMapper depetIds, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; + @UserDataAuth List exportPersonManagemet( @Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, @Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, From 799370b3c0804f700a006dbd982eb2a9e82f006e Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 2 Aug 2024 09:56:45 +0800 Subject: [PATCH 02/10] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=B7=A1?= =?UTF-8?q?=E6=A3=80=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86=E6=9D=A1=E4=BB=B6?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzinfo/inspect/obj/entity/ProjectEntity.java | 13 ++------- .../inspect/obj/services/ProjectService.java | 12 ++++++-- .../obj/services/impl/ProjectServiceImpl.java | 30 ++++++++++++++++++-- .../hzinfo/inspect/obj/vo/ProjectListQueryVO.java | 8 +----- .../hzinfo/inspect/obj/web/ProjectController.java | 33 ++-------------------- .../com/hnac/hzinfo/inspect/utils/Condition.java | 26 ++++++++--------- 6 files changed, 55 insertions(+), 67 deletions(-) diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java index 6889ec6..61fe62d 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java @@ -13,7 +13,6 @@ import org.springblade.core.tenant.mp.TenantEntity; import javax.validation.constraints.Size; import java.util.List; - /** * 巡检项目实体类 * @@ -28,20 +27,13 @@ public class ProjectEntity extends TenantEntity { private static final long serialVersionUID = -1105554271550820235L; - /** - * 项目编码 - */ @ApiModelProperty(value = "项目编码") private String code; - /** - * 项目名称 - */ + @ApiModelProperty(value = "项目名称长度必须为1到128") @Size(min=1,max = 128,message ="项目名称长度必须为1到128") private String name; - /** - * 项目描述 - */ + @ApiModelProperty(value = "项目描述长度必须为0到512") @Size(min=0,max = 512,message ="项目描述长度必须为0到512") private String description; @@ -62,5 +54,4 @@ public class ProjectEntity extends TenantEntity { @ApiModelProperty("设备编号") private String emCode; - } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java index a16cbb7..1a2baf6 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java @@ -1,16 +1,16 @@ package com.hnac.hzinfo.inspect.obj.services; - import java.util.List; import java.util.Map; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; +import com.hnac.hzinfo.inspect.obj.vo.ProjectListQueryVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectVO; - import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; import org.springblade.core.mp.support.Query; @@ -59,4 +59,12 @@ public interface ProjectService extends IService { List> deptProjectTree(ProjectDTO project); List projects(String emCode, ContentDTO content); + + /** + * 查询列表 + * @param project 参数 + * @param query 分页类 + * @return 巡检项目管理列表 + */ + IPage getList(ProjectListQueryVO project, Query query); } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java index ae898f5..6dbb3fa 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.google.common.collect.Lists; import com.hnac.hzinfo.inspect.Constants; import com.hnac.hzinfo.inspect.obj.ObjectConstants; import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; @@ -14,11 +13,13 @@ import com.hnac.hzinfo.inspect.obj.dto.ProjectDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectContentEntity; import com.hnac.hzinfo.inspect.obj.entity.ProjectEntity; +import com.hnac.hzinfo.inspect.obj.mapper.ProjectContentMapper; import com.hnac.hzinfo.inspect.obj.mapper.ProjectMapper; import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.obj.services.ProjectContentService; import com.hnac.hzinfo.inspect.obj.services.ProjectService; import com.hnac.hzinfo.inspect.obj.utils.CodeUtils; +import com.hnac.hzinfo.inspect.obj.vo.ProjectListQueryVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectOfflineVO; import com.hnac.hzinfo.inspect.obj.vo.ProjectVO; import com.hnac.hzinfo.inspect.obj.wrapper.ContentWrapper; @@ -29,7 +30,8 @@ import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springblade.core.mp.support.Query; -import org.springblade.core.tool.api.R; +import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.*; import org.springblade.system.feign.ISysClient; import org.springframework.stereotype.Service; @@ -49,8 +51,10 @@ import java.util.stream.Stream; public class ProjectServiceImpl extends ServiceImpl implements ProjectService { private final ContentService contentService; + private final ISysClient sysClient; - //private final ProjectContentService projectContentService; + + private final ProjectContentMapper projectContentMapper; @Override public boolean save(ProjectEntity entity) { @@ -202,6 +206,26 @@ public class ProjectServiceImpl extends ServiceImpl getList(ProjectListQueryVO project, Query query) { + LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new ProjectEntity(), project); + queryWrapper.orderByDesc(ProjectEntity::getUpdateTime); + if (!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) { + queryWrapper.eq(ProjectEntity::getTenantId, AuthUtil.getTenantId()); + } + IPage pages = this.page(Condition.getPage(query), queryWrapper); + pages.getRecords().forEach(entity->{ + QueryWrapper qw = new QueryWrapper<>(); + qw.lambda().eq(ProjectContentEntity::getProjectId, entity.getId()); + Long contentNum = projectContentMapper.selectCount(qw); + entity.setContentNum(contentNum.intValue()); + }); + return pages; + } + + /** * 获取项目树中 机构下巡检项目的子集 * @param project 筛选条件 * @param deptId 机构ID diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java index 9f8eac1..462a015 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java @@ -20,18 +20,13 @@ import java.util.List; @Getter @Setter public class ProjectListQueryVO implements Serializable { + private static final long serialVersionUID = -953928646703619934L; - /** - * 项目编码 - */ @ApiModelProperty(value = "项目编码") @QueryField(condition = SqlCondition.LIKE) private String code; - /** - * 项目名称 - */ @ApiModelProperty(value = "项目名称") @QueryField(condition = SqlCondition.LIKE) private String name; @@ -54,5 +49,4 @@ public class ProjectListQueryVO implements Serializable { @QueryField(condition = SqlCondition.EQUAL) @ApiModelProperty(value = "创建机构") private Long createDept; - } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java index 929d432..b452dad 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java @@ -23,11 +23,8 @@ import com.hnac.hzinfo.inspect.obj.vo.ProjectVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; -import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.Dept; @@ -61,24 +58,13 @@ public class ProjectController { @Autowired private ISysClient sysClient; - /** - * 巡检项目列表 - */ @GetMapping("/list") @ApiOperation(value = "巡检项目列表", notes = "巡检项目列表") - @OperationAnnotation(moduleName = "巡检管理",title = "巡检配置",operatorType = OperatorType.MOBILE,businessType = + @OperationAnnotation(moduleName = "巡检管理",title = "巡检配置",operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action = "查询巡检项目管理列表") public R> list(ProjectListQueryVO project, Query query) { - LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new ProjectEntity(),project); - queryWrapper.orderByDesc(ProjectEntity::getUpdateTime); - IPage pages = projectService.page(Condition.getPage(query), (!AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.eq(ProjectEntity::getTenantId, AuthUtil.getTenantId()) : queryWrapper); - pages.getRecords().forEach(entity->{ - QueryWrapper qw = new QueryWrapper<>(); - qw.lambda().eq(ProjectContentEntity::getProjectId, entity.getId()); - Long contentNum = projectContentService.count(qw); - entity.setContentNum(contentNum.intValue()); - }); + IPage pages = projectService.getList(project, query); return R.data(pages); } @@ -89,9 +75,6 @@ public class ProjectController { return R.data(projectService.deptProjectTree(project)); } - /** - * 查询单条 - */ @ApiOperation(value = "查看详情", notes = "传入id") @GetMapping("/detail") public R detail(Long id) { @@ -99,9 +82,6 @@ public class ProjectController { return R.data(project); } - /** - * 新增或修改 - */ @PostMapping("/submit") @ApiOperation(value = "新增或修改", notes = "传入巡检项目") public R submit(@Valid @RequestBody ProjectEntity project) { @@ -111,9 +91,6 @@ public class ProjectController { return R.status(projectService.saveOrUpdate(project)); } - /** - * 删除 - */ @PostMapping("/remove") @ApiOperationSupport(order = 6) @ApiOperation(value = "删除", notes = "传入id集合") @@ -137,9 +114,6 @@ public class ProjectController { return R.success("删除成功!"); } - /** - * 启用/停用 - */ @GetMapping("/disableOrEnable") @ApiOperationSupport(order = 6) @ApiOperation(value = "启用/停用", notes = "传入id,以及状态") @@ -155,9 +129,6 @@ public class ProjectController { return R.status(projectService.update(ew)); } - /** - * 根据ids 批量复制 - */ @PostMapping("/insertCopyBatch") @ApiOperation(value = "根据ids 数据库批量复制", notes = "传入id集合") public R insertCopyBatch(@ApiParam(value = "主键集合 ,隔开", required = true)@RequestParam String ids, diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java index 2679602..b2386ec 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java @@ -37,7 +37,7 @@ public class Condition extends org.springblade.core.mp.support.Condition { qw.setEntityClass(entity.getClass()); Class queryClass = query.getClass(); Field[] fields = queryClass.getDeclaredFields(); - for(Field field:fields){ + for (Field field : fields) { field.setAccessible(true); QueryField queryField = field.getAnnotation(QueryField.class); if(queryField==null) { @@ -49,38 +49,38 @@ public class Condition extends org.springblade.core.mp.support.Condition { } catch (Exception e) { throw new ServiceException("获取属性性出错"); } - if(value==null) { + if (value==null) { continue; } List list = null; - if(value instanceof List){ + if (value instanceof List) { list = (List)value; - if(list.size()==0) { + if (list.size()==0) { continue; } } String condition = queryField.condition(); - if(Func.isBlank(condition)) { + if (Func.isBlank(condition)) { continue; } String fileName = camel2under(field.getName()); - if(SqlCondition.EQUAL.equals(condition)) { + if (SqlCondition.EQUAL.equals(condition)) { qw.eq(fileName, value); - }else if(SqlCondition.LIKE.equals(condition)){ + } else if (SqlCondition.LIKE.equals(condition)) { qw.like(fileName,value); - }else if(SqlCondition.LIKE_LEFT.equals(condition)){ + } else if (SqlCondition.LIKE_LEFT.equals(condition)) { qw.likeLeft(fileName,value); - }else if(SqlCondition.LIKE_RIGHT.equals(condition)){ + } else if(SqlCondition.LIKE_RIGHT.equals(condition)) { qw.likeRight(fileName,value); - }else if(SqlCondition.NOT_IN.equals(condition)){ + } else if(SqlCondition.NOT_IN.equals(condition)) { String columnName = queryField.columnName(); - if(Func.isBlank(columnName)) { + if (Func.isBlank(columnName)) { throw new ServiceException("查询不包含条件时需要指定列名"); } qw.notIn(camel2under(columnName),list); - }else if(SqlCondition.IN.equals(condition)){ + } else if(SqlCondition.IN.equals(condition)) { String columnName = queryField.columnName(); - if(Func.isBlank(columnName)) { + if (Func.isBlank(columnName)) { throw new ServiceException("查询包含条件时需要指定列名"); } qw.in(camel2under(columnName),list); From eff695958926f1a0f57c6f696e957e6b32b67e39 Mon Sep 17 00:00:00 2001 From: liwen Date: Fri, 2 Aug 2024 10:15:34 +0800 Subject: [PATCH 03/10] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=88=91?= =?UTF-8?q?=E7=9A=84=E5=B7=A1=E6=A3=80=E4=BB=BB=E5=8A=A1=E4=B8=AD=E6=9C=BA?= =?UTF-8?q?=E6=9E=84=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspect/task/controller/TaskController.java | 10 +++---- .../hnac/hzinfo/inspect/task/mapper/TaskMapper.xml | 31 +++++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java index f738356..e7a0b6b 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java @@ -143,21 +143,17 @@ public class TaskController extends BladeController { */ @GetMapping("/list") @ApiOperation(value = "分页显示任务列表", notes = "传入task") - @Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY,ignore = false) + @Operate(label = "查询巡检任务分页列表-2",type = BusinessType.QUERY) public R> list(TaskListQuery task, Query query) { - //CacheUtil.put("test#2","inspect","test","12"); -// LambdaQueryWrapper queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task); -// queryWrapper.orderByDesc(TaskEntity::getUpdateTime); -// IPage pages = taskService.page(Condition.getPage(query), queryWrapper); IPage pages = Condition.getPage(query); - if(!AuthUtil.isAdministrator()){ + if (!AuthUtil.isAdministrator()) { task.setCurUserId(AuthUtil.getUserId()); task.setTenantId(AuthUtil.getTenantId()); } if (task.getCurUserId() == -1) { task.setCurUserId(null); } - List list = taskService.getListPage(pages,task); + List list = taskService.getListPage(pages, task); pages.setRecords(list); BladePage bladePage = BladePage.of(pages); return R.data(bladePage); diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index 261a0c2..7ed3974 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -132,14 +132,18 @@ +