Jelajahi Sumber

1.修改考勤设置。

zhengqiang 5 tahun lalu
induk
melakukan
99a679f6f7

+ 1 - 1
common/src/main/java/com/jpsoft/smart/modules/base/dao/PersonDeviceFilterLogDAO.java

@@ -48,7 +48,7 @@ public interface PersonDeviceFilterLogDAO {
 
     long countByTimeRangeAndCompanyCode(String companyCode,Long personId,int status, Date startDate, Date endDate);
 
-    List<PersonInfo> queryUnmeasuredList(String companyId, Date startTime, Date endTime);
+    List<PersonInfo> queryUnmeasuredList(String companyCode, Date startTime, Date endTime);
 
     long countUndetectedByCompanyCode(String companyCode,Long personId, Date startTime, Date endTime);
 }

+ 18 - 5
common/src/main/java/com/jpsoft/smart/modules/base/entity/AlarmConfig.java

@@ -38,11 +38,6 @@ public class AlarmConfig {
      */
     @ApiModelProperty(value = "几时几分开始")
     private String startTime;
-    /**
-     * 几时几分结束
-     */
-    @ApiModelProperty(value = "几时几分结束")
-    private String endTime;
 
     /**
      * 考勤时间
@@ -51,6 +46,12 @@ public class AlarmConfig {
     private String attendanceTime;
 
 
+    /**
+     * 几时几分结束
+     */
+    @ApiModelProperty(value = "几时几分结束")
+    private String endTime;
+
     /**
      * 是否删除
      */
@@ -80,4 +81,16 @@ public class AlarmConfig {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
+
+    /**
+     * 是否包含下级单位
+     */
+    @ApiModelProperty(value = "是否包含下级单位")
+    private Boolean subordinate;
+
+    /**
+     * 是否包含下级单位
+     */
+    @ApiModelProperty(value = "1-上班时间,2-下班时间")
+    private Integer classifier;
 }

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

@@ -199,8 +199,8 @@ public class PersonDeviceFilterLogServiceImpl implements PersonDeviceFilterLogSe
     }
 
     @Override
-    public List<PersonInfo> queryUnmeasuredList(String companyId, Date startTime, Date endTime) {
-        return personDeviceFilterLogDAO.queryUnmeasuredList(companyId,startTime,endTime);
+    public List<PersonInfo> queryUnmeasuredList(String companyCode, Date startTime, Date endTime) {
+        return personDeviceFilterLogDAO.queryUnmeasuredList(companyCode,startTime,endTime);
     }
 
     @Override

+ 15 - 4
common/src/main/resources/mapper/base/AlarmConfig.xml

@@ -10,12 +10,14 @@
         <result property="weekdays" column="weekdays_"/>
         <result property="startTime" column="start_time"/>
         <result property="endTime" column="end_time"/>
-        <result property="attendanceTime" column="attendance_time"/>
         <result property="delFlag" column="del_flag"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
         <result property="updateBy" column="update_by"/>
         <result property="updateTime" column="update_time"/>
+        <result property="subordinate" column="subordinate_"/>
+        <result property="attendanceTime" column="attendance_time"/>
+        <result property="classifier" column="classifier_"/>
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.AlarmConfig">
         <!--
@@ -25,7 +27,8 @@
         -->
         <![CDATA[
 		insert into base_alarm_config
-	    (id_,company_id,weekdays_,start_time,end_time,del_flag,create_by,create_time,update_by,update_time,attendance_time)
+	    (id_,company_id,weekdays_,start_time,end_time,del_flag,create_by,create_time,
+	    update_by,update_time,subordinate_,attendance_time,classifier_)
 		values
 		(
             #{id,jdbcType=VARCHAR}
@@ -38,7 +41,9 @@
             ,#{createTime,jdbcType= TIMESTAMP }
             ,#{updateBy,jdbcType=VARCHAR}
             ,#{updateTime,jdbcType= TIMESTAMP }
-            ,#{attendanceTime,jdbcType=VARCHAR}
+            ,#{subordinate,jdbcType= NUMERIC }
+            ,#{attendanceTime,jdbcType= VARCHAR }
+            ,#{classifier,jdbcType= NUMERIC }
 		)
 	]]>
     </insert>
@@ -78,8 +83,14 @@
             <if test="updateTime!=null">
                 update_time=#{updateTime,jdbcType= TIMESTAMP },
             </if>
+            <if test="subordinate!=null">
+                subordinate_=#{subordinate,jdbcType= NUMERIC },
+            </if>
             <if test="attendanceTime!=null">
-                attendance_time=#{attendanceTime,jdbcType= TIMESTAMP },
+                attendance_time=#{attendanceTime,jdbcType= VARCHAR },
+            </if>
+            <if test="classifier!=null">
+                classifier_=#{classifier,jdbcType= NUMERIC },
             </if>
         </set>
         where id_=#{id}

+ 2 - 2
common/src/main/resources/mapper/base/CompanyInfo.xml

@@ -111,8 +111,8 @@
 		]]>
         <where>
             a.del_flag = 0
-            <if test="searchParams.id != null">
-                and a.id_ like #{searchParams.id}
+            <if test="searchParams.name != null">
+                and a.name_ like #{searchParams.name}
             </if>
         </where>
         <foreach item="sort" collection="sortList" open="order by" separator=",">

+ 4 - 4
common/src/main/resources/mapper/base/PersonDeviceFilterLog.xml

@@ -278,10 +278,10 @@
     </select>
     <select id="queryUnmeasuredList" resultMap="com.jpsoft.smart.modules.base.dao.PersonInfoDAO.PersonInfoMap">
         <![CDATA[
-            select * from base_person_info
-            where company_id=#{companyId}
-            and del_flag=0
-            and id_ not in (
+            select * from base_person_info a,base_company_info b
+            where a.company_id=b.id_ and b.code_ like #{companyCode}
+            and a.del_flag=0
+            and a.id_ not in (
                 select person_id from base_person_device_filter_log
                 where record_time>=#{startTime}
                 and record_time <= #{endTime}

+ 1 - 3
common/src/main/resources/mapper/base/PersonInfo.xml

@@ -30,7 +30,6 @@
         <result property="updateTime" column="update_time"/>
         <result property="popedom" column="popedom_"/>
         <result property="wechatNoticeEnabled" column="wechat_notice_enabled"/>
-
     </resultMap>
     <insert id="insert" parameterType="com.jpsoft.smart.modules.base.entity.PersonInfo">
         <!--
@@ -149,7 +148,7 @@
                 popedom_=#{popedom,jdbcType= VARCHAR },
             </if>
             <if test="wechatNoticeEnabled!=null">
-                wechat_notice_enabled=#{wechatNoticeEnabled,jdbcType= NUMERIC },
+                wechat_notice_enabled=#{wechatNoticeEnabled,jdbcType= VARCHAR },
             </if>
         </set>
         where id_=#{id}
@@ -218,7 +217,6 @@
             <if test="'0'.toString() == searchParams.isUploadPhoto and null != searchParams.isUploadPhoto">
                 and a.face_image_url is null
             </if>
-
             <if test="searchParams.abnormalDate != null">
                 <![CDATA[
                 and a.id_ in (

+ 17 - 7
web/src/main/java/com/jpsoft/smart/modules/base/controller/AlarmConfigController.java

@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/base/alarmConfig")
@@ -53,7 +54,13 @@ public class AlarmConfigController {
             alarmConfig.setDelFlag(false);
             alarmConfig.setCreateBy(subject);
             alarmConfig.setCreateTime(new Date());
-            
+
+            if(StringUtils.isNotEmpty(alarmConfig.getWeekdays())){
+                String[] weekdays =  alarmConfig.getWeekdays().split(",");
+                String sortWeekDays = Arrays.stream(weekdays).sorted(Comparator.naturalOrder()).collect(Collectors.joining(","));
+                alarmConfig.setWeekdays(sortWeekDays);
+            }
+
             int affectCount = alarmConfigService.insert(alarmConfig);
 
             if (affectCount > 0) {
@@ -108,7 +115,13 @@ public class AlarmConfigController {
         try {
             alarmConfig.setUpdateBy(subject);
             alarmConfig.setUpdateTime(new Date());
-            
+
+            if(StringUtils.isNotEmpty(alarmConfig.getWeekdays())){
+                String[] weekdays =  alarmConfig.getWeekdays().split(",");
+                String sortWeekDays = Arrays.stream(weekdays).sorted(Comparator.naturalOrder()).collect(Collectors.joining(","));
+                alarmConfig.setWeekdays(sortWeekDays);
+            }
+
             int affectCount = alarmConfigService.update(alarmConfig);
 
             if (affectCount > 0) {
@@ -213,11 +226,8 @@ public class AlarmConfigController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("a.company_id,a.create_time","desc"));
-
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
-        }
+        sortList.add(new Sort("a.company_id","asc"));
+        sortList.add(new Sort("a.start_time","asc"));
 
         if (StringUtils.isNotEmpty(companyId)) {
             searchParams.put("companyId",companyId);

+ 3 - 3
web/src/main/java/com/jpsoft/smart/modules/base/controller/CompanyInfoController.java

@@ -337,7 +337,7 @@ public class CompanyInfoController {
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
-            String id,
+            String name,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -352,8 +352,8 @@ public class CompanyInfoController {
         List<Sort> sortList = new ArrayList<>();
         sortList.add(new Sort("sort_no","asc"));
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+        if (StringUtils.isNotEmpty(name)) {
+            searchParams.put("name","%" + name + "%");
         }
 
         Page<CompanyInfo> page = companyInfoService.pageSearch(searchParams,pageIndex,pageSize,sortList);

+ 25 - 11
web/src/main/java/com/jpsoft/smart/schduled/UnmeasureTemperatureAlarmTask.java

@@ -62,7 +62,7 @@ public class UnmeasureTemperatureAlarmTask {
             try {
                 String weekdays = alarmConfig.getWeekdays();
                 DateTime startTime = new DateTime(sdf.parse(date + " " + alarmConfig.getStartTime()));
-                DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getEndTime()));
+                DateTime endTime = new DateTime(sdf.parse(date + " " + alarmConfig.getAttendanceTime()));
 
                 DateTime alarmTime = endTime.plusMinutes(-10);
 
@@ -70,12 +70,12 @@ public class UnmeasureTemperatureAlarmTask {
                 if (weekdays.indexOf(String.valueOf(weekday)) != -1) {
                     if (now.compareTo(alarmTime)>=0 && now.compareTo(alarmTime.plusMinutes(intervalMinute))<0) {
                             //todo 通知个人
-                            noticePerson(alarmConfig.getCompanyId(),startTime,endTime);
+                            noticePerson(alarmConfig,startTime,endTime);
                     }
 
                     if (now.compareTo(endTime)>=0 && now.compareTo(endTime.plusMinutes(intervalMinute))<0) {
                         //todo 通知管理人员
-                        noticeManager(alarmConfig.getCompanyId(),startTime,endTime);
+                        noticeManager(alarmConfig,startTime,endTime);
                     }
                 }
             }
@@ -85,11 +85,17 @@ public class UnmeasureTemperatureAlarmTask {
         }
     }
 
-    private void noticePerson(String companyId, DateTime startTime, DateTime endTime) {
-        CompanyInfo companyInfo = companyInfoService.get(companyId);
+    private void noticePerson(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
+        CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
+
+        String companyCode = companyInfo.getCode();
+
+        if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
+            companyCode += "%";
+        }
 
         //todo 查询该单位当前时间段是否有人员未测体温
-        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyId,startTime.toDate(),endTime.toDate());
+        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
 
         if (unmeasuredList.size()==0){
             return;
@@ -97,7 +103,9 @@ public class UnmeasureTemperatureAlarmTask {
 
         //todo 给未测量人推送微信通知
         for (PersonInfo personInfo : unmeasuredList) {
-            if (StringUtils.isNotEmpty(personInfo.getOpenId())) {
+            if (personInfo.getWechatNoticeEnabled()!=null
+            && personInfo.getWechatNoticeEnabled()
+            && StringUtils.isNotEmpty(personInfo.getOpenId())) {
                 String message = "尊敬的用户:" + personInfo.getName()
                         + ",请在" + startTime.toString("HH:mm") + "至" + endTime.toString("HH:mm") + "时间内测量体温!";
 
@@ -106,11 +114,17 @@ public class UnmeasureTemperatureAlarmTask {
         }
     }
 
-    private void noticeManager(String companyId, DateTime startTime, DateTime endTime) {
-        CompanyInfo companyInfo = companyInfoService.get(companyId);
+    private void noticeManager(AlarmConfig alarmConfig, DateTime startTime, DateTime endTime) {
+        CompanyInfo companyInfo = companyInfoService.get(alarmConfig.getCompanyId());
+
+        String companyCode = companyInfo.getCode();
+
+        if (alarmConfig.getSubordinate()!=null && alarmConfig.getSubordinate()){
+            companyCode += "%";
+        }
 
         //todo 查询该单位当前时间段是否有人员未测体温
-        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyId,startTime.toDate(),endTime.toDate());
+        List<PersonInfo> unmeasuredList = personDeviceFilterLogService.queryUnmeasuredList(companyCode,startTime.toDate(),endTime.toDate());
 
         if (unmeasuredList.size()==0){
             return;
@@ -131,7 +145,7 @@ public class UnmeasureTemperatureAlarmTask {
         }
 
         //todo 查询该单位的通知人
-        List<WarningPusher> pusherList = warningPusherService.findByCompanyId(companyId);
+        List<WarningPusher> pusherList = warningPusherService.findByCompanyId(companyInfo.getId());
 
         //todo 给单位相关人员推送通知
         for (WarningPusher pusher: pusherList) {