浏览代码

温度报警发送模板消息逻辑修复

M墨鱼—_mo 5 年之前
父节点
当前提交
9bf7c2485c

+ 2 - 0
common/src/main/java/com/jpsoft/smart/modules/base/dao/WarningPusherDAO.java

@@ -17,4 +17,6 @@ public interface WarningPusherDAO {
 	List<WarningPusher> search(Map<String,Object> searchParams,List<Sort> sortList);
 
     List<WarningPusher> findByCompanyId(String companyId);
+
+    List<WarningPusher> findByIdList(List<String> code);
 }

+ 2 - 0
common/src/main/java/com/jpsoft/smart/modules/base/service/WarningPusherService.java

@@ -16,4 +16,6 @@ public interface WarningPusherService {
 	Page<WarningPusher> pageSearch(Map<String, Object> searchParams,int pageNum,int pageSize,boolean count,List<Sort> sortList);
 
     List<WarningPusher> findByCompanyId(String companyId);
+
+    List<WarningPusher> findByIdList(List<String> idList);
 }

+ 6 - 3
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonDeviceLogServiceImpl.java

@@ -130,7 +130,10 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
             if (deviceInfo == null) {
                 throw new Exception(personDeviceLog.getDeviceNo() + "设备不存在");
             }
-            List<WarningPusher> warningPusherList = warningPusherService.findByCompanyId(personInfo.getCompanyId());
+
+            List<String> idList = Arrays.asList(companyInfo.getCode().split(","));
+
+            List<WarningPusher> warningPusherList = warningPusherService.findByIdList(idList);
             if (warningPusherList.size() > 0) {
 
 
@@ -189,11 +192,11 @@ public class PersonDeviceLogServiceImpl implements PersonDeviceLogService {
 
     @Override
     public List<PersonInfo> queryUnAttendanceList(String companyCode, Date startTime, Date endTime) {
-        return personDeviceLogDAO.queryUnAttendanceList(companyCode,startTime,endTime);
+        return personDeviceLogDAO.queryUnAttendanceList(companyCode, startTime, endTime);
     }
 
     @Override
     public List<PersonInfo> queryAttendanceList(String companyCode, Date startTime, Date endTime) {
-        return personDeviceLogDAO.queryAttendanceList(companyCode,startTime,endTime);
+        return personDeviceLogDAO.queryAttendanceList(companyCode, startTime, endTime);
     }
 }

+ 11 - 6
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/WarningPusherServiceImpl.java

@@ -29,14 +29,14 @@ public class WarningPusherServiceImpl implements WarningPusherService {
 	public int insert(WarningPusher model) {
 		// TODO Auto-generated method stub
 		//model.setId(UUID.randomUUID().toString());
-		
+
 		return warningPusherDAO.insert(model);
 	}
 
 	@Override
 	public int update(WarningPusher model) {
 		// TODO Auto-generated method stub
-		return warningPusherDAO.update(model);		
+		return warningPusherDAO.update(model);
 	}
 
 	@Override
@@ -49,22 +49,22 @@ public class WarningPusherServiceImpl implements WarningPusherService {
 	public boolean exist(String id) {
 		// TODO Auto-generated method stub
 		int count = warningPusherDAO.exist(id);
-		
+
 		return count > 0 ? true : false;
 	}
-	
+
 	@Override
 	public List<WarningPusher> list() {
 		// TODO Auto-generated method stub
 		return warningPusherDAO.list();
 	}
-		
+
 	@Override
 	public Page<WarningPusher> pageSearch(Map<String, Object> searchParams, int pageNumber, int pageSize,boolean count,List<Sort> sortList) {
         Page<WarningPusher> page = PageHelper.startPage(pageNumber,pageSize,count).doSelectPage(()->{
             warningPusherDAO.search(searchParams,sortList);
         });
-        
+
         return page;
 	}
 
@@ -72,4 +72,9 @@ public class WarningPusherServiceImpl implements WarningPusherService {
 	public List<WarningPusher> findByCompanyId(String companyId) {
 		return warningPusherDAO.findByCompanyId(companyId);
 	}
+
+	@Override
+	public List<WarningPusher> findByIdList(List<String> idList) {
+		return warningPusherDAO.findByIdList(idList);
+	}
 }

+ 2 - 2
common/src/main/java/com/jpsoft/smart/modules/common/utils/WeixinUtil.java

@@ -323,8 +323,8 @@ public class WeixinUtil {
 
 	public static void main(String[] args){
 
-		String result = createMenu("wxb935babc7dd147b8","9cb08ae433a8ad88d77ff921f9175577");
-		System.out.println(result);
+		//String result = createMenu("wx0b3c41a903053808","43557bd62f77b0c3d6670e991872f0e7");
+		System.out.println("//");
 	}
 
 

+ 7 - 0
common/src/main/resources/mapper/base/WarningPusher.xml

@@ -135,4 +135,11 @@
     <select id="findByCompanyId" resultMap="WarningPusherMap">
         select * from base_warning_pusher where company_id=#{companyId} and del_flag = 0
     </select>
+    <select id="findByIdList" resultMap="WarningPusherMap">
+        select * from base_warning_pusher where company_id in
+        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">   #{item}
+        </foreach>
+        and del_flag = 0
+    </select>
+
 </mapper>

+ 21 - 0
web/src/test/java/com/jpsoft/smart/LApiTest.java

@@ -1,7 +1,9 @@
 package com.jpsoft.smart;
 
+import com.jpsoft.smart.modules.base.dao.WarningPusherDAO;
 import com.jpsoft.smart.modules.base.dto.PersonDeviceLogDTO;
 import com.jpsoft.smart.modules.base.entity.DeviceInfo;
+import com.jpsoft.smart.modules.base.entity.WarningPusher;
 import com.jpsoft.smart.modules.common.dto.MessageResult;
 import com.jpsoft.smart.modules.lapi.service.ILapiService;
 import com.jpsoft.smart.modules.lapi.vo.LapiMsgResult;
@@ -12,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -25,6 +29,9 @@ public class LApiTest {
     @Autowired
     private ILapiService lapiService;
 
+    @Autowired
+    private WarningPusherDAO warningPusherDAO;
+
     @Test
     public void testKeepLive(){
         try {
@@ -161,6 +168,20 @@ public class LApiTest {
 
     }
 
+    @Test
+    public void testWarningPushFindByIdList(){
+        try {
+            String ids = "c6083b40-6025-11ea-9760-f0761c318e92,5cebd719-9e0e-4f0b-8414-4d7abe430ebf";
+            List<String> idList = Arrays.asList(ids.split(","));
+
+            List<WarningPusher> list = warningPusherDAO.findByIdList(idList);
+            System.out.println(list);
+        } catch (Exception e) {
+            e.printStackTrace();
+            String message = e.getMessage();
+        }
+
+    }
 
 
 }