Commit 5a503356 by 徐高华

定时修复部门

parent 35e25ce4
......@@ -34,4 +34,17 @@ public interface HaobanTimerApiService {
*/
public ServiceResponse<Void> repairExternalUserId(String wxEnterpriseId) ;
/**
*
* @Title: repairStaffDepart
* @Description: 修复成员部门
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
public ServiceResponse<Void> repairStaffDepart(String params) ;
}
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
public interface StaffDepartmentRelatedMapper {
......@@ -39,4 +41,6 @@ public interface StaffDepartmentRelatedMapper {
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("staffId") String staffId
);
List<String> listNoDepartStaff(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("addDate")Date addDate) ;
}
\ No newline at end of file
......@@ -34,8 +34,16 @@ public interface StaffDepartmentRelatedService {
public int update(TabHaobanStaffDepartmentRelated tab);
/**
*
* @Title: repairAllStaffDepart
* @Description: 定时修复成员部门
* @author xugh
* @param params
* @throws
*/
public void repairAllStaffDepart(String params) ;
public void repairStaffDepart(String staffId) ;
public void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, Integer[] departmentIds) ;
}
......@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
......@@ -117,6 +118,25 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
}
@Override
public void repairAllStaffDepart(String params) {
logger.info("修复成员部门={}",params);
int addDay = 0 ;
String wxEnterpriseId = null ;
if(params.contains("#")) {
addDay = Integer.parseInt(params.split("#")[0]) ;
wxEnterpriseId = params.split("#")[1] ;
}
Date addDate = DateUtil.addDay(DateUtil.getStartTimeOfDay(),-addDay) ;
List<String> list = this.mapper.listNoDepartStaff(wxEnterpriseId, addDate) ;
if(CollectionUtils.isNotEmpty(list)) {
for(String staffId : list) {
this.repairStaffDepart(staffId);
}
}
logger.info("修复成员部门完成={}",params);
}
@Override
public void repairStaffDepart(String staffId) {
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ;
String wxEnterpriseId = staff.getWxEnterpriseId() ;
......
......@@ -6,6 +6,7 @@ import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
@Service("haobanTimerApiService")
......@@ -13,10 +14,10 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
@Autowired
private HmQrcodeTempService hmQrcodeTempService ;
@Autowired
private ExternalClerkRelatedService externalClerkRelatedService ;
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService ;
@Override
public ServiceResponse<Void> deleteTempWxHm(String params) {
......@@ -29,6 +30,11 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
this.externalClerkRelatedService.repairExternalUserId(wxEnterpriseId) ;
return ServiceResponse.success();
}
@Override
public ServiceResponse<Void> repairStaffDepart(String params) {
this.staffDepartmentRelatedService.repairAllStaffDepart(params);
return ServiceResponse.success();
}
}
......@@ -187,6 +187,17 @@
from tab_haoban_staff_department_related
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId}
</select>
<select id="listNoDepartStaff" resultType="String">
SELECT distinct(a.staff_id) FROM `tab_haoban_staff` a LEFT JOIN `tab_haoban_staff_department_related` b ON a.`staff_id` = b.`staff_id` AND b.`status_flag` = 1
WHERE
a.create_time >= #{addDate}
<if test="null != wxEnterpriseId">
and a.wx_enterprise_id = #{wxEnterpriseId}
</if>
AND a.status_flag = 1 AND b.`staff_department_related_id` IS NULL
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment