浏览代码

fix联锁查询、联锁详细信息查询、联锁历史数据查询、联锁详细信息历史数据

LLL 8 月之前
父节点
当前提交
75001473d3

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

@@ -5,9 +5,18 @@
     <!-- 联锁详细信息表分页列表查询-->
     <select id="getPage2" parameterType="org.jeecg.modules.detail.dto.InterlockDetailQueryDTO" resultType="org.jeecg.modules.detail.vo.InterlockDetailQueryVO">
         select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.description,
-        d.instrument_status, d.interlock_set_value, d.if_bypass, d.input_status, d.output_status,
-        d.mp_status, s.ljgx, s.interlock_out_value
-        from interlock_detail d left join interlock_summary s on d.summaryid = s.id
+               d.instrument_status, d.interlock_set_value, d.bypass, d.input_status, d.output_status,
+               d.mp_status, s.ljgx, s.interlock_out_value,
+               h1.control_system_status_name as mp_status_name,
+               h2.control_system_status_name as input_status_name,
+               h3.control_system_status_name as output_status_name,
+               h4.bypass_name
+        from interlock_detail d
+        left join interlock_summary s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.control_system_status = d.mp_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.control_system_status = d.input_status and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.control_system_status = d.output_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.bypass = d.bypass and h4.interlock_system_id = s.interlock_system_id
         <where>
             <if test="dto.summaryid != null and dto.summaryid != ''"> and d.summaryid = #{dto.summaryid}</if>
             <if test="dto.interlockConditionTag != null and dto.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%',#{dto.interlockConditionTag},'%')</if>
@@ -28,11 +37,10 @@
             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
         <where>
-            <if test="interlockSummaryVO.interlockApparatusId != null and interlockSummaryVO.interlockApparatusId != ''"> and s.interlock_apparatus_id like concat('%', #{interlockSummaryVO.interlockApparatusId}, '%')</if>
-            <if test="interlockSummaryVO.interlockSystemId != null and interlockSummaryVO.interlockSystemId != ''"> and s.interlock_system_id like concat('%', #{interlockSummaryVO.interlockSystemId}, '%')</if>
+            <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.interlockCondition != null and interlockSummaryVO.interlockCondition != ''"> and d.interlock_condition = #{interlockSummaryVO.interlockCondition}</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>

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

@@ -36,8 +36,7 @@ public class InterlockDetailServiceImpl extends ServiceImpl<InterlockDetailMappe
 
     /**联锁详细信息表分页列表查询*/
     public IPage<InterlockDetailQueryVO> getPage2(Page<InterlockDetailQueryVO> page, InterlockDetailQueryDTO dto){
-        IPage<InterlockDetailQueryVO> voiPage = interlockDetailMapper.getPage2(page, dto);
-        return zhDetailQueryVOIPage(voiPage,dto.getInterlockSystemId());
+        return interlockDetailMapper.getPage2(page, dto);
     }
 
 
@@ -92,23 +91,23 @@ public class InterlockDetailServiceImpl extends ServiceImpl<InterlockDetailMappe
             List<InterlockDetailQueryVO> list = voiPage.getRecords().stream().map(i->{
                 //旁路状态转换
                 if(i.getBypass()!=null && base.getBypassYes()!=null){
-                    if(i.getBypass().equals(base.getBypassYes())) i.setBypass_dictText(base.getBypassYesName());
-                    else i.setBypass_dictText(base.getBypassNoName());
+                    if(i.getBypass().equals(base.getBypassYes())) i.setBypassName(base.getBypassYesName());
+                    else i.setBypassName(base.getBypassNoName());
                 }
                 //输入卡件状态转换
                 if(i.getInputStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getInputStatus().equals(base.getControlSystemStatusNormal())) i.setInputStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setInputStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getInputStatus().equals(base.getControlSystemStatusNormal())) i.setInputStatusName(base.getControlSystemStatusNormalName());
+                    else i.setInputStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 //输出卡件状态转换
                 if(i.getOutputStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getOutputStatus().equals(base.getControlSystemStatusNormal())) i.setOutputStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setOutputStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getOutputStatus().equals(base.getControlSystemStatusNormal())) i.setOutputStatusName(base.getControlSystemStatusNormalName());
+                    else i.setOutputStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 //MP状态转换
                 if(i.getMpStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getMpStatus().equals(base.getControlSystemStatusNormal())) i.setMpStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setMpStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getMpStatus().equals(base.getControlSystemStatusNormal())) i.setMpStatusName(base.getControlSystemStatusNormalName());
+                    else i.setMpStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 return i;
             }).collect(Collectors.toList());

+ 4 - 4
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/vo/InterlockDetailQueryVO.java

@@ -56,25 +56,25 @@ public class InterlockDetailQueryVO {
 //    @Dict(dicCode = "bypass")
     @ApiModelProperty(value = "旁路状态(0否1是)")
     private java.lang.String bypass;
-    private java.lang.String bypass_dictText;
+    private java.lang.String bypassName;
     /**输入卡件状态*/
     @Excel(name = "输入卡件状态", width = 15)
 //    @Dict(dicCode = "input_status")
     @ApiModelProperty(value = "输入卡件状态")
     private java.lang.String inputStatus;
-    private java.lang.String inputStatus_dictText;
+    private java.lang.String inputStatusName;
     /**输出卡件状态*/
     @Excel(name = "输出卡件状态", width = 15)
 //    @Dict(dicCode = "output_status")
     @ApiModelProperty(value = "输出卡件状态")
     private java.lang.String outputStatus;
-    private java.lang.String outputStatus_dictText;
+    private java.lang.String outputStatusName;
     /**MP状态*/
     @Excel(name = "MP状态", width = 15)
 //    @Dict(dicCode = "mp_status")
     @ApiModelProperty(value = "MP状态")
     private java.lang.String mpStatus;
-    private java.lang.String mpStatus_dictText;
+    private java.lang.String mpStatusName;
 
     /**逻辑关系*/
     @Excel(name = "逻辑关系", width = 15)

+ 17 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/controller/InterlockDetailHistoryController.java

@@ -15,6 +15,7 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
+import org.jeecg.modules.detail.mapper.InterlockDetailMapper;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import org.jeecg.modules.history.mapper.InterlockSummaryHistoryMapper;
@@ -64,6 +65,9 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 	 @Autowired
 	 @SuppressWarnings("all")
 	 private InterlockSummaryHistoryMapper summaryHistoryMapper;
+	 @Autowired
+	 @SuppressWarnings("all")
+	 private InterlockDetailMapper interlockDetailMapper;
 
 
 	 /**
@@ -79,6 +83,7 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 	 @GetMapping(value = "/sdexportLS")
 	 @ApiOperation("..............测试手动导出excel")
 	 public void downloadExcel(HttpServletRequest request, HttpServletResponse response, InterlockHistoryQueryDTO dto) {
+		 long startTime = System.currentTimeMillis();
 
 		 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
 		 String timestamp = dateFormat.format(new Date());
@@ -95,7 +100,7 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 
 		 // 设置响应头使浏览器能够下载文件
 		 response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
-		 response.setHeader("Content-Disposition", "attachment; filename=sample.xlsx");
+		 response.setHeader("Content-Disposition", "attachment; filename="+fileName);
 
 		 // 将Excel文件写入响应输出流
 		 try {
@@ -105,6 +110,11 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 			 e.printStackTrace();
 		 }
 
+		 long endTime = System.currentTimeMillis();
+		 long duration = endTime - startTime;
+		 String log = "手动导出Excel程序运行时间(毫秒):" + duration;
+		 System.out.println(log);
+//		 interlockDetailMapper.insertIntoTimeTestLog("手动导出",duration);
 	 }
 
 
@@ -117,8 +127,14 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 														 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
 														 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
 														 HttpServletRequest req){
+		long startTime = System.currentTimeMillis();
 		Page<InterlockSummaryHistoryVO> page = new Page<>(pageNo,pageSize);
 		IPage<InterlockSummaryHistoryVO> pageList = interlockDetailHistoryService.getPage(page, dto);
+		long endTime = System.currentTimeMillis();
+		long duration = endTime - startTime;
+		String log = "联锁历史数据各种逻辑状态程序运行时间(毫秒):" + duration;
+		System.out.println(log);
+//		interlockDetailMapper.insertIntoTimeTestLog("联锁历史数据逻辑状态",duration);
 		return Result.OK(pageList);
 	}
 

+ 14 - 5
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockDetailHistoryMapper.xml

@@ -5,9 +5,18 @@
     <!--联锁历史数据详细信息-分页查询-->
     <select id="getPage2" parameterType="org.jeecg.modules.detail.dto.InterlockDetailQueryDTO" resultType="org.jeecg.modules.history.vo.InterlockDetailHistoryQueryVO">
         select d.id, d.summaryid, d.interlockname, d.interlock_condition, d.interlock_condition_tag, d.description,
-        d.instrument_status, d.interlock_set_value, d.current_value, d.if_bypass, d.input_status, d.output_status,
-        d.mp_status, s.ljgx, s.interlock_out_value, s.tag_time, d.summary_origin_id
-        from interlock_detail_history d left join interlock_summary_history s on d.summaryid = s.id
+               d.instrument_status, d.interlock_set_value, d.current_value, d.if_bypass, d.bypass, d.input_status,
+               d.output_status, d.mp_status, s.ljgx, s.interlock_out_value, s.tag_time, d.summary_origin_id,
+               h1.control_system_status_name as mp_status_name,
+               h2.control_system_status_name as input_status_name,
+               h3.control_system_status_name as output_status_name,
+               h4.bypass_name
+        from interlock_detail_history d
+        left join interlock_summary_history s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.control_system_status = d.mp_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.control_system_status = d.input_status and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.control_system_status = d.output_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.bypass = d.bypass and h4.interlock_system_id = s.interlock_system_id
         <where>
             <if test="dto.summaryid != null and dto.summaryid != ''"> and d.summaryid = #{dto.summaryid}</if>
             <if test="dto.summaryOriginId != null and dto.summaryOriginId != ''"> and d.summary_origin_id = #{dto.summaryOriginId}</if>
@@ -20,8 +29,8 @@
     <select id="getPage" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
         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.tag_time, d.summary_origin_id, s.interlock_apparatus_id, s.interlock_system_id,
-        h1.interlock_status_name as interlockStatus_dictText, h2.bypass_name as bypass_dictText,
-        h3.instrument_status_name as instrument_status_dictText, h4.control_system_status_name as controlSystemStatus_dictText
+        h1.interlock_status_name, h2.bypass_name,
+        h3.instrument_status_name, h4.control_system_status_name
         from interlock_detail_history d
         left join interlock_summary_history 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

+ 9 - 11
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockDetailHistoryServiceImpl.java

@@ -68,15 +68,13 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
      * 联锁历史数据详细信息-分页查询
      */
     public IPage<InterlockDetailHistoryQueryVO> getPage2(Page<InterlockDetailHistoryQueryVO> page, InterlockDetailQueryDTO dto){
-        IPage<InterlockDetailHistoryQueryVO> voiPage = interlockDetailHistoryMapper.getPage2(page, dto);
-        return zhDetailHistoryQueryVOIPage(voiPage,dto.getInterlockSystemId());
+        return interlockDetailHistoryMapper.getPage2(page, dto);
     }
 
     /**
      * 联锁历史数据——各种逻辑状态分页查询
      */
     public IPage<InterlockSummaryHistoryVO> getPage(Page<InterlockSummaryHistoryVO> page, InterlockHistoryQueryDTO dto){
-//        IPage<InterlockSummaryHistoryVO> voiPage = interlockDetailHistoryMapper.getPage(page, dto);
         return interlockDetailHistoryMapper.getPage(page, dto);
     }
 
@@ -495,23 +493,23 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
             List<InterlockDetailHistoryQueryVO> list = voiPage.getRecords().stream().map(i->{
                 //旁路状态转换
                 if(i.getBypass()!=null && base.getBypassYes()!=null){
-                    if(i.getBypass().equals(base.getBypassYes())) i.setBypass_dictText(base.getBypassYesName());
-                    else i.setBypass_dictText(base.getBypassNoName());
+                    if(i.getBypass().equals(base.getBypassYes())) i.setBypassName(base.getBypassYesName());
+                    else i.setBypassName(base.getBypassNoName());
                 }
                 //输入卡件状态转换
                 if(i.getInputStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getInputStatus().equals(base.getControlSystemStatusNormal())) i.setInputStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setInputStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getInputStatus().equals(base.getControlSystemStatusNormal())) i.setInputStatusName(base.getControlSystemStatusNormalName());
+                    else i.setInputStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 //输出卡件状态转换
                 if(i.getOutputStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getOutputStatus().equals(base.getControlSystemStatusNormal())) i.setOutputStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setOutputStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getOutputStatus().equals(base.getControlSystemStatusNormal())) i.setOutputStatusName(base.getControlSystemStatusNormalName());
+                    else i.setOutputStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 //MP状态转换
                 if(i.getMpStatus()!=null && base.getControlSystemStatusNormal()!=null){
-                    if(i.getMpStatus().equals(base.getControlSystemStatusNormal())) i.setMpStatus_dictText(base.getControlSystemStatusNormalName());
-                    else i.setMpStatus_dictText(base.getControlSystemStatusAbnormalName());
+                    if(i.getMpStatus().equals(base.getControlSystemStatusNormal())) i.setMpStatusName(base.getControlSystemStatusNormalName());
+                    else i.setMpStatusName(base.getControlSystemStatusAbnormalName());
                 }
                 return i;
             }).collect(Collectors.toList());

+ 7 - 8
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/vo/InterlockDetailHistoryQueryVO.java

@@ -49,27 +49,26 @@ public class InterlockDetailHistoryQueryVO {
     @Dict(dicCode = "if_bypass")
     @ApiModelProperty(value = "是否旁路(0否1是)")
     private java.lang.String ifBypass;
-    /**旁路状态(0否1是)*/
-    @Excel(name = "旁路状态(0否1是)", width = 15, dicCode = "bypass")
-//    @Dict(dicCode = "bypass")
-    @ApiModelProperty(value = "旁路状态(0否1是)")
+    /**旁路状态*/
+    @Excel(name = "旁路状态", width = 15, dicCode = "bypass")
+    @ApiModelProperty(value = "旁路状态")
     private java.lang.String bypass;
-    private java.lang.String bypass_dictText;
+    private java.lang.String bypassName;
     /**输入卡件状态*/
     @Excel(name = "输入卡件状态", width = 15)
     @ApiModelProperty(value = "输入卡件状态")
     private java.lang.String inputStatus;
-    private java.lang.String inputStatus_dictText;
+    private java.lang.String inputStatusName;
     /**输出卡件状态*/
     @Excel(name = "输出卡件状态", width = 15)
     @ApiModelProperty(value = "输出卡件状态")
     private java.lang.String outputStatus;
-    private java.lang.String outputStatus_dictText;
+    private java.lang.String outputStatusName;
     /**MP状态*/
     @Excel(name = "MP状态", width = 15)
     @ApiModelProperty(value = "MP状态")
     private java.lang.String mpStatus;
-    private java.lang.String mpStatus_dictText;
+    private java.lang.String mpStatusName;
 
     /**逻辑关系*/
     @Excel(name = "逻辑关系", width = 15)

+ 1 - 3
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/convert/InterlockSummaryConvert.java

@@ -35,12 +35,10 @@ public interface InterlockSummaryConvert {
     @Mapping(target = "interlockOutValueTag",source = "interlockAddDTO.interlockOutValueTag")
     @Mapping(target = "interlockOutValue",source = "interlockAddDTO.interlockOutValue")
     @Mapping(target = "ljgx",source = "interlockAddDTO.ljgx")
-    @Mapping(target = "interlockStatus",source = "interlockStatus")
-    @Mapping(target = "loopHealthLevel",source = "loopHealthLevel")
     @Mapping(target = "deviceId",source = "interlockAddDTO.deviceId")
     @Mapping(target = "moduleName",source = "interlockAddDTO.moduleName")
     @Mapping(target = "tagTime",source = "interlockAddDTO.tagTime")
-    InterlockSummary toInterlockSummary(InterlockAddDTO interlockAddDTO,String interlockStatus,String loopHealthLevel);
+    InterlockSummary toInterlockSummary(InterlockAddDTO interlockAddDTO);
 
     /**
      * 转化成summary——用于联锁编辑里的编辑

+ 5 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/service/impl/InterlockSummaryServiceImpl.java

@@ -31,6 +31,7 @@ import org.jeecg.modules.temp.mapper.InterlockDetailTempMapper;
 import org.jeecg.modules.temp.mapper.InterlockSummaryTempMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.time.Duration;
@@ -146,6 +147,8 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
     /**
      *   联锁管理——编辑联锁
      */
+
+    @Transactional(rollbackFor = Exception.class)
     public void editLS(InterlockAddDTO interlockAddDTO){
         // 获取当前日期时间
         LocalDateTime currentDateTime = LocalDateTime.now();
@@ -288,6 +291,7 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
     /**
      *   联锁管理——新增联锁
      */
+    @Transactional(rollbackFor = Exception.class)
     public void addLS(InterlockAddDTO interlockAddDTO){
         // 获取当前日期时间
         LocalDateTime currentDateTime = LocalDateTime.now();
@@ -319,7 +323,7 @@ public class InterlockSummaryServiceImpl extends ServiceImpl<InterlockSummaryMap
         String instrumentStatus = instrumentStatusNormal;// 总体 先设置为 仪表状态-正常
 
         //新增——联锁总表数据
-        InterlockSummary interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary(interlockAddDTO,interlockStatus,loopHealthLevel);
+        InterlockSummary interlockSummary = InterlockSummaryConvert.INSTANCE.toInterlockSummary(interlockAddDTO);
         interlockSummaryMapper.insert(interlockSummary);
 
         String summaryId = interlockSummary.getId();