Browse Source

Merge remote-tracking branch 'origin/prod-5.1.3' into prod-5.1.3

zhongwei
yang_shj 4 months ago
parent
commit
a98da57a75
  1. 13
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/entity/ProjectEntity.java
  2. 12
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/ProjectService.java
  3. 30
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/services/impl/ProjectServiceImpl.java
  4. 8
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/vo/ProjectListQueryVO.java
  5. 33
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java
  6. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/controller/TaskController.java
  7. 31
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml
  8. 26
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/utils/Condition.java

13
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;
}

12
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<ProjectEntity> {
List<Map<String,Object>> deptProjectTree(ProjectDTO project);
List<ProjectVO> projects(String emCode, ContentDTO content);
/**
* 查询列表
* @param project 参数
* @param query 分页类
* @return 巡检项目管理列表
*/
IPage<ProjectEntity> getList(ProjectListQueryVO project, Query query);
}

30
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<ProjectMapper, ProjectEntity> 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<ProjectMapper, ProjectEntity
}
/**
* 查询列表
*/
@Override
public IPage<ProjectEntity> getList(ProjectListQueryVO project, Query query) {
LambdaQueryWrapper<ProjectEntity> 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<ProjectEntity> pages = this.page(Condition.getPage(query), queryWrapper);
pages.getRecords().forEach(entity->{
QueryWrapper<ProjectContentEntity> 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

8
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;
}

33
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<IPage<ProjectEntity>> list(ProjectListQueryVO project, Query query) {
LambdaQueryWrapper<ProjectEntity> queryWrapper = Condition.getQueryWrapper(new ProjectEntity(),project);
queryWrapper.orderByDesc(ProjectEntity::getUpdateTime);
IPage<ProjectEntity> 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<ProjectContentEntity> qw = new QueryWrapper<>();
qw.lambda().eq(ProjectContentEntity::getProjectId, entity.getId());
Long contentNum = projectContentService.count(qw);
entity.setContentNum(contentNum.intValue());
});
IPage<ProjectEntity> 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<ProjectEntity> detail(Long id) {
@ -99,9 +82,6 @@ public class ProjectController {
return R.data(project);
}
/**
* 新增或修改
*/
@PostMapping("/submit")
@ApiOperation(value = "新增或修改", notes = "传入巡检项目")
public R<Boolean> 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,

10
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<BladePage<TaskVo>> list(TaskListQuery task, Query query) {
//CacheUtil.put("test#2","inspect","test","12");
// LambdaQueryWrapper<TaskEntity> queryWrapper = Condition.getQueryWrapper(new TaskEntity(),task);
// queryWrapper.orderByDesc(TaskEntity::getUpdateTime);
// IPage<TaskEntity> pages = taskService.page(Condition.getPage(query), queryWrapper);
IPage<TaskVo> 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<TaskVo> list = taskService.getListPage(pages,task);
List<TaskVo> list = taskService.getListPage(pages, task);
pages.setRecords(list);
BladePage<TaskVo> bladePage = BladePage.of(pages);
return R.data(bladePage);

31
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml

@ -132,14 +132,18 @@
</select>
<select id="getListPage" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT t.*,u.USER_ID from HZ_ST_EX_TASK t
LEFT JOIN HZ_ST_EX_TASK_USER u on t.ID=u.TASK_ID
where t.IS_DELETED=0 and u.IS_DELETED=0
SELECT
t.*, u.USER_ID
from
HZ_ST_EX_TASK t
left join HZ_ST_EX_TASK_USER u on t.ID = u.TASK_ID
where
t.IS_DELETED = 0 and u.IS_DELETED = 0
<if test="task.dutyId != null ">
and t.DUTY_ID=#{task.dutyId}
and t.DUTY_ID = #{task.dutyId}
</if>
<if test="task.curUserId != null and task.curUserId != ''">
and u.USER_ID=#{task.curUserId}
and u.USER_ID = #{task.curUserId}
</if>
<if test="task.planName != null and task.planName != ''">
and t.PLAN_NAME like concat('%', #{task.planName}, '%')
@ -157,31 +161,32 @@
and t.PLAN_END_TIME &gt;= #{task.startTime}
</if>
<if test="task.cycle != null and task.cycle != ''">
and t.CYCLE=#{task.cycle}
and t.CYCLE = #{task.cycle}
</if>
<if test="task.status != null">
and t.STATUS=#{task.status}
and t.STATUS = #{task.status}
</if>
<if test="task.keepOnRecord != null">
and t.KEEP_ON_RECORD=#{task.keepOnRecord}
and t.KEEP_ON_RECORD = #{task.keepOnRecord}
</if>
<if test="task.tenantId != null and task.tenantId != ''">
and t.TENANT_ID = #{task.tenantId}
</if>
<if test="task.autoVideo != null">
and t.AUTO_VIDEO=#{task.autoVideo}
and t.AUTO_VIDEO = #{task.autoVideo}
</if>
<if test="task.taskIds != null and task.taskIds != ''">
and FIND_IN_SET(t.ID,#{task.taskIds})
and FIND_IN_SET(t.ID, #{task.taskIds})
</if>
<if test="task.areaId != null">
and t.CREATE_DEPT = #{task.areaId}
<if test="task.createDept != null">
and t.CREATE_DEPT = #{task.createDept}
</if>
<if test="task.yearMonth != null">
and date_format(t.PLAN_START_TIME,'%Y-%m')= #{task.yearMonth}
and date_format(t.PLAN_START_TIME,'%Y-%m') = #{task.yearMonth}
</if>
order by t.UPDATE_TIME desc
</select>
<select id="getAllPageList" parameterType="com.hnac.hzinfo.inspect.task.vo.TaskListQuery" resultType="com.hnac.hzinfo.inspect.task.vo.TaskVo">
SELECT
t.*, b.USER_ID as userIds,

26
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);

Loading…
Cancel
Save