Commit f4012a24 by 徐高华

服务到期退出登录

parent 01df5ee5
......@@ -128,5 +128,10 @@ public interface HaobanTimerApiService {
*/
void openStaffTimer(String params) ;
/**
* 托管服务到期
* @param params
*/
void openStaffServiceTimer(String params) ;
}
......@@ -56,4 +56,6 @@ public interface OpenStaffMapper {
int updateByAutoLogin(@Param("id") Long openStaffId ,@Param("uuid") String uuid) ;
List<TabOpenStaff> listAllOnlineEnterprise() ;
}
\ No newline at end of file
......@@ -30,4 +30,6 @@ public interface OpenStaffService {
String autoLogin(Long openStaffId , Long qwUserId) ;
void openStaffTimer();
void openStaffServiceTimer();
}
......@@ -8,8 +8,10 @@ import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.PageHelperUtils;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.enterprise.api.dto.EnterpriseUsingPermissionDto;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.dto.StoreSearchDTO;
import com.gic.enterprise.api.service.EnterpriseUseForbidService;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.api.dto.OpenStaffListDTO;
......@@ -58,6 +60,8 @@ public class OpenStaffServiceImpl implements OpenStaffService {
private NoticeMessageApiService noticeMessageApiService;
@Autowired
private StaffMapper staffMapper;
@Autowired
private EnterpriseUseForbidService enterpriseUseForbidService;
@Override
public TabOpenStaff save(TabOpenStaff tab) {
......@@ -251,4 +255,42 @@ public class OpenStaffServiceImpl implements OpenStaffService {
}
}
}
@Override
public void openStaffServiceTimer() {
log.info("托管服务到期");
List<TabOpenStaff> list = this.openStaffMapper.listAllOnlineEnterprise();
if(CollectionUtils.isNotEmpty(list)) {
for (TabOpenStaff item : list) {
String wxEnterpriseId = item.getWxEnterpriseId() ;
String enterpriseId = item.getEnterpriseId() ;
boolean isValid = this.isValid(wxEnterpriseId,enterpriseId) ;
log.info("是否有效={},{},{}",isValid,wxEnterpriseId,enterpriseId);
if (!isValid) {
List<TabOpenStaff> staffList = this.openStaffMapper.listAllOnline(wxEnterpriseId, enterpriseId);
if(CollectionUtils.isNotEmpty(staffList)) {
staffList.forEach(o->{
this.logout(o.getUuid(),"服务过期",0,null);
});
}
}
}
}
}
private boolean isValid(String wxEnterpriseId, String enterpriseId) {
ServiceResponse<EnterpriseUsingPermissionDto> resp = this.enterpriseUseForbidService.getWxEnterpriseService(enterpriseId, wxEnterpriseId);
log.info("托管许可={}", JSONObject.toJSONString(resp));
if (resp.isSuccess()) {
EnterpriseUsingPermissionDto dto = resp.getResult();
if (null == dto) {
return false ;
} else {
if (dto.getServiceEndDate().before(new Date())) {
return false ;
}
}
}
return true ;
}
}
......@@ -181,4 +181,9 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
public void openStaffTimer(String params) {
this.openStaffService.openStaffTimer() ;
}
@Override
public void openStaffServiceTimer(String params) {
this.openStaffService.openStaffServiceTimer() ;
}
}
......@@ -244,6 +244,11 @@
</if>
</select>
<select id="listAllOnlineEnterprise" resultMap="BaseResultMap">
select wx_enterprise_id,enterprise_id from tab_haoban_open_staff where
status_flag = 1 and delete_flag = 0 group by wx_enterprise_id , enterprise_id
</select>
<select id="listOpenStoreId" resultType="java.lang.String">
select a.store_id from tab_haoban_staff_clerk_relation a left join tab_haoban_open_staff b on a.staff_id = b.staff_id
where a.wx_enterprise_id = #{wxEnterpriseId} and a.enterprise_id=#{enterpriseId} and a.status_flag = 1
......
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