Browse Source

装置系统接口更新、查询全部联锁接口修改

sl 9 months ago
parent
commit
5d84693e8e

+ 2 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/controller/InterlockBaseController.java

@@ -352,8 +352,8 @@ public class InterlockBaseController extends JeecgController<InterlockBase, IInt
 	  */
 	 @ApiOperation("联锁基础表-普通列表查询")
 	 @GetMapping(value = "/listByUser")
-	 public List<InterlockBaseLimit> listByUser(){
-		 return interlockBaseService.listByUser();
+	 public List<InterlockBaseLimit> listByUser(HttpServletRequest request){
+		 return interlockBaseService.listByUser(request);
 	 }
 
 	 /**

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/InterlockBaseMapper.java

@@ -52,5 +52,5 @@ public interface InterlockBaseMapper extends BaseMapper<InterlockBase> {
 	 *   des: 联锁基础表-普通列表查询 添加用户权限
 	 *   date: 2024/7/30
 	 */
-	List<InterlockBaseLimit> listByUser();
+	List<InterlockBaseLimit> listByUser(@Param("wiseUser") String wiseUser);
 }

+ 2 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/mapper/xml/InterlockBaseMapper.xml

@@ -38,8 +38,8 @@
 
 	<select id="listByUser" resultType="org.jeecg.modules.base.entity.InterlockBaseLimit">
 		select b.*,qxnr.limit_type from interlock_base b
-		left join (select l.* from interlock_system_limit l where l.interlock_user_id in
-		(select u.id from interlock_user u where u.username='测试用户1')) qxnr
+		inner join (select l.* from interlock_system_limit l where l.interlock_user_id in
+		(select u.id from interlock_user u where u.username=#{wiseUser})) qxnr
 		on b.id=qxnr.interlock_system_id
 	</select>
 

+ 2 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/IInterlockBaseService.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.jeecg.modules.base.entity.InterlockBaseLimit;
 import org.jeecg.modules.interlockUser.entity.InterlockUserAdd;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -104,7 +105,7 @@ public interface IInterlockBaseService extends IService<InterlockBase> {
 	 *   des: 联锁基础表-普通列表查询 添加用户权限
 	 *   date: 2024/7/30
 	 */
-	List<InterlockBaseLimit> listByUser();
+	List<InterlockBaseLimit> listByUser(HttpServletRequest request);
 
 	/**
 	 * 新增装置系统

+ 17 - 2
jeecg-module-interlock/src/main/java/org/jeecg/modules/base/service/impl/InterlockBaseServiceImpl.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.base.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.system.vo.SelectTreeModel;
@@ -23,6 +24,9 @@ import java.util.List;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
 /**
  * @Description: 联锁基础表
  * @Author: jeecg-boot
@@ -340,8 +344,19 @@ public class InterlockBaseServiceImpl extends ServiceImpl<InterlockBaseMapper, I
      *   des: 联锁基础表-普通列表查询 添加用户权限
      *   date: 2024/7/30
      */
-    public List<InterlockBaseLimit> listByUser(){
-        return interlockBaseMapper.listByUser();
+    public List<InterlockBaseLimit> listByUser(HttpServletRequest request){
+        String wiseUser = "";
+        //获取当前用户名
+        Cookie[] cookies = request.getCookies();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                if (cookie.getName().equals("WISEUser")) {
+                    wiseUser = cookie.getValue();
+                }
+            }
+        }
+//        if(wiseUser == null || wiseUser.equals("")) return Result.error("EIToken校验失败,请重新登录");
+        return interlockBaseMapper.listByUser(wiseUser);
     }
 
     @Override

+ 20 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/controller/InterlockDetailController.java

@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
+import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -242,4 +243,23 @@ public class InterlockDetailController extends JeecgController<InterlockDetail,
         return super.importExcel(request, response, InterlockDetail.class);
     }
 
+	 /**联锁逻辑状态-分页表查询联锁  添加权限*/
+	 @ApiOperation(value="联锁逻辑状态-分页表查询联锁  添加权限", notes="联锁逻辑状态-分页表查询联锁  添加权限")
+	 @GetMapping(value = "/listPageByUser")
+	 public Result<IPage<InterlockSummaryVO>> listPageByUser(InterlockSummaryVO vo,
+																  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+																  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+																  HttpServletRequest request) {
+		 long startTime = System.currentTimeMillis();
+		 Page<InterlockSummaryVO> page = new Page<InterlockSummaryVO>(pageNo, pageSize);
+		 IPage<InterlockSummaryVO> pageList = interlockDetailService.getPageByUser(page, vo, request);
+		 long endTime = System.currentTimeMillis();
+		 long duration = endTime - startTime;
+		 String log = "联锁逻辑状态-分页列表查询程序运行时间(毫秒):" + duration;
+		 System.out.println(log);
+//		 interlockDetailMapper.insertIntoTimeTestLog("联锁逻辑状态",duration);
+		 return Result.OK(pageList);
+
+	 }
+
 }

+ 5 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/mapper/InterlockDetailMapper.java

@@ -11,6 +11,7 @@ import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.detail.entity.InterlockDetail;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
+import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 
 /**
@@ -41,4 +42,8 @@ public interface InterlockDetailMapper extends BaseMapper<InterlockDetail> {
     @Insert("INSERT INTO time_test_log (type, cost_time) VALUES (#{type}, #{cost_time})")
     void insertIntoTimeTestLog(@Param("type") String type, @Param("cost_time") Long costTime);
 
+    /**联锁总表-分页列表查询(各种逻辑状态)*/
+    IPage<InterlockSummaryVO> getPageByUser(Page<InterlockSummaryVO> page, @Param("interlockSummaryVO") InterlockSummaryVO interlockSummaryVO, @Param("wiseUser") String wiseUser);
+
+
 }

+ 32 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/mapper/xml/InterlockDetailMapper.xml

@@ -101,4 +101,36 @@
         select * from interlock_detail where summaryid = #{summaryId}
     </select>
 
+
+    <!-- 联锁总表-分页列表查询(各种逻辑状态) 添加权限-->
+    <select id="getPageByUser" resultType="org.jeecg.modules.summary.vo.InterlockSummaryVO">
+        select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.instrument_status, d.control_system_status,
+        s.interlock_status, s.loop_health_level, d.bypass, s.interlock_apparatus_id, s.interlock_system_id,
+        h1.interlock_status_name , h2.bypass_name ,
+        h3.instrument_status_name , h4.control_system_status_name,
+        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal
+        from interlock_detail d
+        left join interlock_summary s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.interlock_status = s.interlock_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.bypass = d.bypass and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
+        left join interlock_base h on h.id = s.interlock_system_id
+        inner join (select l.* from interlock_system_limit l where l.interlock_user_id in
+        (select u.id from interlock_user u where u.username=#{wiseUser})) qxnr on qxnr.interlock_system_id = s.interlock_system_id
+        <where>
+            and (qxnr.limit_type='0' or qxnr.limit_type='1')
+            <if test="interlockSummaryVO.interlockApparatusId != null and interlockSummaryVO.interlockApparatusId != ''"> and s.interlock_apparatus_id = #{interlockSummaryVO.interlockApparatusId}</if>
+            <if test="interlockSummaryVO.interlockSystemId != null and interlockSummaryVO.interlockSystemId != ''"> and s.interlock_system_id = #{interlockSummaryVO.interlockSystemId}</if>
+            <if test="interlockSummaryVO.interlockname != null and interlockSummaryVO.interlockname != ''"> and d.interlockname like concat('%', #{interlockSummaryVO.interlockname}, '%')</if>
+            <if test="interlockSummaryVO.interlockConditionTag != null and interlockSummaryVO.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%', #{interlockSummaryVO.interlockConditionTag}, '%')</if>
+            <if test="interlockSummaryVO.instrumentStatus != null and interlockSummaryVO.instrumentStatus != ''"> and d.instrument_status = #{interlockSummaryVO.instrumentStatus}</if>
+            <if test="interlockSummaryVO.controlSystemStatus != null and interlockSummaryVO.controlSystemStatus != ''"> and d.control_system_status = #{interlockSummaryVO.controlSystemStatus}</if>
+            <if test="interlockSummaryVO.interlockStatus != null and interlockSummaryVO.interlockStatus != ''"> and s.interlock_status = #{interlockSummaryVO.interlockStatus}</if>
+            <if test="interlockSummaryVO.loopHealthLevel != null and interlockSummaryVO.loopHealthLevel != ''"> and s.loop_health_level = #{interlockSummaryVO.loopHealthLevel}</if>
+            <if test="interlockSummaryVO.bypass != null and interlockSummaryVO.bypass != ''"> and d.bypass = #{interlockSummaryVO.bypass}</if>
+        </where>
+        order by s.create_time desc
+    </select>
+
 </mapper>

+ 5 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/service/IInterlockDetailService.java

@@ -6,8 +6,10 @@ import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.detail.entity.InterlockDetail;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
+import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -35,4 +37,7 @@ public interface IInterlockDetailService extends IService<InterlockDetail> {
     *   date: 2024/5/30
     */
     List<InterlockDetail> selectListBySummaryId(String summaryId);
+
+    /**联锁总表-分页列表查询(各种逻辑状态) 添加权限*/
+    public IPage<InterlockSummaryVO> getPageByUser(Page<InterlockSummaryVO> page, InterlockSummaryVO interlockSummaryVO, HttpServletRequest request);
 }

+ 18 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/service/impl/InterlockDetailServiceImpl.java

@@ -9,12 +9,15 @@ import org.jeecg.modules.detail.entity.InterlockDetail;
 import org.jeecg.modules.detail.mapper.InterlockDetailMapper;
 import org.jeecg.modules.detail.service.IInterlockDetailService;
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
+import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -116,4 +119,19 @@ public class InterlockDetailServiceImpl extends ServiceImpl<InterlockDetailMappe
         return voiPage;
     }
 
+    /**联锁总表-分页列表查询(各种逻辑状态) 添加权限*/
+    public IPage<InterlockSummaryVO> getPageByUser(Page<InterlockSummaryVO> page, InterlockSummaryVO interlockSummaryVO, HttpServletRequest request) {
+        String wiseUser = "";
+        //获取当前用户名
+        Cookie[] cookies = request.getCookies();
+        if (cookies != null) {
+            for (Cookie cookie : cookies) {
+                if (cookie.getName().equals("WISEUser")) {
+                    wiseUser = cookie.getValue();
+                }
+            }
+        }
+        return interlockDetailMapper.getPageByUser(page, interlockSummaryVO, wiseUser);
+    }
+
 }

+ 87 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/vo/InterlockSummaryLimitVO.java

@@ -0,0 +1,87 @@
+package org.jeecg.modules.summary.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecg.common.aspect.annotation.Dict;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * ClassName: InterlockSummaryLimitVO
+ * Package: org.jeecg.modules.summary.vo
+ * Description:
+ *
+ * @Author sl
+ * @Create 2024/8/1 14:24
+ * @Version 1.0
+ */
+@Data
+public class InterlockSummaryLimitVO {
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private java.lang.String id;
+    /**联锁总表id*/
+    @Excel(name = "联锁总表id", width = 15)
+    @ApiModelProperty(value = "联锁总表id")
+    private java.lang.String summaryid;
+    /**联锁名称*/
+    @Excel(name = "联锁名称", width = 15)
+    @ApiModelProperty(value = "联锁名称")
+    private java.lang.String interlockname;
+    /**联锁条件值*/
+    @Excel(name = "联锁条件值", width = 15)
+    @ApiModelProperty(value = "联锁条件值")
+    private java.lang.String interlockCondition;
+    /**联锁条件点位*/
+    @Excel(name = "联锁条件点位", width = 15)
+    @ApiModelProperty(value = "联锁条件点位")
+    private java.lang.String interlockConditionTag;
+    /**仪表状态*/
+    @Excel(name = "仪表状态", width = 15)
+    @ApiModelProperty(value = "仪表状态")
+//    @Dict(dicCode = "instrument_status")
+    private java.lang.String instrumentStatus;
+    private java.lang.String instrumentStatusName;
+    private java.lang.String instrumentStatusNormal;
+    /**控制系统状态*/
+    @Excel(name = "控制系统状态", width = 15)
+    @ApiModelProperty(value = "控制系统状态")
+//    @Dict(dicCode = "control_system_status")
+    private java.lang.String controlSystemStatus;
+    private java.lang.String controlSystemStatusName;
+    private java.lang.String controlSystemStatusNormal;
+    /**联锁状态*/
+    @Excel(name = "联锁状态", width = 15)
+    @ApiModelProperty(value = "联锁状态")
+//    @Dict(dicCode = "interlock_status")
+    private java.lang.String interlockStatus;
+    private java.lang.String interlockStatusName;
+    private java.lang.String interlockStatusTy;
+    /**回路健康级别*/
+    @Excel(name = "回路健康级别", width = 15)
+    @ApiModelProperty(value = "回路健康级别")
+    private java.lang.String loopHealthLevel;
+    /**旁路状态*/
+//    @Dict(dicCode = "bypass")
+    @ApiModelProperty(value = "旁路状态")
+    private java.lang.String bypass;
+    private java.lang.String bypassName;
+    private java.lang.String bypassYes;
+
+
+    /**装置id*/
+    @Excel(name = "装置id", width = 15)
+    @ApiModelProperty(value = "装置id")
+    private java.lang.String interlockApparatusId;
+    /**系统id*/
+    @Excel(name = "系统id", width = 15)
+    @ApiModelProperty(value = "系统id")
+    private java.lang.String interlockSystemId;
+    /**系统权限类型(0管理1查看)*/
+//    @Excel(name = "系统权限类型(0管理1查看)", width = 15)
+    @ApiModelProperty(value = "系统权限类型(0管理1查看)")
+    private java.lang.String limitType;
+
+}