Переглянути джерело

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper into master

seyason 2 роки тому
батько
коміт
55b7f298bf

+ 27 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeTypeController.java

@@ -1,15 +1,21 @@
 package com.management.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.TimeType;
-import com.management.platform.mapper.TimeTypeMapper;
+import com.management.platform.entity.User;
+import com.management.platform.mapper.UserMapper;
 import com.management.platform.service.TimeTypeService;
+import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
+import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
 
 /**
  * <p>
@@ -24,17 +30,32 @@ import javax.annotation.Resource;
 public class TimeTypeController {
     @Resource
     TimeTypeService timeTypeService;
-
+    @Resource
+    UserMapper userMapper;
+    @Resource
+    UserService userService;
     @RequestMapping("/getCompanyTimeSetting")
     public HttpRespMsg get(Integer companyId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        httpRespMsg.data = timeTypeService.getById(companyId);
+        List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("report_status", 1));
+        HashMap map=new HashMap();
+        map.put("result",  timeTypeService.getById(companyId));
+        map.put("userList", userList);
+        httpRespMsg.data=map;
         return httpRespMsg;
     }
 
-    @RequestMapping("save")
-    public HttpRespMsg save(TimeType record) {
+    @RequestMapping("/save")
+    public HttpRespMsg save(TimeType record,String ids) {
         Boolean success = timeTypeService.updateById(record);
+        if(!StringUtils.isEmpty(ids)){
+            String[] split = ids.split(",");
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().in(  "id", Arrays.asList(split)));
+            userList.forEach(u->{
+                u.setReportStatus(1);
+            });
+            userService.updateBatchById(userList);
+        }
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         if (!success) {
             httpRespMsg.setError("保存失败");

+ 12 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -1,14 +1,15 @@
 package com.management.platform.entity;
 
-import java.math.BigDecimal;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 
@@ -223,6 +224,13 @@ public class TimeType extends Model<TimeType> {
     private Integer isSecretSalary;
 
 
+    /**
+     * 0-每日提醒当天漏填 1-每日提醒昨天漏填
+     */
+    @TableField("alert_type")
+    private Integer alertType;
+
+
     @Override
     protected Serializable pkVal() {
         return this.companyId;

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java

@@ -195,6 +195,12 @@ public class User extends Model<User> {
     @TableField("position")
     private String position;
 
+    /**
+     * 0-需要填报 1-不需填报
+     */
+    @TableField("report_status")
+    private Integer reportStatus;
+
 
     @TableField(exist = false)
     private List<UserCert> certList;

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/UserMapper.java

@@ -27,7 +27,7 @@ public interface UserMapper extends BaseMapper<User> {
                                                       @Param("companyId") Integer companyId,
                                                       @Param("departmentIds") List departmentIds, String keyword, Integer status, @Param("roleId") Integer roleId);
 
-    List<Map<String, Object>> getPushUserList(@Param("companyId") Integer companyId);
+    List<Map<String, Object>> getPushUserList(@Param("companyId") Integer companyId,Integer alertType);
 
     List<Map<String, Object>> getPushDingdingUserList(@Param("alertTime") String alertTime);
 

+ 2 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -309,14 +309,13 @@ public class TimingTask {
         String str = dt.format(now);
         List<TimeType> typeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().isNotNull("alert_time")
                 .ge("alert_time", str));
-
         typeList.forEach(t->{
             if (str.equals(t.getAlertTime())) {
                 //发送推送提醒
-                List<Map<String, Object>> userList = userMapper.getPushUserList(t.getCompanyId());
+                List<Map<String, Object>> userList = userMapper.getPushUserList(t.getCompanyId(),t.getAlertType());
                 List<WxCorpInfo> cpList = wxCorpInfoMapper.selectList(new QueryWrapper<WxCorpInfo>().eq("company_id", t.getCompanyId()));
                 userList.forEach(u->{
-                    if (u.get("corpwxUserid") != null) {
+                    if (u.get("corpwxUserid") != null){
                         //推送到企业微信
                         String corpUid = (String) u.get("corpwxUserid");
                         JSONObject json=new JSONObject();

Різницю між файлами не показано, бо вона завелика
+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 13 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/UserMapper.xml

@@ -29,6 +29,7 @@
         <result column="corpwx_userid" property="corpwxUserid" />
         <result column="inactive_date" property="inactiveDate" />
         <result column="position" property="position" />
+        <result column="report_status" property="reportStatus" />
     </resultMap>
     <resultMap id="BaseResultMap2" type="com.management.platform.entity.User">
         <id column="id" property="id" />
@@ -38,7 +39,7 @@
     </resultMap>
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost, month_cost, salary_type, manage_dept_id, color, is_active, wx_openid, role_id, role_name, cost_apply_date, dingding_userid, dingding_unionid, corpwx_userid, inactive_date, position
+        id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost, month_cost, salary_type, manage_dept_id, color, is_active, wx_openid, role_id, role_name, cost_apply_date, dingding_userid, dingding_unionid, corpwx_userid, inactive_date, position,report_status
     </sql>
     <!--单独分页获取人员-->
     <select id="getUserByDepartment" resultType="java.util.Map">
@@ -91,7 +92,15 @@
         WHERE a.company_id = #{companyId}
         AND (a.wx_openid IS NOT NULL or corpwx_userid is not null)
         AND a.is_active = 1
-        AND NOT EXISTS(SELECT 1 FROM report WHERE report.`creator_id` = a.id AND report.`create_date` = DATE_FORMAT(NOW(), '%Y-%m-%d'))
+        AND a.report_status =0
+        <choose>
+            <when test="alertType!=null and alertType==1">
+                AND NOT EXISTS(SELECT 1 FROM report WHERE report.`creator_id` = a.id AND report.`create_date` = DATE_FORMAT(date_sub(NOW(),interval 1 day), '%Y-%m-%d'))
+            </when>
+            <otherwise>
+                AND NOT EXISTS(SELECT 1 FROM report WHERE report.`creator_id` = a.id AND report.`create_date` = DATE_FORMAT(NOW(), '%Y-%m-%d'))
+            </otherwise>
+        </choose>
     </select>
 
 
@@ -100,7 +109,8 @@
         FROM user AS a left join time_type on time_type.company_id = a.company_id
         WHERE a.dingding_userid is not null and time_type.alert_time = #{alertTime}
         AND a.is_active = 1
-        AND NOT EXISTS(SELECT 1 FROM report WHERE report.`creator_id` = a.id AND report.`create_date` = DATE_FORMAT(NOW(), '%Y-%m-%d'))
+        AND a.report_status=0
+        AND NOT EXISTS(SELECT 1 FROM report WHERE report.`creator_id` = a.id AND ((report.`create_date` = DATE_FORMAT(date_sub(NOW(),interval 1 day), '%Y-%m-%d') and time_type.alert_type=1)or(report.`create_date` = DATE_FORMAT(NOW(), '%Y-%m-%d') and time_type.alert_type=0)))
         order by a.company_id
     </select>
     <!--获取项目的参与人的推送id -->