소스 검색

健康公示墙bug修复

M墨鱼—_mo 5 년 전
부모
커밋
30093c98d5

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

@@ -29,4 +29,6 @@ public interface PersonInfoDAO {
     long countByCompanyList(List<CompanyInfo> list);
 
     long countByCompanyListAndPopedom(@Param("type") String type, @Param("list") List<CompanyInfo> list);
+
+	long countStudentByCompanyListAndPopedom(@Param("type") String type, @Param("list")List<CompanyInfo> list);
 }

+ 2 - 2
common/src/main/java/com/jpsoft/smart/modules/base/service/impl/PersonInfoServiceImpl.java

@@ -103,10 +103,10 @@ public class PersonInfoServiceImpl implements PersonInfoService {
 	@Override
 	public long countByCompanyListAndPopedom(String type,List<CompanyInfo> list) {
 		if ("teacher".equals(type)){
-			return personInfoDAO.countByCompanyListAndPopedom("2",list);
+			return personInfoDAO.countByCompanyListAndPopedom("%2%",list);
 		}
 		if ("student".equals(type)){
-			return personInfoDAO.countByCompanyListAndPopedom("1",list);
+			return personInfoDAO.countStudentByCompanyListAndPopedom("1",list);
 		}
 		return 0L;
 	}

+ 2 - 2
common/src/main/java/com/jpsoft/smart/modules/lapi/service/impl/LapiServiceImpl.java

@@ -795,7 +795,7 @@ public class LapiServiceImpl implements ILapiService {
             throw new Exception("设备不存在");
         }
         if (!deviceInfo.getIsOnline()) {
-            throw new Exception("设备离,请联系管理员");
+            throw new Exception("设备离线,请联系管理员");
         }
         //JSONObject jsonObject = LApiUtil.getRequest(deviceInfo.getIpAddress() + ":" + deviceInfo.getPort() + LApiConstant.RULE);
         JSONObject jsonObject = lapiRequest.send(deviceInfo.getDeviceNo(),LApiConstant.RULE,HttpMethod.GET,null);
@@ -812,7 +812,7 @@ public class LapiServiceImpl implements ILapiService {
             throw new Exception("设备不存在");
         }
         if (!deviceInfo.getIsOnline()) {
-            throw new Exception("设备离,请联系管理员");
+            throw new Exception("设备离线,请联系管理员");
         }
         HashMap<String, Object> map = new HashMap<>();
         map.put("Num", 3);

+ 15 - 7
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -6,7 +6,7 @@
     <resultMap id="PersonInfoMap" type="com.jpsoft.smart.modules.base.entity.PersonInfo">
         <id property="id" column="id_"/>
         <result property="companyId" column="company_id"/>
-        <result property="companyName" column="company_name" />
+        <result property="companyName" column="company_name"/>
         <result property="name" column="name_"/>
         <result property="phone" column="phone_"/>
         <result property="idCard" column="id_card"/>
@@ -184,7 +184,7 @@
                 and a.name_ like #{searchParams.name}
             </if>
             <if test="searchParams.nameList != null">
-                <foreach item="name" collection="searchParams.nameList"  open="and (" separator="or" close=")">
+                <foreach item="name" collection="searchParams.nameList" open="and (" separator="or" close=")">
                     a.name_ like #{name}
                 </foreach>
             </if>
@@ -264,7 +264,7 @@
         and b.code_ like #{code}
         <if test="personId!=null">
             or b.id_ in (
-                select c.company_id from base_person_company c where c.person_id = #{personId}
+            select c.company_id from base_person_company c where c.person_id = #{personId}
             )
         </if>
     </select>
@@ -275,7 +275,7 @@
         where a.del_flag = 0
         and b.code_ like #{searchParams.code}
         <if test="searchParams.nameList != null">
-            <foreach item="name" collection="searchParams.nameList"  open="and (" separator="or" close=")">
+            <foreach item="name" collection="searchParams.nameList" open="and (" separator="or" close=")">
                 a.name_ like #{name}
             </foreach>
         </if>
@@ -306,10 +306,18 @@
     <select id="countByCompanyListAndPopedom" resultType="Long">
         select count(*) from base_person_info where del_flag = 0
         and popedom_ like #{type}
-        and
-        company_id in
-        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
+
+        <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">
             #{item.id}
         </foreach>
     </select>
+
+    <select id="countStudentByCompanyListAndPopedom" resultType="Long">
+        select count(*) from base_person_info where del_flag = 0
+        and popedom_ = #{type}
+        <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">
+            #{item.id}
+        </foreach>
+
+    </select>
 </mapper>

+ 2 - 2
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/HealthShowApiController.java

@@ -334,8 +334,8 @@ public class HealthShowApiController {
                 //应测学生数
                 Integer studentNum = Math.toIntExact(personInfoService.countByCompanyListAndPopedom("student", list));
                 //已测教职工数
-                Integer checkedTeacherNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "2");
-                Integer checkedTeacherAndStudentNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "1");
+                Integer checkedTeacherNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "%2%");
+                Integer checkedTeacherAndStudentNum = personDeviceFilterLogService.getDayCheckedPersonNumByCompanyList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, "%1%");
 
                 //已测学生数
                 Integer checkedStudentNum = checkedTeacherAndStudentNum - checkedTeacherNum;

+ 16 - 0
web/src/test/java/com/jpsoft/smart/CheckNumCompanyTest.java

@@ -1,9 +1,12 @@
 package com.jpsoft.smart;
 
 import com.jpsoft.smart.modules.base.dao.CheckNumCompanyDAO;
+import com.jpsoft.smart.modules.base.dao.PersonInfoDAO;
 import com.jpsoft.smart.modules.base.dao.TotalCheckCompanyDAO;
 import com.jpsoft.smart.modules.base.entity.CheckNumCompany;
+import com.jpsoft.smart.modules.base.entity.CompanyInfo;
 import com.jpsoft.smart.modules.base.entity.TotalCheckCompany;
+import com.jpsoft.smart.modules.base.service.CompanyInfoService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +29,12 @@ public class CheckNumCompanyTest {
     @Autowired
     private TotalCheckCompanyDAO totalCheckCompanyDAO;
 
+    @Autowired
+    private PersonInfoDAO personInfoDAO;
+
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
     @Test
     public void testGet(){
        // CheckNumCompany checkNumCompany = checkNumCompanyDAO.get(1L);
@@ -52,4 +61,11 @@ public class CheckNumCompanyTest {
         System.out.println(i);
     }
 
+    @Test
+    public void testCountByCompanyListAndPopedom(){
+        List<CompanyInfo> list = companyInfoService.list();
+        Long i = personInfoDAO.countByCompanyListAndPopedom("%2%",list);
+        System.out.println(i);
+    }
+
 }